[Solved] Mouse grab causes application crash

  • I'm on Qt 4.7.1 on Win XP sp3, and was just trying something, and this code causes my app to crash with this message:

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)

    @exited with codeASSERT: "testAttribute(Qt::WA_WState_Created)" in file c:\ndkbuildrepos\qt-desktop\src\gui\kernel\qwidget_win.cpp, line 887 3@

    Should be pretty straight forward to use mousegrab as I've tried in the past, a bug ... something stupid that I've done?

  • The assert is because the window isn't fully created yet. You can't grab the mouse until the window is fully created, but the window isn't fully created in the constructor. Try the grab mouse when QEvent:: Polish occurs.

  • WA_WState_Created ... I should've known :)
    Thanks Bradley

Log in to reply