Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved How can I control the focus of tabs on a tab widget through code?

    General and Desktop
    3
    9
    449
    Loading More Posts
    • 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.
    • Alexandre Camelo
      Alexandre Camelo last edited by

      How can I control the focus of tabs on a tab widget through code? I mean, so that the focus of the tabs follows the tabulation sequence of the fields. I've tried everything and can't.

      Pablo J. Rogina J.Hilk 2 Replies Last reply Reply Quote 0
      • Pablo J. Rogina
        Pablo J. Rogina @Alexandre Camelo last edited by

        @Alexandre-Camelo said in How can I control the focus of tabs on a tab widget through code?:

        I've tried everything and can't.

        that's too generic... please show what you've tried

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        Alexandre Camelo 1 Reply Last reply Reply Quote 1
        • Alexandre Camelo
          Alexandre Camelo @Pablo J. Rogina last edited by

          @Pablo-J-Rogina said in How can I control the focus of tabs on a tab widget through code?:

          that's too generic... please show what you've tried

          Ok, Pablo.

          I will try to explain further:

          (detail: I am Brazilian and this text was translated by google translator. So forgive me if some passages get a little incomprehensible).
          .
          .
          Since my form has many fields, I split them into a four-tabbed widget and arranged the tab order of all these fields.

          But...

          For example, when I finish filling the last field of the first tab, the focus goes to the next field (which is on the second tab), but the second tab is not activated. That way, I need to click the second tab with my mouse to continue filling in the remaining fields.

          I already tried to use:
          ui-> tabwidget-> setFocus;
          ui-> tab-> setFocus;
           ui-> tabwidget-> setFocus;
          ui-> tabwidget-> activateWindow ();
          ui-> tabwidget-> activateWindow ();

          I tried to place these commands in the "returnPressed" slot of the last field of the first tab. Since I don't know if this is the correct slot, I also tried placing the commands on a Push Button. But none of the trial combinations worked.

          I hope I could be clear.

          Can you help me?

          Thank you!

          Pablo J. Rogina 1 Reply Last reply Reply Quote 0
          • J.Hilk
            J.Hilk Moderators @Alexandre Camelo last edited by

            @Alexandre-Camelo what you're looking for is probably
            https://doc.qt.io/qt-5/qwidget.html#setTabOrder

            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct

            Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply Reply Quote 0
            • Pablo J. Rogina
              Pablo J. Rogina @Alexandre Camelo last edited by

              @Alexandre-Camelo it looks to me that you need to use QTabWidget::setCurrentIndex()

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              Alexandre Camelo 1 Reply Last reply Reply Quote 2
              • Alexandre Camelo
                Alexandre Camelo @Pablo J. Rogina last edited by

                @Pablo-J-Rogina said in How can I control the focus of tabs on a tab widget through code?:

                it looks to me that you need to use

                WOOOOOOOOOOOOWWWWWW !!!!!

                GOT SURE !!!!!!!!!!

                VERY VERY VERY VERY THANK YOU, PABLOOOOOO !!!!!

                :-D :-D :-D :-D :-D :-D

                As I realize that you know QT well, I will send another horrible problem that has taken my time, too.

                I will send in the next post.

                Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu !!!!!

                Pablo J. Rogina 1 Reply Last reply Reply Quote 0
                • Pablo J. Rogina
                  Pablo J. Rogina @Alexandre Camelo last edited by

                  @Alexandre-Camelo said in How can I control the focus of tabs on a tab widget through code?:

                  I will send in the next post.

                  Before rushing into that :-) please read the signature of my posts and proceed as stated there...

                  Upvote the answer(s) that helped you solve the issue
                  Use "Topic Tools" button to mark your post as Solved
                  Add screenshots via postimage.org
                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                  Alexandre Camelo 1 Reply Last reply Reply Quote 0
                  • Alexandre Camelo
                    Alexandre Camelo @Pablo J. Rogina last edited by J.Hilk

                    @Pablo-J-Rogina

                    Ok, Pablo.

                    I tagged the topic as SOLVED and posted the image on postimage.org.

                    Did I follow the instructions correctly?


                    .Hilk] Removed user E-Mail for security reasons

                    1 Reply Last reply Reply Quote 1
                    • J.Hilk
                      J.Hilk Moderators last edited by J.Hilk

                      I took the liberty and removed your E-Mail address, don't post such a thing openly please.

                      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct

                      Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


                      Q: What's that?
                      A: It's blue light.
                      Q: What does it do?
                      A: It turns blue.

                      1 Reply Last reply Reply Quote 2
                      • First post
                        Last post