How do I align a QWidget to the right of a QToolBar?
Asked Answered
F

1

6

I have some QWidget (QLineEdit), and I would like to align it to the right of my QToolbar.

Is there any simple way to do it?

Funchal answered 14/1, 2010 at 3:26 Comment(0)
E
6

Try putting a spacer widget before it:

QToolBar* toolBar = new QToolBar("Toolbar");

QWidget* spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
toolBar->addWidget(spacer);

// now add your actions or widgets after the spacer widget
Emotion answered 14/1, 2010 at 11:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.