Results 1 to 18 of 18

Thread: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

  1. #1
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Hi there,

    I created a simple GUI Application using QT Creator 2.6 and MSVC2010 with CDB on a Win7 SP1 32-Bit system.

    The QUI was created by QT Designer and has a doubleSpinBox. I setup the slot
    Qt Code:
    1. valueChanged(double)
    To copy to clipboard, switch view to plain text mode 
    of the doubleSpinBox. The slot is connected via
    Qt Code:
    1. connectSlotsByName
    To copy to clipboard, switch view to plain text mode 
    .

    Everything works fine, but if I set a breakpoint in the slot
    Qt Code:
    1. doubleSpinBox_valueChanged(double arg1)
    2. {
    3. }
    To copy to clipboard, switch view to plain text mode 
    there is a strange behaviour:

    On a click on the arrows of the doubleSpinbox the slot
    Qt Code:
    1. doubleSpinBox_valueChanged(double arg1)
    To copy to clipboard, switch view to plain text mode 
    is called TWICE and of course the value-property of the doubleSpinBox is incremented/decremented twice!
    I verified this by adding a
    Qt Code:
    1. qDebug << "doubleSpinBox_valueChanged hit"
    To copy to clipboard, switch view to plain text mode 
    to the slot.




    Is this a known issue?

    Thanks for your help in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    valueChanged() signal does not cause anything to be incremented or decremented. Could you explain better what you mean?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Hi wysota,

    sorry if didn't make things clear. I will try to do it better:

    I set a breakpoint in the slot valueChanged(double) of the doubleSpinBox. When I debug my GUI application and I click on the arrow-up-icon of the doubleSpinbox, then the breakpoint in the valueChanged(double)-Slot is hit and the old value is incremented as it should. But by clicking on F5 to continue the debugging, the breakpoint is hit again and the value of the doubleSpinBox is incremented again, i.e. twice!
    As I sad, I also added a qDebug << "doubleSpinBox_valueChanged hit" in the valueChanged(double)-Slot and the message appears twice in the debugger output!

    This happens only if a breakpoint is set in the valueChanged(double)-Slot. When I debug my GUI application without setting a breakpoint in the Slot, then by clickung on the arrow-up-icon the value is incremented only once and of course my qDebug-Message (as menitioned before) appears only once.

    I hope that things became more clear.
    Thanks for your help!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Quote Originally Posted by Marco W. View Post
    I set a breakpoint in the slot valueChanged(double) of the doubleSpinBox.
    There is no such slot. valueChanged() is a signal. Make up your mind -- are you setting a breakpoint in the valueChanged() signal in QDoubleSpinBox or in a on_doubleSpinBox_valueChanged slot connected to that signal?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Oh, ok maybe I mixed it up.

    I created a slot for the valueChanged() signal by right-clicking on the doubleSpinBox and selecting "Go to slot..." in QT Designer. The corresponding Signal and Slot are connected via QMetaObject::connectSlotsByName(MainWindow). This happens in the header file for the GUI (created by QT Designer).

    So, in fact, it is the on_doubleSpinBox_valueChanged(double arg1) slot where I set my breakpoint.

    Sorry for this inaccuracy and again thanks for helping me.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    In that case it is not possible that the slot is executed twice if you set a breakpoint on it. If the slot is executing twice then it means you have two connections to it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Well, but the slot is executed twice (and the value of the QdoubleSpinBox is incremented twice), if I set a breakpoint on it. I verified this by adding the qDebug() and printing a message to the debugger output.

    If there is no breakpoint set, then the message is printed only once (and the value of the QdoubleSpinBox is incremented only once).


    Is it possible that my Debugging Setup has some problems? Sometimes I get a message like:

    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\lib\Qt5Cored.dll
    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\lib\Qt5Widgetsd.dll
    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\lib\Qt5Guid.dll
    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\plugins\platforms\qwi ndowsd.dll

    or

    *** WARNING: Unable to verify checksum for MyApplicationName.exe

    or (because I'm doing some openCV stuff)

    *** WARNING: Unable to verify checksum for C:\opencv243\build\x86\vc10\bin\opencv_highgui243d .dll
    *** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\opencv243\build\x86\vc10\bin\opencv_highgui243d .dll -
    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\lib\Qt5Guid.dll
    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\lib\libGLESv2d.dll
    *** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Qt\Qt5.0.1\5.0.1\msvc2010\bin\icuuc49.dll -
    *** WARNING: Unable to verify checksum for MyApplicationName.exe

    Thanks

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Quote Originally Posted by Marco W. View Post
    Well, but the slot is executed twice (and the value of the QdoubleSpinBox is incremented twice), if I set a breakpoint on it. I verified this by adding the qDebug() and printing a message to the debugger output.
    That's no proof. Show me the backtrace which shows that the slot is called twice.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Hm, I'd like to, but I don't have a clue how to do that. Please, could you give a link / tutorial / some advice how to do a backtrace? Thanks


    Added after 42 minutes:


    This is, what is shown on the debugger log, when I click on the arrow-up-symbol on the QdoubleSpinbox with a breakpoint set in on_valueChanged(double) slot:


    Breakpoint 1 hit
    eax=0031c370 ebx=00000000 ecx=0031fbc0 edx=0031c4d4 esi=00000401 edi=0031dbd4
    eip=009b1418 esp=0031c344 ebp=0031c37c iopl=0 nv up ei pl nz na pe nc
    cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206
    > 20: int temp=0;
    testslider!MainWindow:n_doubleSpinBox_valueChanged+0x28:
    20 009b1418 c745f000000000 mov dword ptr [ebp-10h],0 ss:0023:0031c36c=0031c378

    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\lib\Qt5Cored.dll
    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\lib\Qt5Widgetsd.dll
    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\lib\Qt5Guid.dll
    *** WARNING: Unable to verify checksum for C:\Qt\Qt5.0.1\5.0.1\msvc2010\plugins\platforms\qwi ndowsd.dll
    sAn Haltepunkt 1 (1) im Thread 0 angehalten.
    dNOTE: INFERIOR SPONTANEOUS STOP
    sAngehalten.
    dState changed from InferiorRunOk(11) to InferiorStopOk(14) [master]
    <!qtcreatorcdbext.locals -t 2 -D -e inspect,local,return,watch -v -c -W 0
    DEBUG: Discarding watchers
    DEBUG: expandEntrySet local


    /////////THEN I PRESSED F5


    dNOTE: INFERIOR RUN REQUESTED
    sAusführung angefordert...
    dState changed from InferiorStopOk(14) to InferiorRunRequested(10) [master]
    <g
    dNOTE: INFERIOR RUN OK
    sLäuft.
    dState changed from InferiorRunRequested(10) to InferiorRunOk(11) [master]
    Breakpoint 1 hit
    eax=0031cf44 ebx=00000000 ecx=0031fbc0 edx=0031d0a8 esi=00000113 edi=0031dbd4
    eip=009b1418 esp=0031cf18 ebp=0031cf50 iopl=0 nv up ei pl nz na po nc
    cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
    > 20: int temp=0;
    testslider!MainWindow:n_doubleSpinBox_valueChanged+0x28:
    20 009b1418 c745f000000000 mov dword ptr [ebp-10h],0 ss:0023:0031cf40=0031cf4c
    sAn Haltepunkt 1 (1) im Thread 0 angehalten.
    dNOTE: INFERIOR SPONTANEOUS STOP
    sAngehalten.
    dState changed from InferiorRunOk(11) to InferiorStopOk(14) [master]
    <!qtcreatorcdbext.locals -t 3 -D -e inspect,local,return,watch -v -c -W 0
    DEBUG: Discarding watchers
    DEBUG: expandEntrySet local


    //THEN I PRESSED F5 AGAIN


    dNOTE: INFERIOR RUN REQUESTED
    sAusführung angefordert...
    dState changed from InferiorStopOk(14) to InferiorRunRequested(10) [master]
    <g

    dNOTE: INFERIOR RUN OK
    sLäuft.
    dState changed from InferiorRunRequested(10) to InferiorRunOk(11) [master]


    So, is it that, what you requested? I hope so. Thanks again.
    Last edited by Marco W.; 15th March 2013 at 15:40.

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    WIthout a backtrace (also called stacktrace) there is nothing I can do for you.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Please, could you give a link / tutorial / some advice how to do a backtrace? Thanks

  12. #12
    Join Date
    Mar 2013
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Marco, wysota is talking about the window that in VS2010 is called Call Stack. He is asking where the two calls to valueChanged are being made from.

    Have you, in VS2010, enabled the MS symbol import (Options/Debug/Symbols) - it will give the debugger a lot more info and make the Call stack more useful even for Debug configuration.

    The first thing I would do is verify that - without a breakpoint involved - a call to OutputDebugString("stuff") within your on_doubleSpinBox_valueChanged() function results in two lines being printed in the debugger Output window. If that happens, then I would strongly suggest you take wysota's hint and triple-check that you haven't managed to connect the signal and slot together twice. That is by far the most likely explanation for seeing.

    If you don't get two lines in the Output window, the call is not happening twice... something else is happening.

  13. #13
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Yes, but I am using QT Creator, so my question was, how to get this in QT Creator =/

    Is the following the content, that you asked for? It is shown right after the breakpoint in the on_dblSpinBoxThresh2_valueChanged is hit the first time.

    Qt Code:
    1. 0 cPMCannyWidget::on_dblSpinBoxThresh2_valueChanged cpmcannywidget.cpp 186 0x111441a
    2. 1 cPMCannyWidget::qt_static_metacall moc_cpmcannywidget.cpp 120 0x1118a12
    3. 2 cPMCannyWidget::qt_metacall moc_cpmcannywidget.cpp 165 0x1118bdb
    4. 3 QMetaObject::metacall qmetaobject.cpp 308 0x66ad2230
    5. 4 QMetaObject::activate qobject.cpp 3456 0x66b1628f
    6. 5 QMetaObject::activate qobject.cpp 3316 0x66b15c11
    7. 6 QDoubleSpinBox::valueChanged moc_qspinbox.cpp 411 0x64e167ab
    8. 7 QDoubleSpinBoxPrivate::emitSignals qspinbox.cpp 1074 0x64b8f722
    9. 8 QAbstractSpinBoxPrivate::setValue qabstractspinbox.cpp 1678 0x64ad079d
    10. 9 QAbstractSpinBox::stepBy qabstractspinbox.cpp 617 0x64acd702
    11. 10 QAbstractSpinBoxPrivate::updateState qabstractspinbox.cpp 1571 0x64ad0232
    12. 11 QAbstractSpinBox::mousePressEvent qabstractspinbox.cpp 1283 0x64acf363
    13. 12 QWidget::event qwidget.cpp 7831 0x649ca039
    14. 13 QAbstractSpinBox::event qabstractspinbox.cpp 752 0x64acdb30
    15. 14 QApplicationPrivate::notify_helper qapplication.cpp 3394 0x649828ce
    16. 15 QApplication::notify qapplication.cpp 2958 0x6498093c
    17. 16 QCoreApplication::notifyInternal qcoreapplication.cpp 767 0x66ac74c4
    18. 17 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 206 0x66bd7198
    19. 18 QApplicationPrivate::sendMouseEvent qapplication.cpp 2465 0x6497fa65
    20. 19 QWidgetWindow::handleMouseEvent qwidgetwindow.cpp 387 0x649fdbc0
    21. 20 QWidgetWindow::event qwidgetwindow.cpp 139 0x649fd134
    22. 21 QApplicationPrivate::notify_helper qapplication.cpp 3394 0x649828ce
    23. 22 QApplication::notify qapplication.cpp 2825 0x6498030a
    24. 23 QCoreApplication::notifyInternal qcoreapplication.cpp 767 0x66ac74c4
    25. 24 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 206 0x66bd7198
    26. 25 QGuiApplicationPrivate::processMouseEvent qguiapplication.cpp 1425 0x7efe64
    27. 26 QGuiApplicationPrivate::processWindowSystemEvent qguiapplication.cpp 1257 0x7ef6d2
    28. 27 QWindowSystemInterface::sendWindowSystemEventsImplementation qwindowsysteminterface.cpp 536 0x7d8541
    29. 28 QWindowSystemInterface::sendWindowSystemEvents qwindowsysteminterface.cpp 516 0x7d84c9
    30. 29 QWindowsGuiEventDispatcher::sendPostedEvents qwindowsguieventdispatcher.cpp 86 0xf69aff4
    31. 30 qt_internal_proc qeventdispatcher_win.cpp 423 0x66b4fb07
    32. 31 InternalCallWinProc USER32 0x76bec4e7
    33. 32 UserCallWinProcCheckWow USER32 0x76bec5e7
    34. 33 DispatchMessageWorker USER32 0x76becc19
    35. 34 DispatchMessageW USER32 0x76becc70
    36. 35 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 744 0x66b50bf3
    37. 36 QWindowsGuiEventDispatcher::processEvents qwindowsguieventdispatcher.cpp 78 0xf69af5e
    38. 37 QEventLoop::processEvents qeventloop.cpp 137 0x66ac40c1
    39. 38 QEventLoop::exec qeventloop.cpp 212 0x66ac421e
    40. 39 QCoreApplication::exec qcoreapplication.cpp 1020 0x66ac79fd
    41. 40 QGuiApplication::exec qguiapplication.cpp 1192 0x7ef468
    42. 41 QApplication::exec qapplication.cpp 2670 0x6497ffb9
    43. 42 main main.cpp 13 0x110242e
    44. 43 WinMain qtmain_win.cpp 131 0x111a8ea
    45. 44 __tmainCRTStartup crtexe.c 547 0x1119e10
    46. 45 WinMainCRTStartup crtexe.c 371 0x1119b9f
    47. 46 BaseThreadInitThunk kernel32 0x7701ed6c
    48. 47 __RtlUserThreadStart ntdll 0x7727377b
    49. 48 _RtlUserThreadStart ntdll 0x7727374e
    To copy to clipboard, switch view to plain text mode 


    On the second time, the breakpoint is hit:


    Qt Code:
    1. 0 cPMCannyWidget::on_dblSpinBoxThresh2_valueChanged cpmcannywidget.cpp 186 0x111441a
    2. 1 cPMCannyWidget::qt_static_metacall moc_cpmcannywidget.cpp 120 0x1118a12
    3. 2 cPMCannyWidget::qt_metacall moc_cpmcannywidget.cpp 165 0x1118bdb
    4. 3 QMetaObject::metacall qmetaobject.cpp 308 0x66ad2230
    5. 4 QMetaObject::activate qobject.cpp 3456 0x66b1628f
    6. 5 QMetaObject::activate qobject.cpp 3316 0x66b15c11
    7. 6 QDoubleSpinBox::valueChanged moc_qspinbox.cpp 411 0x64e167ab
    8. 7 QDoubleSpinBoxPrivate::emitSignals qspinbox.cpp 1074 0x64b8f722
    9. 8 QAbstractSpinBoxPrivate::setValue qabstractspinbox.cpp 1678 0x64ad079d
    10. 9 QAbstractSpinBox::stepBy qabstractspinbox.cpp 617 0x64acd702
    11. 10 QAbstractSpinBox::timerEvent qabstractspinbox.cpp 1182 0x64acee20
    12. 11 QObject::event qobject.cpp 1052 0x66b10ab3
    13. 12 QWidget::event qwidget.cpp 8235 0x649cae59
    14. 13 QAbstractSpinBox::event qabstractspinbox.cpp 752 0x64acdb30
    15. 14 QApplicationPrivate::notify_helper qapplication.cpp 3394 0x649828ce
    16. 15 QApplication::notify qapplication.cpp 3359 0x64982450
    17. 16 QCoreApplication::notifyInternal qcoreapplication.cpp 767 0x66ac74c4
    18. 17 QCoreApplication::sendEvent qcoreapplication.h 203 0x66acc849
    19. 18 QEventDispatcherWin32Private::sendTimerEvent qeventdispatcher_win.cpp 572 0x66b4ffd8
    20. 19 qt_internal_proc qeventdispatcher_win.cpp 427 0x66b4fb5a
    21. 20 InternalCallWinProc USER32 0x76bec4e7
    22. 21 UserCallWinProcCheckWow USER32 0x76bec5e7
    23. 22 DispatchMessageWorker USER32 0x76becc19
    24. 23 DispatchMessageW USER32 0x76becc70
    25. 24 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 744 0x66b50bf3
    26. 25 QWindowsGuiEventDispatcher::processEvents qwindowsguieventdispatcher.cpp 78 0xf69af5e
    27. 26 QEventLoop::processEvents qeventloop.cpp 137 0x66ac40c1
    28. 27 QEventLoop::exec qeventloop.cpp 212 0x66ac421e
    29. 28 QCoreApplication::exec qcoreapplication.cpp 1020 0x66ac79fd
    30. 29 QGuiApplication::exec qguiapplication.cpp 1192 0x7ef468
    31. 30 QApplication::exec qapplication.cpp 2670 0x6497ffb9
    32. 31 main main.cpp 13 0x110242e
    33. 32 WinMain qtmain_win.cpp 131 0x111a8ea
    34. 33 __tmainCRTStartup crtexe.c 547 0x1119e10
    35. 34 WinMainCRTStartup crtexe.c 371 0x1119b9f
    36. 35 BaseThreadInitThunk kernel32 0x7701ed6c
    37. 36 __RtlUserThreadStart ntdll 0x7727377b
    38. 37 _RtlUserThreadStart ntdll 0x7727374e
    To copy to clipboard, switch view to plain text mode 


    Thanks

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    As you can see in your second trace, there is just a single call to your slot method. The slot is not calling itself. It could be that the slot is called, then it returns and is called again but it doesn't happen as a result of the breakpoint. There is a timer event here so maybe it fires twice because stopping in the breakpoint and not continuing fast enough causes the timer to fire again. That's perfectly understandable.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #15
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Ok, thanks wysota!

    The explanation concerning the timer is understandable. However, I wonder why the timer triggers only once again, and not several times: if I wait for several seconds before continuing the second break, the slot is not called again.

    Is there a documentation for this, or in general, how the processing of a click on the up/down-arrow-button of a QdoubleSpinBox is done?
    Last edited by Marco W.; 19th March 2013 at 10:07.

  16. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Quote Originally Posted by Marco W. View Post
    However, I wonder why the timer triggers only once again, and not several times
    This is easy to explain. Timers fire as a result of event processing. When the timer fires for the first time, you block the event loop with the breakpoint. When you continue the flow returns to the event loop and the timer gets fired again. It's not that if you wait for 100 seconds and the timeout for the timer is 10 seconds, you should get 10 timeouts. You will get just one.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  17. The following user says thank you to wysota for this useful post:

    Marco W. (19th March 2013)

  18. #17
    Join Date
    Mar 2013
    Posts
    9
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Ok, thanks, but I still do not understand why a timer is fired as a result of event processing and why a timer is started by clicking on the up-arrow of the QdoubleSpinBox.

    After all, the result, that having a breakpoint set leads to a different behaviour than having no breakpoint set, is still strange to me.

  19. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: slot valueChanged(double) of doubleSpinBox called twice if breakpoint is set

    Quote Originally Posted by Marco W. View Post
    Ok, thanks, but I still do not understand why a timer is fired as a result of event processing
    That's how it works and you have to live with it.

    and why a timer is started by clicking on the up-arrow of the QdoubleSpinBox.
    A timer is started as a result of pressing the arrow so that Qt can keep incrementing the value while you're keeping the arrow pressed.

    After all, the result, that having a breakpoint set leads to a different behaviour than having no breakpoint set, is still strange to me.
    Again, you have to live with it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 2
    Last Post: 26th August 2011, 09:51
  2. Slot doesn't get called
    By waynew in forum Qt Programming
    Replies: 7
    Last Post: 18th April 2010, 14:34
  3. How come this slot doesn't get called every second?
    By ShaChris23 in forum Qt Programming
    Replies: 2
    Last Post: 6th November 2009, 00:41
  4. Slot gets called twice
    By greatgatsby in forum Newbie
    Replies: 7
    Last Post: 20th August 2009, 16:11
  5. SLOT not being called
    By steg90 in forum Qt Programming
    Replies: 4
    Last Post: 6th December 2007, 12:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.