Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Pyside2 - While QCombobox is opened, click on gui sends gui to back and focus on other window, in windows 10
Forum Updated to NodeBB v4.3 + New Features

Pyside2 - While QCombobox is opened, click on gui sends gui to back and focus on other window, in windows 10

Scheduled Pinned Locked Moved Unsolved Qt for Python
11 Posts 3 Posters 2.5k 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.
  • alomA Offline
    alomA Offline
    alom
    wrote on last edited by alom
    #1

    If I run the sample code below on windows 10,Ubuntu, and Centos6 in a python3.7/ Pyside2(5.13.1) env (built with anaconda), I get different focus behavior with the QCombobox. It seems to work correctly in Linux but in windows 10 if I click a Qcombobox and display the items, then click on the gui out side of the combobox items, the focus is lost and the gui is sent to the back of any other windows open.

    Is there anything on the windows side that might be triggering this? Ideally I dont want to brute force the windowsFlag always on top hint, just for windows 10... Any help greatly appreciated

    from PySide2 import QtWidgets
    
    class MyWindow(QtWidgets.QMainWindow):
    
        def __init__(self):
            super(MyWindow, self).__init__()
            self.edit = QtWidgets.QComboBox()
            self.edit.addItems(['item1', 'item2', 'item3'])
            layout = QtWidgets.QHBoxLayout()
            layout.addWidget(self.edit)
            w = QtWidgets.QWidget()
            w.setLayout(layout)
            self.setCentralWidget(w)
    
    if __name__ == '__main__':
    
        app = QtWidgets.QApplication(sys.argv)
        window = MyWindow()
        window.show()
        sys.exit(app.exec_())
    
    1 Reply Last reply
    0
    • alomA Offline
      alomA Offline
      alom
      wrote on last edited by
      #2

      @Denni-0
      Thanks for taking a look at the sample.
      Actually the gui (QMainWindow) is whats being clicked once the combo box is opened, so I would think the QMainWindow should still be on top of any other windows below it. So clicking any where on the QMainWindow other than the combobox sends it back.

      jsulmJ 1 Reply Last reply
      0
      • alomA alom

        @Denni-0
        Thanks for taking a look at the sample.
        Actually the gui (QMainWindow) is whats being clicked once the combo box is opened, so I would think the QMainWindow should still be on top of any other windows below it. So clicking any where on the QMainWindow other than the combobox sends it back.

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

        @alom I think the behaviour you're describing on Windows and Linux are simply OS preferences. On Windows the Window you're clicking on is raised even if the current window has an "open" combo box. On Linux only the combo box is closed on first click outside of the window. I would not to try to change this as users are used to the behaviour of their systems.

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

        1 Reply Last reply
        0
        • alomA Offline
          alomA Offline
          alom
          wrote on last edited by
          #4

          Sorry I don't think I'm explaining myself well, I'm still clicking on the qt window if i don't select a combobox item . No other windows application will send it back if your still clicking on the application.

          jsulmJ 1 Reply Last reply
          0
          • alomA alom

            Sorry I don't think I'm explaining myself well, I'm still clicking on the qt window if i don't select a combobox item . No other windows application will send it back if your still clicking on the application.

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

            @alom Sorry, I don't really understand: on Windows 10 you start you app and then do what exactly and what exactly happens?

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

            1 Reply Last reply
            0
            • alomA Offline
              alomA Offline
              alom
              wrote on last edited by
              #6

              qcombox_focus (1).gif

              jsulmJ 1 Reply Last reply
              0
              • alomA alom

                qcombox_focus (1).gif

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

                @alom I can't reproduce this on my Windows 10 machine.
                Is it the same if you start your app outside of the IDE?

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

                1 Reply Last reply
                0
                • alomA Offline
                  alomA Offline
                  alom
                  wrote on last edited by
                  #8

                  OK good to know you are not experiencing it, yep the behavior is still happening running from a bat file.

                  Maybe something is on my box...I cant think of anything that might be triggering this. I don't have a clean windows install to start debugging. The only thing I can see might be an issue is my wacom tablet and turning off windows ink features?

                  jsulmJ 1 Reply Last reply
                  0
                  • alomA alom

                    OK good to know you are not experiencing it, yep the behavior is still happening running from a bat file.

                    Maybe something is on my box...I cant think of anything that might be triggering this. I don't have a clean windows install to start debugging. The only thing I can see might be an issue is my wacom tablet and turning off windows ink features?

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

                    @alom You could create another user account and check whether it's the same.

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

                    1 Reply Last reply
                    0
                    • alomA Offline
                      alomA Offline
                      alom
                      wrote on last edited by
                      #10

                      Thanks good idea, unfortunately its the same :/
                      Is it possibly this might be from the anaconda build? I'm using conda to manage all my envs, just throwing ideas around at this point

                      1 Reply Last reply
                      0
                      • alomA Offline
                        alomA Offline
                        alom
                        wrote on last edited by alom
                        #11

                        thanks, so I was able to get another windows 10 box and was not able to reproduce this behavior either with the same IDE and env.
                        Unfortunately there is something on my workstation causing this...

                        I did find another consistent behavior on my workstation with this issue. After the first click once the gui goes behind another window, if you try again, the windows stays on top as expected. So it's only on the first click out side a opened combo box, very strange.

                        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