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. Offsetting the tab in QTabWidget
Forum Updated to NodeBB v4.3 + New Features

Offsetting the tab in QTabWidget

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 4 Posters 5.4k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #6

    myTabWidget->setStyleSheet("content of my cool style sheet");

    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
    2
    • P Pauly

      I still have to learn about stylesheet... So where do I set this? Thanks.

      QTabWidget::tab-bar {
      left: 50px; /* move to the right */
      }

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

      @Pauly
      For start just use Creator
      Open a form UI file and place a tabwidget
      Then right click it and select Change Stylesheet.
      Its a mini editor.

      And then read
      http://doc.qt.io/qt-5/stylesheet-syntax.html

      1 Reply Last reply
      1
      • P Offline
        P Offline
        Pauly
        wrote on last edited by
        #8

        Thanks a lot. I'm able to get something like this... poor man version...

        alt text

        I think some of the pushbutton at the top left corner is behind the title bar. How can I deal with this? Thanks!

        mrjjM J.HilkJ 2 Replies Last reply
        0
        • P Pauly

          Thanks a lot. I'm able to get something like this... poor man version...

          alt text

          I think some of the pushbutton at the top left corner is behind the title bar. How can I deal with this? Thanks!

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

          @Pauly
          Hi
          Just set y of the button to zero
          Seems to be minus currently.

          1 Reply Last reply
          0
          • P Pauly

            Thanks a lot. I'm able to get something like this... poor man version...

            alt text

            I think some of the pushbutton at the top left corner is behind the title bar. How can I deal with this? Thanks!

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #10

            @Pauly

            To raise the button over the other widgets, use

            PushButton->raise();
            

            seems obvious, right.

            ;-)


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


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

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Pauly
              wrote on last edited by
              #11

              Yes, I made its y negative trying to have the button sit on top of the title bar, as the word scheme looks like. PushButton->raise(); does not raise it above the title bar. I read some post which said that title bar will always on top? Thanks...

              mrjjM 1 Reply Last reply
              0
              • P Pauly

                Yes, I made its y negative trying to have the button sit on top of the title bar, as the word scheme looks like. PushButton->raise(); does not raise it above the title bar. I read some post which said that title bar will always on top? Thanks...

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

                @Pauly
                The title bar is a so called decoration and is drawn by the OS/windows manager.
                So the button can never be on top of it. ( also since its a child of mainwindow )

                Also the button. is in a layout or anything else ?

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  Pauly
                  wrote on last edited by
                  #13

                  After some researching, I hide the title bar by adding

                  setWindowFlags(Qt::Window | Qt::CustomizeWindowHint);
                  

                  Now I get:
                  alt text

                  Gone with the title bar is the drag&move, the minimize/maximize/close buttons. I guess I can add some widget for those function. Is there a Qt class that handle these kind of actions (title bar actions)? Thanks!

                  mrjjM 1 Reply Last reply
                  0
                  • P Pauly

                    After some researching, I hide the title bar by adding

                    setWindowFlags(Qt::Window | Qt::CustomizeWindowHint);
                    

                    Now I get:
                    alt text

                    Gone with the title bar is the drag&move, the minimize/maximize/close buttons. I guess I can add some widget for those function. Is there a Qt class that handle these kind of actions (title bar actions)? Thanks!

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

                    @Pauly
                    Hi
                    Sadly no, if you remove the decorations, you must re-implement all these features.
                    That said, if you ONLY need the min/max functions and not resize then its
                    just a few functions from QMainwindow to mimic those.

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      Pauly
                      wrote on last edited by
                      #15

                      I tried it and it is more invloving to redo the title bar with a widget. The title bar response to upside resize and width change etc. I decide to defer it to later time. Maybe that is not a good idea for poor man. :)

                      mrjjM 1 Reply Last reply
                      0
                      • P Pauly

                        I tried it and it is more invloving to redo the title bar with a widget. The title bar response to upside resize and width change etc. I decide to defer it to later time. Maybe that is not a good idea for poor man. :)

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

                        @Pauly
                        Nah for a fully functional version of a "word look" the amount of work would
                        sort of disqualify it for a poors mans version. :)

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          Pauly
                          wrote on last edited by
                          #17

                          Thanks a lot. :)

                          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