Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Mouse grab causes application crash
Forum Updated to NodeBB v4.3 + New Features

[Solved] Mouse grab causes application crash

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 3.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1

    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) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    this->grabMouse();
    @

    @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?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      baysmith
      wrote on last edited by
      #2

      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.

      Nokia Certified Qt Specialist.

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved