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. TabOrder in a QWidget with composites widgets
Qt 6.11 is out! See what's new in the release blog

TabOrder in a QWidget with composites widgets

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 2 Posters 3.5k 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.
  • B Offline
    B Offline
    Ben35
    wrote on last edited by
    #1

    Hello all,

    I have a pb with the tab order in my widget. I have a widget that have some custom widgets (Qwidgets that i have pomoted to CustomWidgets), and also some spinboxes and comboboxes. But at the execution, the tab order is never what i expect (it seems that it keeps the widgets creation order). My custom widgets all have a WheelFocus policy.

    I tried to play with the tab order edit mode in the designer, the setFocusProxy of my custom widgets, the setTabOrder method, nothing change the behaviour. Does anyone have an idea of what's happening ? Is there a well knowed bug with composite widgets and tab order ?

    Thanks

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Inside the composites CustomWidget, do you use UI file for the sub controls?
      Or do you new them yourself?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Ben35
        wrote on last edited by
        #3

        I use a UI File.

        I reduced the problem to this ('m not sure aymore that it's linked with custom widgets) :

        I have a QMainWindow in which i add a QDockWidget that contains a Widget. This widget is very simple with spinboxes and comboxes inside a QScrollArea. I have edited the tab order with the designer and when i look at the ui file, the tabstops list is OK. When i run a preview of the widget, it's OK too. But at the execution, my tab order is ignored and the tab order is the defaut order (based on the order in which widgets are constructed). I don't get it.

        mrjjM 1 Reply Last reply
        0
        • B Ben35

          I use a UI File.

          I reduced the problem to this ('m not sure aymore that it's linked with custom widgets) :

          I have a QMainWindow in which i add a QDockWidget that contains a Widget. This widget is very simple with spinboxes and comboxes inside a QScrollArea. I have edited the tab order with the designer and when i look at the ui file, the tabstops list is OK. When i run a preview of the widget, it's OK too. But at the execution, my tab order is ignored and the tab order is the defaut order (based on the order in which widgets are constructed). I don't get it.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Ben35
          have you looked in the ui_widgetxx file or the setupUI if/how the taborder is set?

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Ben35
            wrote on last edited by
            #5

            I just looked at the ui_widgetxx file and at the end of the setupUi, the taborder is correctly set with many calls of QWidget::setTabOrder in the correct order ...

            mrjjM 1 Reply Last reply
            0
            • B Ben35

              I just looked at the ui_widgetxx file and at the end of the setupUi, the taborder is correctly set with many calls of QWidget::setTabOrder in the correct order ...

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Ben35
              ok, that should work as nothing else later should change it.
              It could be a bug. Have u looked in bugreports.qt.io

              Can you re-create this issue in smaller sample to play with?

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Ben35
                wrote on last edited by
                #7

                Ok, my fault, i think i have founded the problem. In fact, i forgotten that the spinbox that i use in in fact a QSpinbox promoted to my custom widget (that inherit QWidget and contains a QSpinBox).

                When i unpromote to a simple QSpinbox, it works. But i still have the problem with my custom widget. I tried :
                setFocusPolicy(Qt::WheelFocus);
                setFocusProxy(internalSpinBox);
                inside my customWidget, but it doesn't works ...

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  Ben35
                  wrote on last edited by
                  #8

                  In conclusion, the problem is that when the focus goes inside a custom widget, it's not able to go back outside just after the inside custom widget ...

                  mrjjM 1 Reply Last reply
                  0
                  • B Ben35

                    In conclusion, the problem is that when the focus goes inside a custom widget, it's not able to go back outside just after the inside custom widget ...

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @Ben35
                    ok. so it stays inside widget even if pressing tab liek crazy?

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      Ben35
                      wrote on last edited by
                      #10

                      No it goes back but at a random position.

                      mrjjM 1 Reply Last reply
                      0
                      • B Ben35

                        No it goes back but at a random position.

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @Ben35
                        Ok. it sounds like bug but hard to say.

                        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