QmlDesigner: Move designer action to the center of the tool bar

Change-Id: I7d6b38ea31ebefe0c01acd9360271fc5ba062ffe
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2020-04-30 17:45:48 +02:00
committed by Tim Jenssen
parent 8a59bf19fe
commit 1549f5818c
2 changed files with 14 additions and 0 deletions

View File

@@ -212,6 +212,13 @@ void DesignModeWidget::disableWidgets()
m_isDisabled = true;
}
static void addSpacerToToolBar(QToolBar *toolBar)
{
QWidget* empty = new QWidget();
empty->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
toolBar->addWidget(empty);
}
void DesignModeWidget::setup()
{
auto &actionManager = viewManager().designerActionManager();
@@ -366,6 +373,7 @@ void DesignModeWidget::setup()
// Create toolbars
auto toolBar = new QToolBar();
toolBar->addAction(viewManager().componentViewAction());
toolBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
DesignerActionToolBar *designerToolBar = QmlDesignerPlugin::instance()->viewManager().designerActionManager().createToolBar(m_toolBar);
@@ -407,6 +415,8 @@ void DesignModeWidget::setup()
}
});
addSpacerToToolBar(toolBar);
auto workspaceComboBox = new QComboBox();
workspaceComboBox->setMinimumWidth(120);
workspaceComboBox->setToolTip(tr("Switch the active workspace."));