Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. how to execute a QCombobox Pyqt6 cursor output method
Forum Updated to NodeBB v4.3 + New Features

how to execute a QCombobox Pyqt6 cursor output method

Scheduled Pinned Locked Moved Unsolved Qt 6
lost cursorqcomboboxpyqt6
16 Posts 4 Posters 2.7k 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.
  • jsulmJ jsulm

    @Jbone73 said in how to execute a QCombobox Pyqt6 cursor output method:

    Do you have any idea about this problem?

    Yes, you should also call the base class focusOutEvent in your focusOutEvent implementation.

    J Offline
    J Offline
    Jbone73
    wrote on last edited by
    #7

    @jsulm

    Agreed ! Thank you ! I'm new to Qt and Python, I must admit I had a hard time understanding what you're asking to do.

    Do I have to call the QFocusEvent class in the QCombobox class?

    I'm sorry to ask so many questions but this is really new to me.

    Thank you in advance.

    jsulmJ 1 Reply Last reply
    0
    • J Jbone73

      @jsulm

      Agreed ! Thank you ! I'm new to Qt and Python, I must admit I had a hard time understanding what you're asking to do.

      Do I have to call the QFocusEvent class in the QCombobox class?

      I'm sorry to ask so many questions but this is really new to me.

      Thank you in advance.

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #8

      @Jbone73

      class ComboBox(QComboBox):
          def focusOutEvent(self, event=QFocusEvent):
              super().focusOutEvent(event)
      

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

      J 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Jbone73

        class ComboBox(QComboBox):
            def focusOutEvent(self, event=QFocusEvent):
                super().focusOutEvent(event)
        
        J Offline
        J Offline
        Jbone73
        wrote on last edited by
        #9

        @jsulm
        Thank you (sorry! I keep telling you but help is always useful, especially when you're just starting out), so I tried but I have a problem with the focusOutEvent method, which I can't seem to figure out the meaning of or event = QFocusEvent.

        The error is:
        TypeError: focusOutEvent(self, QFocusEvent): argument 1 has unexpected type 'PyQt6.sip.wrappertype'

        Thank you for everything and if you don't mind and if it's not too long, would you be able to explain to me? I admit that I swim a little.

        jsulmJ 1 Reply Last reply
        0
        • J Jbone73

          @jsulm
          Thank you (sorry! I keep telling you but help is always useful, especially when you're just starting out), so I tried but I have a problem with the focusOutEvent method, which I can't seem to figure out the meaning of or event = QFocusEvent.

          The error is:
          TypeError: focusOutEvent(self, QFocusEvent): argument 1 has unexpected type 'PyQt6.sip.wrappertype'

          Thank you for everything and if you don't mind and if it's not too long, would you be able to explain to me? I admit that I swim a little.

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #10

          @Jbone73 Please show the code causing this error

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

          J 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Jbone73 Please show the code causing this error

            J Offline
            J Offline
            Jbone73
            wrote on last edited by
            #11

            @jsulm
            This is the one you shared with me, I note it below:

            class ComboBox(QComboBox):
                def focusOutEvent(self, event=QFocusEvent):
                    super().focusOutEvent(event)
            
            JonBJ SGaistS 2 Replies Last reply
            0
            • J Jbone73

              @jsulm
              This is the one you shared with me, I note it below:

              class ComboBox(QComboBox):
                  def focusOutEvent(self, event=QFocusEvent):
                      super().focusOutEvent(event)
              
              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by
              #12

              @Jbone73
              Only a guess, depends what you have imported how, QFocusEvent might not be defined, you might need QtGui.QFocusEvent.

              J 1 Reply Last reply
              0
              • JonBJ JonB

                @Jbone73
                Only a guess, depends what you have imported how, QFocusEvent might not be defined, you might need QtGui.QFocusEvent.

                J Offline
                J Offline
                Jbone73
                wrote on last edited by
                #13

                @JonB

                Hello JonB, thank you for your answer.

                I just looked and QFocusEvent is present in QtGui.

                I don't see why he is marking this message for me.

                from PyQt6.QtGui import QIcon, QPixmap, QIntValidator, QFocusEvent
                
                1 Reply Last reply
                0
                • J Jbone73

                  @jsulm
                  This is the one you shared with me, I note it below:

                  class ComboBox(QComboBox):
                      def focusOutEvent(self, event=QFocusEvent):
                          super().focusOutEvent(event)
                  
                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  Hi,

                  @Jbone73 said in how to execute a QCombobox Pyqt6 cursor output method:

                  @jsulm
                  This is the one you shared with me, I note it below:

                  class ComboBox(QComboBox):
                      def focusOutEvent(self, event=QFocusEvent):
                          super().focusOutEvent(event)
                  

                  What about ?

                  class ComboBox(QComboBox):
                       def focusOutEvent(self, event):
                           super().focusOutEvent(event)
                  

                  If you want type hints:

                  class ComboBox(QComboBox):
                       def focusOutEvent(self, event: QFocusEvent) -> None:
                           super().focusOutEvent(event)
                  

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

                  J 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Hi,

                    @Jbone73 said in how to execute a QCombobox Pyqt6 cursor output method:

                    @jsulm
                    This is the one you shared with me, I note it below:

                    class ComboBox(QComboBox):
                        def focusOutEvent(self, event=QFocusEvent):
                            super().focusOutEvent(event)
                    

                    What about ?

                    class ComboBox(QComboBox):
                         def focusOutEvent(self, event):
                             super().focusOutEvent(event)
                    

                    If you want type hints:

                    class ComboBox(QComboBox):
                         def focusOutEvent(self, event: QFocusEvent) -> None:
                             super().focusOutEvent(event)
                    
                    J Offline
                    J Offline
                    Jbone73
                    wrote on last edited by
                    #15

                    @SGaist
                    Hello !
                    I don't understand ??

                    If I use your code :

                    class ComboBox(QComboBox):
                         def focusOutEvent(self, event: QFocusEvent) -> None:
                             super().focusOutEvent(event)
                    

                    Or

                    class ComboBox(QComboBox):
                         def focusOutEvent(self, event):
                             super().focusOutEvent(event)
                    

                    I have messages of errors and it does not work, on the other hand, if I put:

                    class ComboBox(QComboBox):
                    
                        def focusOutEvent(self, event=QFocusEvent):
                            print('ok')
                    

                    I do not have problem anymore, it works but not correctly.
                    The cursor of the combobox remains active when it takes the focus and I meet with another focus on other Widgets.

                    I do not understand why this does not work correctly???

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

                      Can you provide a minimal complete script to reproduce this behaviour ?

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

                      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