View Full Version : QToolBar help please
munna
29th June 2006, 13:16
Is there a way by which I can put few widgets right aligned and few widgets left aligned in a QToolBar with the some eampty space in the center of the toolbar?
Thanks
Sure, QToolBar allows any widget to be inserted.
// a dummy widget taking as much horizontal space as possible
QWidget* spacer = new QWidget(toolBar);
spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
toolBar->addAction("Action 1");
toolBar->addWidget(spacer); // a "spacer" between actions
toolBar->addAction("Action 2");
munna
29th June 2006, 14:14
Oh, I did not notice that. In that case, can I use QLayout to place widgets on tool bar?
In that case, can I use QLayout to place widgets on tool bar?
Yep, you can. :) Just wrap the layout inside a single widget which you place in a tool bar.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.