[Interest] QSpinBox threshold timer

Carl Schumann schumann at fnal.gov
Mon Jul 22 14:46:37 CEST 2013


Hi,

I am writing an application which allows the user to display content 
from a database.  The user controls what DB content is displayed via a 
QSpinBox.   So I connect the value changed signal of the spin box to a 
slot which queries the DB and updates the model with the results.

Unfortunately, when the user clicks once on the up or down buttons the 
value changed signal is sent twice.   I have compiled Qt with debug and 
made the following observation.   The first signal appears to be 
directly a result of the click.   The second signal appears to be the 
sent when the "spinClickThresholdTimer" expires. Apparently. this timer 
is part of logic to determine if the mouse button is being held down so 
the user can rapidly advance the spin box value.   In my scenario though 
the mouse button is not being held down.

The timeout on the above timer is apparently 500 milliseconds. This is 
in the ballpark of the time taken by the DB query.   If I modify the 
above slot to not do the DB query I don't see the duplicated signal, of 
course, the spin box value and DB values are then out of sync.

Any ideas about what I can do to correct the above scenario would be 
appreciated please.   Thanks for your time.

Sincerely,
Carl Schumann







More information about the Interest mailing list