Toolbar spacer does not expand to the right corner
-
Hi
the name m_fileToolBar suggest to me its not in a UI
so its just
m_fileToolBar->dumpObjectTree();@mrjj Thank you! Here's the output (I have given my spacer object the name "spacerName"):
Qtitan::DockToolBar::
Qtitan::DockToolBarLayout::
Qtitan::DockToolBarExtension::
QMenu::
QAction::
Qtitan::ToolButton::
QWidgetAction::
QLineEdit::
QWidgetLineControl::
Qtitan::ToolButton::
QWidgetAction::
QSpinBox::
QLineEdit::qt_spinbox_lineedit
QWidgetLineControl::
QValidator::qt_spinboxvalidator
Qtitan::ToolButton::
QWidgetAction::
QWidget::spacerName -
@mrjj Thank you! Here's the output (I have given my spacer object the name "spacerName"):
Qtitan::DockToolBar::
Qtitan::DockToolBarLayout::
Qtitan::DockToolBarExtension::
QMenu::
QAction::
Qtitan::ToolButton::
QWidgetAction::
QLineEdit::
QWidgetLineControl::
Qtitan::ToolButton::
QWidgetAction::
QSpinBox::
QLineEdit::qt_spinbox_lineedit
QWidgetLineControl::
QValidator::qt_spinboxvalidator
Qtitan::ToolButton::
QWidgetAction::
QWidget::spacerName -
@TommyTLC
Ok so it is still there :)
Then i would
qDebug() << "size" << qDebug() << spacer->geometry();
and it will show something like
QRect(747,339 75x23)as it could be fun to see its location and size.
-
@TommyTLC
so its at o,0 and 1180 wide o.O and almost 500 in height.
but we clearly dont see that.
can you try
qDebug() << "vis" << spacer->isVisible();i was wondering if this happens due to
spacer->setMinimumWidth(1180);
as i have seen widgets do odd stuff when not room enough. -
@TommyTLC
so its at o,0 and 1180 wide o.O and almost 500 in height.
but we clearly dont see that.
can you try
qDebug() << "vis" << spacer->isVisible();i was wondering if this happens due to
spacer->setMinimumWidth(1180);
as i have seen widgets do odd stuff when not room enough. -
@TommyTLC
ok so its get hidden for some odd reason.
do you use the do anything to the spacer variable after it has been inserted ?
also try
spacer->show();
after its gone. ( like via a button)
and lets see what happens.@mrjj This is all I do with the spacer:
QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); spacer->setMinimumWidth(1180); m_fileToolBar->addWidget(spacer);it gets created, I set the SizePolicy and the minimumWidth and then I assign it to the toolBar.
-
@mrjj This is all I do with the spacer:
QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); spacer->setMinimumWidth(1180); m_fileToolBar->addWidget(spacer);it gets created, I set the SizePolicy and the minimumWidth and then I assign it to the toolBar.
-
@mrjj in the >> I only see my m_aboutAction. It looks like the spacer disappears when the application is not in full screen.
-
@TommyTLC
Ok so its not hidden by user code.
Could you try a smaller minimum and see like
spacer->setMinimumWidth(200);I know its not the goal but just to see if it still happens.
-
@TommyTLC
Ok so its not hidden by user code.
Could you try a smaller minimum and see like
spacer->setMinimumWidth(200);I know its not the goal but just to see if it still happens.
-
@TommyTLC said in Toolbar spacer does not expand to the right corner:
in the >> I only see my m_aboutAction
you do not see the style combo either?
Did you overload
resizeEvent?Does the "Configuration" label on the left have something special?
-
@VRonin Correct, the only thing I see by clicking the ">>" is the m_aboutAction.
The configuration label is an action. When clicked it generates a dialog you can interact with.
I am not sure what overlading the resizeEvent means.Hi
- I am not sure what overlading the resizeEvent means.
Like for MainWindow, you have that function implemented in your code.
I have a feeling it the
setMinimumWidth that is the culprit of this. -
Hi
- I am not sure what overlading the resizeEvent means.
Like for MainWindow, you have that function implemented in your code.
I have a feeling it the
setMinimumWidth that is the culprit of this. -
@mrjj Getting rid of the minimumWidth only leaves a small gap between the items in the toolBar. I don’t know what else I could try :(
-
@TommyTLC
Ok so it dont grow ?Hmm. What version of Qt are you using ?
the code VRonin works perfectly in 5.15

But you get another result ?