Important: Please read the Qt Code of Conduct -

Unexpected MouseUp event is fired when hit "Ok" button in QtDialog in MAC

  • I cannot reply the topic with all modern browers(IE 10/FireFox/Chrome) . I have to answer questions here.

    1. Mac version is 10.9.2. I believe it would happen in all 10.9.x. I didn't try in the latest Mac version(10.10).

    I got the issue in my application and have no idea what's wrong. Any ideas to track the issue down?

    There is a save dialog derived from QtDialog to pop up. There is also QWidget which is under the save dialog. When I hit "Save" button, we would exit the event loop in the save dialog. Meanwhile the QWidget would be destructed. I don't know why an additional mouseup event is fired after we response to "Save_button_Clicked" event? And the mouse event would be sent to that QWidget which has been destroyed. I attach a piece of callstack here.

    My question is who fire mouseup event, why fire?

    #0 0x00000001006a1581 in QWidget::testAttribute(Qt::WidgetAttribute) const at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/gui/../../include/QtGui/../../src/gui/kernel/qwidget.h:1048

    #1 0x00000001006ae66a in QWidget::isVisible() const at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/gui/../../include/QtGui/../../src/gui/kernel/qwidget.h:1010

    #2 0x00000001006e1c52 in qt_mac_getTargetForMouseEvent(NSEvent*, QEvent::Type, QPoint&, QPoint&, QWidget*, QWidget**) at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/gui/kernel/

    #3 0x00000001006e26f4 in qt_mac_handleMouseEvent(NSEvent*, QEvent::Type, Qt::MouseButton, QWidget*, bool) at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/gui/kernel/

    #4 0x00000001006ccc68 in -[QCocoaView mouseUp:] at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/gui/kernel/

    #5 0x00007fff89ce6235 in -[NSWindow sendEvent:] ()

    #6 0x00000001006d4919 in -[QCocoaWindow sendEvent:] at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h:183

    #7 0x00007fff89c876e4 in -[NSApplication sendEvent:] ()

    #8 0x00000001006dc98d in -[QNSApplication sendEvent:] at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/gui/kernel/

    #9 0x00007fff89ad7b89 in -[NSApplication run] ()

    #10 0x00000001006eca12 in QEventDispatcherMac::processEvents(QFlagsQEventLoop::ProcessEventsFlag) at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/gui/kernel/

    #11 0x00000001001e54fc in QEventLoop::processEvents(QFlagsQEventLoop::ProcessEventsFlag) at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/corelib/kernel/qeventloop.cpp:149

    #12 0x00000001001e56f9 in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/corelib/kernel/qeventloop.cpp:204

    #13 0x00000001001ea2f1 in QCoreApplication::exec() at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/corelib/kernel/qcoreapplication.cpp:1221

    #14 0x000000010077b606 in QApplication::exec() at /Volumes/depot/external_toolkit_source/Qt/4.8.5_macsource/src/gui/kernel/qapplication.cpp:3842

    #15 0x0000000108e719c8 in QTApplication::exec()

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Which version of OS X are you running ?

Log in to reply