Results 1 to 18 of 18

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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.


Similar Threads

  1. Replies: 2
    Last Post: 26th August 2011, 08:51
  2. Slot doesn't get called
    By waynew in forum Qt Programming
    Replies: 7
    Last Post: 18th April 2010, 13:34
  3. How come this slot doesn't get called every second?
    By ShaChris23 in forum Qt Programming
    Replies: 2
    Last Post: 5th November 2009, 23:41
  4. Slot gets called twice
    By greatgatsby in forum Newbie
    Replies: 7
    Last Post: 20th August 2009, 15:11
  5. SLOT not being called
    By steg90 in forum Qt Programming
    Replies: 4
    Last Post: 6th December 2007, 11: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.