[Qt-interest] QAbstractSlider usage

Ole Streicher ole-usenet-spam at gmx.net
Wed May 27 10:35:12 CEST 2009


Hi Ferenc,

Ferenc Stelcz <ferenc at stelcz.hu> writes:
> Small theoretical workaround (haven't tried it, so may be wrong):
> Make your own QLineEdit subclass and

Thanks for the lengthy answer, but this was the wrong side :-)

The QLineEdit example I wrote here was just a simplification of the
"real" problem. To make it more realistic:

I have a diagram that I want to zoom and to scroll (if zoomed). Zooming
shall be done around the center of the diagram. For zooming, I have "+"
and "-" buttons as well as a QSlider, an (editable) combo box and
QWheelEvents (when the Ctrl key was pressed).

When one now changes the zoom with Ctrl-mousewheel, a signal is
generated, changes the zoom of my diagram and updates the zoom qslider,
the zoom combobox and the scrollbar. 

The zoom qslider will emit another signal (!!!) with a slightly
different zoom value (based on its internal "integer" representation),
causing another zoom. This will again update zoom combobox and
scrollbar.

The scrollbar update leads to scroll events which again cause a diagram
update. Since I had two scrollbar updates, the diagram gets another two
updates.

In total, I get four (!) diagram updates for one zoom event: two zoom
changes, and two scroll changes. This makes the application feeling
*very* slow when responding to user actions.

Additionally, if one sets a certain zoom value with the combo box, he
does not only wait until these four operations are finished, but also
the value in the combo box changed a bit according to the qslider
"integer" representation.

In my opinion, I would need an option go get only user generated qslider
events, but there is no such signal (sliderMoved(int) is not a solution
since it is not emitted when the user changes the value by clicking on
the slider).

This seems to be a very common problem for me: zooming with different
methods is used in many applications. How do they solve this problem?

Or is my design just brain-dead?

Best regards

Ole




More information about the Qt-interest-old mailing list