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. Not changing drop down box selection moves dialog to back
Forum Updated to NodeBB v4.3 + New Features

Not changing drop down box selection moves dialog to back

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 2 Posters 1.1k Views 2 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.
  • S Offline
    S Offline
    Svetomir Girard
    wrote on last edited by
    #1

    Description
    I have a Qt program that is used to set up a hardware platform through ethernet communications. The program is set up as one main window that will pop up different QWidgets that are specialized on a certain part of the hardware configuration.

    In a lot of these QWidgets there are dropdown boxes (QComboBox) that are used to select from a list of different options. It just so happens that after initially bringing up the QWidget through a menu in the main window, if you select a dropdown and then don't change the selection of the dropdown and instead minimize the expansion by clicking on the down arrow of the dropdown or by clicking elsewhere in the window, the entire QWidget gets sent to the back of the display stack. This is extremely frustrating for user experience and up until semi-recently this hasn't been occurring. As far as I can tell no one has added any code to make this function differently.

    Which leads me to the next point. I don't know if this is a Qt issue or if this is a Windows issue. Because the problem seemingly has started to occur out of no where I can't even pin down why its happening. Any help or suggestions would be great. Even just a workaround would be helpful as this is a program that we distribute to customers.

    This only happens once. From then on the window does not move to the back.
    It happens to all windows across the program.
    It seems to be focused on dropdowns causing the issue (QComboBox).

    Hopefully I have provided enough information. If not, let me know.

    Software Versions
    Visual Studio 2017
    Qt 5.12.1
    Windows 10 Version 10.0.17763

    Code
    Connection from main window to open Qwidget

    connect( m_actionSerialPorts,       SIGNAL(triggered(bool)), this, SLOT(ShowSerialPorts() ) );
    
    void MainWindow::ShowSerialPorts()
    {
      Qt::WindowFlags eFlags = windowFlags();
      // People don't like this: 
      // eFlags |= Qt::WindowStaysOnTopHint;
      m_SerialPortsSettings.setWindowFlags(eFlags);
      m_SerialPortsSettings.showNormal();
      m_SerialPortsSettings.raise(); 
      const int portIdx = m_SerialPortsSettings.getPassthroughPortIndex();
      emit(RequestSerialPassthrough(portIdx));
    }
    

    Serial port constructor

    SerialPortsSettings::SerialPortsSettings(QWidget* parent) 
    : QWidget(parent),
      m_PassThroughNeedsRestart(false)
    {
      setupUi(this);
    
      int index = 0;
      m_PassthroughBaudRate->clear();
      m_PassthroughBaudRate->insertItem(index++, "2400", QVariant((int)BAUD_2400));
      m_PassthroughBaudRate->insertItem(index++, "4800", QVariant((int)BAUD_4800));
      m_PassthroughBaudRate->insertItem(index++, "9600", QVariant((int)BAUD_9600));
      m_PassthroughBaudRate->insertItem(index++, "19200", QVariant((int)BAUD_19200));
      m_PassthroughBaudRate->insertItem(index++, "38400", QVariant((int)BAUD_38400));
      m_PassthroughBaudRate->insertItem(index++, "57600", QVariant((int)BAUD_57600));
      m_PassthroughBaudRate->insertItem(index++, "115200", QVariant((int)BAUD_115200));
      m_PassthroughBaudRate->insertItem(index++, "921600", QVariant((int)BAUD_921600));
    
      doConnections();
    }
    

    We have applied a very small workaround but only works in one case. If you open the drop down and don't change anything and click on another item in the Qwidget it goes to the back then comes back to the front

    void SerialPortsSettings::mouseReleaseEvent(QMouseEvent *event)
    {
      if (event->button() == Qt::LeftButton) {
        this->raise();
      }
    }
    
    1 Reply Last reply
    0
    • SGaistS SGaist

      I can't reproduce that on macOS with Qt 5.13 and I can't test on Windows as I have no such machine at hand.

      S Offline
      S Offline
      Svetomir Girard
      wrote on last edited by
      #10

      @SGaist

      Sorry for such a late response but i wanted to post here if someone else has the same problem and is searching around on the internet.

      Using the thinking that you couldn't reproduce on mac with a newer version, i finally got around to setting up a VM.

      I was able to confirm that on the fresh install of windows, VS studio, and Qt 5.12.1 that the issue still occurred with my sample code.

      I then updated Qt to version 5.12.5. This fixes the issue

      I don't have the time at work to figure out which version was the actual one that fixed it but updating Qt versions (I still used the old version of Qt VS Tools 2.3.2) should do the trick.

      Thanks for your time!

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi and welcome to devnet,

        Would it be possible for you to create a minimal compilable example that reproduces that behaviour ?

        Note that in you code sample, there something strange, you seem to show a dialog and right after access something that you likely modify in that dialog. This likely won't work as expected.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        S 1 Reply Last reply
        0
        • S Offline
          S Offline
          Svetomir Girard
          wrote on last edited by
          #3

          Yeah absolutely. I have one that is bare bones on my computer right now. How do i upload it? Every time i try to upload using this little reply widget thing it tells me i don't have permissions to do that?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Svetomir Girard
            wrote on last edited by
            #4

            I just used pastebin

            ui_QtGuiApplication1.h - https://pastebin.com/XZPy9TtD
            ui_widget.h - https://pastebin.com/9gMeLM5R

            QtGuiApplication1.h - https://pastebin.com/bwP0tJdQ
            SerialPortSettings.h - https://pastebin.com/T2HigzZM

            QtGuiApplication1.qrc - https://pastebin.com/agMHzff2

            main.cpp - https://pastebin.com/Dz6QfjN5
            qtGuiApplication1.cpp - https://pastebin.com/va6vvQbr
            SerialPortSettings.cpp - https://pastebin.com/sfWz0CPz

            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi and welcome to devnet,

              Would it be possible for you to create a minimal compilable example that reproduces that behaviour ?

              Note that in you code sample, there something strange, you seem to show a dialog and right after access something that you likely modify in that dialog. This likely won't work as expected.

              S Offline
              S Offline
              Svetomir Girard
              wrote on last edited by
              #5

              @sgaist

              If there is an easier way to get the files to you let me know. But i think because I'm a new user its going to be hard for me to upload them using this forum.

              And in this case the when clicking the arrow to expand the dropdown and the clicking the arrow again without changing the selection the window moves to the back.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #6

                It's not unusual to use a solution like dropbox or gitlab/bitbucket/github.

                By the way, the .pro file is missing.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                S 1 Reply Last reply
                0
                • SGaistS SGaist

                  It's not unusual to use a solution like dropbox or gitlab/bitbucket/github.

                  By the way, the .pro file is missing.

                  S Offline
                  S Offline
                  Svetomir Girard
                  wrote on last edited by
                  #7

                  @sgaist

                  I am using Visual Studio 2017. There is no .pro file located anywhere in the folder structure.

                  I uploaded the entire folder structure to dropbox here

                  https://www.dropbox.com/sh/sjjzv0bl6iupczl/AADorCWUNcO8u7VddhIvCqhma?dl=0

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    Svetomir Girard
                    wrote on last edited by
                    #8

                    Still encountering the issue.

                    Extremely frustrating

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      I can't reproduce that on macOS with Qt 5.13 and I can't test on Windows as I have no such machine at hand.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      S 1 Reply Last reply
                      1
                      • SGaistS SGaist

                        I can't reproduce that on macOS with Qt 5.13 and I can't test on Windows as I have no such machine at hand.

                        S Offline
                        S Offline
                        Svetomir Girard
                        wrote on last edited by
                        #10

                        @SGaist

                        Sorry for such a late response but i wanted to post here if someone else has the same problem and is searching around on the internet.

                        Using the thinking that you couldn't reproduce on mac with a newer version, i finally got around to setting up a VM.

                        I was able to confirm that on the fresh install of windows, VS studio, and Qt 5.12.1 that the issue still occurred with my sample code.

                        I then updated Qt to version 5.12.5. This fixes the issue

                        I don't have the time at work to figure out which version was the actual one that fixed it but updating Qt versions (I still used the old version of Qt VS Tools 2.3.2) should do the trick.

                        Thanks for your time!

                        1 Reply Last reply
                        1

                        • Login

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