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. When Clicking Combobox The Whole Window Is Moved to That Location

When Clicking Combobox The Whole Window Is Moved to That Location

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 348 Views
  • 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.
  • L Offline
    L Offline
    Laner107
    wrote on last edited by
    #1

    I have a few qt combo boxes in my program as well as code that lets me move the window, but for some reason when I click my combo boxes it moves my window, this is what it looks like as it totally moves the screen.
    picture of program

    The code for my mouse event is here

    void MainWindow::mousePressEvent(QMouseEvent *event)
    {
        QGroupBox *child = static_cast<QGroupBox*>(childAt(event->pos()));
            if (child!=ui->groupBox)        //mTitlebar is the QLabel on which we want to implement window drag
            {
                return;
            }
            isMousePressed = true;
            startPos = event->pos();
    }
    

    Im assuming it is something messing up in here, do you all have any idea? Thank you in advance!

    jsulmJ 1 Reply Last reply
    0
    • L Laner107

      I have a few qt combo boxes in my program as well as code that lets me move the window, but for some reason when I click my combo boxes it moves my window, this is what it looks like as it totally moves the screen.
      picture of program

      The code for my mouse event is here

      void MainWindow::mousePressEvent(QMouseEvent *event)
      {
          QGroupBox *child = static_cast<QGroupBox*>(childAt(event->pos()));
              if (child!=ui->groupBox)        //mTitlebar is the QLabel on which we want to implement window drag
              {
                  return;
              }
              isMousePressed = true;
              startPos = event->pos();
      }
      

      Im assuming it is something messing up in here, do you all have any idea? Thank you in advance!

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Laner107 said in When Clicking Combobox The Whole Window Is Moved to That Location:

      if (child!=ui->groupBox)

      Shouldn't it be

      if (child == ui->groupBox)
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      L 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Laner107 said in When Clicking Combobox The Whole Window Is Moved to That Location:

        if (child!=ui->groupBox)

        Shouldn't it be

        if (child == ui->groupBox)
        
        L Offline
        L Offline
        Laner107
        wrote on last edited by
        #3

        @jsulm No because it is saying if it is not the box I want to be dragged then to not do anything essentially, currently it all works other than when i click a combo box it bugs out.

        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