[Qt-interest] Variable space between toolbar icons?
Bob Babcock
wssddc at nospam.gis.net
Mon Jul 18 05:56:36 CEST 2011
Jesus Fernandez <jsfdez at gmail.com> wrote in
news:CAL8mHJRTwYFStqUX6T=eqRYHguX0hGGON3PDbNMDbfS1duFoGA at mail.gmail.com:
> You can create a widget with the desired layout and add it to the
> Toolbar. I haven't tried it.
Thanks. I played with this some more. The following seems to work on both
Windows and Android:
void MainWindow::addToolbarSpacer(QToolBar *toolbar)
{
QWidget *widget = new QWidget;
QHBoxLayout *spacerLayout = new QHBoxLayout;
QSpacerItem *spacer =
new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Minimum);
spacerLayout->addSpacerItem(spacer);
widget->setLayout(spacerLayout);
toolbar->addWidget(widget);
}
More information about the Qt-interest-old
mailing list