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. focus thems in Qtoolbar
Forum Updated to NodeBB v4.3 + New Features

focus thems in Qtoolbar

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

    Hello, I have a Qtoolbar that contains items, I will like to focus them but I'm not happen,See the picture below thinks :)
    Capture

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AichaDev
      wrote on last edited by
      #2

      I mean how to center QtAction in QtoolBar

      p3c0P 1 Reply Last reply
      0
      • A AichaDev

        I mean how to center QtAction in QtoolBar

        p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by p3c0
        #3

        @AichaDev More information needed w.r.t the posted image.

        157

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AichaDev
          wrote on last edited by AichaDev
          #4

          This is the pincture , i work with qt4 i want to center QAction exist in QtoolBar
          http://server.mediazain.com/capture.png

          p3c0P 1 Reply Last reply
          0
          • A AichaDev

            This is the pincture , i work with qt4 i want to center QAction exist in QtoolBar
            http://server.mediazain.com/capture.png

            p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #5

            @AichaDev Where is the QToolBar in image and where do you want it to center ?

            157

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AichaDev
              wrote on last edited by
              #6

              Thank you p3c0 for responding, the QtoolBar is down inside I want to center the items

              p3c0P 1 Reply Last reply
              0
              • A AichaDev

                Thank you p3c0 for responding, the QtoolBar is down inside I want to center the items

                p3c0P Offline
                p3c0P Offline
                p3c0
                Moderators
                wrote on last edited by
                #7

                @AichaDev Ok. You can add dummy widget or spacers before and after. Something like this

                QToolBar *toolBar = addToolBar(("Toolbar"));
                
                QWidget *spacer1 = new QWidget(this);
                spacer1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
                spacer1->setVisible(true);
                
                QWidget *spacer2 = new QWidget(this);
                spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
                spacer2->setVisible(true);
                
                QAction *act = new QAction("Item", this);
                
                toolBar->addWidget(spacer1);
                toolBar->addAction(act);
                toolBar->addWidget(spacer2);
                

                This code will add action named Item and the rest will move it to center.

                157

                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