focus thems in Qtoolbar
-
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 -
I mean how to center QtAction in QtoolBar
-
@AichaDev More information needed w.r.t the posted image.
-
This is the pincture , i work with qt4 i want to center QAction exist in QtoolBar
http://server.mediazain.com/capture.png -
@AichaDev Where is the
QToolBar
in image and where do you want it to center ? -
Thank you p3c0 for responding, the QtoolBar is down inside I want to center the items
-
@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.