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. [SOLVED] QStatusBar - Permanent widget on the left

[SOLVED] QStatusBar - Permanent widget on the left

Scheduled Pinned Locked Moved General and Desktop
14 Posts 9 Posters 14.4k 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.
  • A Offline
    A Offline
    AcerExtensa
    wrote on last edited by
    #1

    Hallo everybody,
    do anybod know how to add permanent widget(QLabel) to statusBar on the left side without reimplementing paintEvent? I need to add small icon to status bar on the left side of statusbar message.... widget added with addWidget will be removed next time status bar message comes...

    God is Real unless explicitly declared as Integer.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stima_ua
      wrote on last edited by
      #2

      void QStatusBar::addPermanentWidget ( QWidget * widget, int stretch = 0 )

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AcerExtensa
        wrote on last edited by
        #3

        addPermanentWidget adds widget on the right side! I need permanent widget on the left side

        God is Real unless explicitly declared as Integer.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          A widget containing the label and an expanding spacer in a layout?

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AcerExtensa
            wrote on last edited by
            #5

            QStatusBar::showMessage doesn't draws message then...

            I've just subclassed QWidget and draw content by myself... But where is another thing i need to fix: QStatusBar draws some kind of vertical and horizontal line on the right of my widget. How do I get this off?

            !http://vip2006.net/statusbar.png(StatusBar)!

            God is Real unless explicitly declared as Integer.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Sorry, I have no idea...

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • S Offline
                S Offline
                stima_ua
                wrote on last edited by
                #7

                ...

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  gtpt
                  wrote on last edited by
                  #8

                  Hi
                  I know this is an old thread, but i came across the same problem.
                  I do i get read of that vertical line?

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    gtpt
                    wrote on last edited by
                    #9

                    Found it ...
                    Just add:
                    @QStatusBar::item {border: none;} @
                    ... to the application stylesheet.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DevDirrack
                      wrote on last edited by
                      #10

                      Hi
                      I struggle with similiar issue right now and the @gtpt solution doesnt work for me, but I found out how to make it.
                      If you want to put widget on the left just addWidget or addPermanentWidget with stretch > 0.

                      C 1 Reply Last reply
                      2
                      • R Offline
                        R Offline
                        Roman Bober
                        wrote on last edited by
                        #11

                        What helped is to use layout direction of the status bar:
                        this->statusBar()->setLayoutDirection(Qt::LayoutDirection::RightToLeft);

                        S 1 Reply Last reply
                        1
                        • R Roman Bober

                          What helped is to use layout direction of the status bar:
                          this->statusBar()->setLayoutDirection(Qt::LayoutDirection::RightToLeft);

                          S Offline
                          S Offline
                          SpriteOvO
                          wrote on last edited by SpriteOvO
                          #12

                          @Roman-Bober This will make SizeGrip also on the left side, and for me @DevDirrack‘s method works well.

                          1 Reply Last reply
                          0
                          • D DevDirrack

                            Hi
                            I struggle with similiar issue right now and the @gtpt solution doesnt work for me, but I found out how to make it.
                            If you want to put widget on the left just addWidget or addPermanentWidget with stretch > 0.

                            C Offline
                            C Offline
                            CPPUIX
                            wrote on last edited by
                            #13

                            @DevDirrack said in [SOLVED] QStatusBar - Permanent widget on the left:

                            If you want to put widget on the left just addWidget or addPermanentWidget with stretch > 0.

                            For future references and readers, this only works with addWidget(), does not work with addPermanentWidget().

                            D 1 Reply Last reply
                            0
                            • C CPPUIX

                              @DevDirrack said in [SOLVED] QStatusBar - Permanent widget on the left:

                              If you want to put widget on the left just addWidget or addPermanentWidget with stretch > 0.

                              For future references and readers, this only works with addWidget(), does not work with addPermanentWidget().

                              D Offline
                              D Offline
                              DonkeyTheMonkey
                              wrote on last edited by DonkeyTheMonkey
                              #14

                              @Abderrahmene_Rayene
                              Sorry to bring this old topic up as well.
                              But I do believe if you do mainWindow()->statusBar()->addPermanentWidget( new widget,1); it will put the widget on the left side, 0 will be default to the right.

                              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