Nominate our 2022 Qt Champions!

QDoubleSpinBox -- how to tell if signal is from spin box or field

  • The QDoubleSpinBox is very close to what I basically need, with one notible issue.

    When handling the slots and signals I want this behavior:

    1. If I edit the text I want the signal after I hit enter.
    2. If I edit the spinner, I want the signal
    3. As I type in the text I DONT want a signal. I just want the signal after the user hits the enter key.

    The trouble this causes is with my Undo implementation. If I'm in the middle of typing a number in the field, I don't want store off a undo for every character! Is there a way to tell which control called the valueChange() ?

  • Hi,

    Not sure how to tell, but check what happens if you connect to the "void editingFinished()" signal. That might give you what you need

  • The editingFinished() is perfect when editing the text field. Its the valueChanged() signal I wish I could get more information about.

    The trouble with valueChanged() is basically this:

    1. The transaction of editing the text field really should "count" until either the user hits enter or the widget loses focus.

    2. But if I modify the spinner, its a completed transaction every time I hit the button.

Log in to reply