forked from qt-creator/qt-creator
Toolbars: various toolbar layout tweaks
This makes sure that toolbutton sizes and spacings are correct in all toolbar layout modes. Task-number: QTCREATORBUG-29082 Change-Id: If2aad74b77c0b8dcda81478e3d345c783584cec4 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -133,7 +133,6 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
|
|||||||
auto verticalLayout_3 = new QVBoxLayout();
|
auto verticalLayout_3 = new QVBoxLayout();
|
||||||
verticalLayout_3->setSpacing(0);
|
verticalLayout_3->setSpacing(0);
|
||||||
verticalLayout_3->addWidget(m_advancedButton);
|
verticalLayout_3->addWidget(m_advancedButton);
|
||||||
verticalLayout_3->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
|
||||||
|
|
||||||
auto gridLayout = new QGridLayout();
|
auto gridLayout = new QGridLayout();
|
||||||
gridLayout->setHorizontalSpacing(3);
|
gridLayout->setHorizontalSpacing(3);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
|
#include <QScrollArea>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
@@ -77,6 +78,9 @@ bool panelWidget(const QWidget *widget)
|
|||||||
if (qobject_cast<const QTabBar *>(widget))
|
if (qobject_cast<const QTabBar *>(widget))
|
||||||
return styleEnabled(widget);
|
return styleEnabled(widget);
|
||||||
|
|
||||||
|
if (qobject_cast<const QScrollArea *>(widget))
|
||||||
|
return widget->property("panelwidget_singlerow").toBool(); // See DebuggerMainWindowPrivate
|
||||||
|
|
||||||
const QWidget *p = widget;
|
const QWidget *p = widget;
|
||||||
while (p) {
|
while (p) {
|
||||||
if (qobject_cast<const QToolBar *>(p) ||
|
if (qobject_cast<const QToolBar *>(p) ||
|
||||||
@@ -667,10 +671,14 @@ void ManhattanStyle::polish(QWidget *widget)
|
|||||||
} else if (qobject_cast<QLabel*>(widget) || qobject_cast<QSpinBox*>(widget)
|
} else if (qobject_cast<QLabel*>(widget) || qobject_cast<QSpinBox*>(widget)
|
||||||
|| qobject_cast<QCheckBox*>(widget)) {
|
|| qobject_cast<QCheckBox*>(widget)) {
|
||||||
widget->setPalette(panelPalette(widget->palette(), lightColored(widget)));
|
widget->setPalette(panelPalette(widget->palette(), lightColored(widget)));
|
||||||
} else if (widget->property("panelwidget_singlerow").toBool()) {
|
} else if ((qobject_cast<QToolBar*>(widget) && !StyleHelper::isQDSTheme())
|
||||||
|
|| widget->property("panelwidget_singlerow").toBool()) {
|
||||||
widget->setFixedHeight(height);
|
widget->setFixedHeight(height);
|
||||||
} else if (qobject_cast<QStatusBar*>(widget)) {
|
} else if (qobject_cast<QStatusBar*>(widget)) {
|
||||||
widget->setFixedHeight(height + 2);
|
const bool flatAndNotCompact =
|
||||||
|
StyleHelper::toolbarStyle() != StyleHelper::ToolbarStyleCompact
|
||||||
|
&& creatorTheme()->flag(Theme::FlatToolBars);
|
||||||
|
widget->setFixedHeight(height + (flatAndNotCompact ? 3 : 2));
|
||||||
} else if (qobject_cast<QComboBox*>(widget)) {
|
} else if (qobject_cast<QComboBox*>(widget)) {
|
||||||
const bool isLightColored = lightColored(widget);
|
const bool isLightColored = lightColored(widget);
|
||||||
QPalette palette = panelPalette(widget->palette(), isLightColored);
|
QPalette palette = panelPalette(widget->palette(), isLightColored);
|
||||||
@@ -680,6 +688,9 @@ void ManhattanStyle::polish(QWidget *widget)
|
|||||||
widget->setPalette(palette);
|
widget->setPalette(palette);
|
||||||
widget->setMaximumHeight(height - 2);
|
widget->setMaximumHeight(height - 2);
|
||||||
widget->setAttribute(Qt::WA_Hover);
|
widget->setAttribute(Qt::WA_Hover);
|
||||||
|
} else if (qobject_cast<QScrollArea*>(widget)
|
||||||
|
&& widget->property("panelwidget_singlerow").toBool()) {
|
||||||
|
widget->setFixedHeight(height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ static void createStatusBarManager()
|
|||||||
m_statusBarWidgets.append(w);
|
m_statusBarWidgets.append(w);
|
||||||
|
|
||||||
QWidget *w2 = createWidget(m_splitter);
|
QWidget *w2 = createWidget(m_splitter);
|
||||||
w2->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
|
||||||
m_splitter->addWidget(w2);
|
m_splitter->addWidget(w2);
|
||||||
// second
|
// second
|
||||||
w = createWidget(w2);
|
w = createWidget(w2);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <utils/navigationtreeview.h>
|
#include <utils/navigationtreeview.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcsettings.h>
|
#include <utils/qtcsettings.h>
|
||||||
|
#include <utils/stylehelper.h>
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -382,6 +383,7 @@ CppIncludeHierarchyWidget::CppIncludeHierarchyWidget()
|
|||||||
this, &CppIncludeHierarchyWidget::perform);
|
this, &CppIncludeHierarchyWidget::perform);
|
||||||
|
|
||||||
m_toggleSync = new QToolButton(this);
|
m_toggleSync = new QToolButton(this);
|
||||||
|
StyleHelper::setPanelWidget(m_toggleSync);
|
||||||
m_toggleSync->setIcon(Utils::Icons::LINK_TOOLBAR.icon());
|
m_toggleSync->setIcon(Utils::Icons::LINK_TOOLBAR.icon());
|
||||||
m_toggleSync->setCheckable(true);
|
m_toggleSync->setCheckable(true);
|
||||||
m_toggleSync->setToolTip(Tr::tr("Synchronize with Editor"));
|
m_toggleSync->setToolTip(Tr::tr("Synchronize with Editor"));
|
||||||
|
|||||||
@@ -233,8 +233,8 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *parent)
|
|||||||
scrolledToolbar->setFrameStyle(QFrame::NoFrame);
|
scrolledToolbar->setFrameStyle(QFrame::NoFrame);
|
||||||
scrolledToolbar->setWidgetResizable(true);
|
scrolledToolbar->setWidgetResizable(true);
|
||||||
scrolledToolbar->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
scrolledToolbar->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
scrolledToolbar->setFixedHeight(toolbar->height());
|
|
||||||
scrolledToolbar->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
scrolledToolbar->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
StyleHelper::setPanelWidgetSingleRow(scrolledToolbar);
|
||||||
|
|
||||||
auto dock = new QDockWidget(Tr::tr("Toolbar"), q);
|
auto dock = new QDockWidget(Tr::tr("Toolbar"), q);
|
||||||
dock->setObjectName("Toolbar");
|
dock->setObjectName("Toolbar");
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ PerfProfilerTool::PerfProfilerTool()
|
|||||||
options->addAction(command);
|
options->addAction(command);
|
||||||
|
|
||||||
m_tracePointsButton = new QToolButton;
|
m_tracePointsButton = new QToolButton;
|
||||||
|
StyleHelper::setPanelWidget(m_tracePointsButton);
|
||||||
m_tracePointsButton->setDefaultAction(tracePointsAction);
|
m_tracePointsButton->setDefaultAction(tracePointsAction);
|
||||||
m_objectsToDelete << m_tracePointsButton;
|
m_objectsToDelete << m_tracePointsButton;
|
||||||
|
|
||||||
@@ -147,10 +148,14 @@ PerfProfilerTool::PerfProfilerTool()
|
|||||||
this, &PerfProfilerTool::updateRunActions);
|
this, &PerfProfilerTool::updateRunActions);
|
||||||
|
|
||||||
m_recordButton = new QToolButton;
|
m_recordButton = new QToolButton;
|
||||||
|
StyleHelper::setPanelWidget(m_recordButton);
|
||||||
m_clearButton = new QToolButton;
|
m_clearButton = new QToolButton;
|
||||||
|
StyleHelper::setPanelWidget(m_clearButton);
|
||||||
m_filterButton = new QToolButton;
|
m_filterButton = new QToolButton;
|
||||||
|
StyleHelper::setPanelWidget(m_filterButton);
|
||||||
m_filterMenu = new QMenu(m_filterButton);
|
m_filterMenu = new QMenu(m_filterButton);
|
||||||
m_aggregateButton = new QToolButton;
|
m_aggregateButton = new QToolButton;
|
||||||
|
StyleHelper::setPanelWidget(m_aggregateButton);
|
||||||
m_recordedLabel = new QLabel;
|
m_recordedLabel = new QLabel;
|
||||||
StyleHelper::setPanelWidget(m_recordedLabel);
|
StyleHelper::setPanelWidget(m_recordedLabel);
|
||||||
m_delayLabel = new QLabel;
|
m_delayLabel = new QLabel;
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ void StateProperties::createUi()
|
|||||||
m_currentTagName = new QLabel;
|
m_currentTagName = new QLabel;
|
||||||
|
|
||||||
auto propertiesToolBar = new QToolBar;
|
auto propertiesToolBar = new QToolBar;
|
||||||
propertiesToolBar->setMinimumHeight(24);
|
|
||||||
propertiesToolBar->addWidget(titleLabel);
|
propertiesToolBar->addWidget(titleLabel);
|
||||||
propertiesToolBar->addWidget(m_currentTagName);
|
propertiesToolBar->addWidget(m_currentTagName);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
|
|
||||||
#include <utils/itemviews.h>
|
#include <utils/itemviews.h>
|
||||||
|
#include <utils/stylehelper.h>
|
||||||
#include <utils/theme/theme.h>
|
#include <utils/theme/theme.h>
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
@@ -305,14 +306,17 @@ void SquishOutputPane::clearOldResults()
|
|||||||
void SquishOutputPane::createToolButtons()
|
void SquishOutputPane::createToolButtons()
|
||||||
{
|
{
|
||||||
m_expandAll = new QToolButton(m_treeView);
|
m_expandAll = new QToolButton(m_treeView);
|
||||||
|
Utils::StyleHelper::setPanelWidget(m_expandAll);
|
||||||
m_expandAll->setIcon(Utils::Icons::EXPAND_TOOLBAR.icon());
|
m_expandAll->setIcon(Utils::Icons::EXPAND_TOOLBAR.icon());
|
||||||
m_expandAll->setToolTip(Tr::tr("Expand All"));
|
m_expandAll->setToolTip(Tr::tr("Expand All"));
|
||||||
|
|
||||||
m_collapseAll = new QToolButton(m_treeView);
|
m_collapseAll = new QToolButton(m_treeView);
|
||||||
|
Utils::StyleHelper::setPanelWidget(m_collapseAll);
|
||||||
m_collapseAll->setIcon(Utils::Icons::COLLAPSE_TOOLBAR.icon());
|
m_collapseAll->setIcon(Utils::Icons::COLLAPSE_TOOLBAR.icon());
|
||||||
m_collapseAll->setToolTip(Tr::tr("Collapse All"));
|
m_collapseAll->setToolTip(Tr::tr("Collapse All"));
|
||||||
|
|
||||||
m_filterButton = new QToolButton(m_treeView);
|
m_filterButton = new QToolButton(m_treeView);
|
||||||
|
Utils::StyleHelper::setPanelWidget(m_filterButton);
|
||||||
m_filterButton->setIcon(Utils::Icons::FILTER.icon());
|
m_filterButton->setIcon(Utils::Icons::FILTER.icon());
|
||||||
m_filterButton->setToolTip(Tr::tr("Filter Test Results"));
|
m_filterButton->setToolTip(Tr::tr("Filter Test Results"));
|
||||||
m_filterButton->setProperty("noArrow", true);
|
m_filterButton->setProperty("noArrow", true);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/stylehelper.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@@ -63,6 +64,7 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
|
|||||||
this, &OutlineWidgetStack::toggleCursorSynchronization);
|
this, &OutlineWidgetStack::toggleCursorSynchronization);
|
||||||
|
|
||||||
m_filterButton = new QToolButton(this);
|
m_filterButton = new QToolButton(this);
|
||||||
|
Utils::StyleHelper::setPanelWidget(m_filterButton);
|
||||||
// The ToolButton needs a parent because updateFilterMenu() sets
|
// The ToolButton needs a parent because updateFilterMenu() sets
|
||||||
// it visible. That would open a top-level window if the button
|
// it visible. That would open a top-level window if the button
|
||||||
// did not have a parent in that moment.
|
// did not have a parent in that moment.
|
||||||
@@ -75,6 +77,7 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
|
|||||||
m_filterButton->setMenu(m_filterMenu);
|
m_filterButton->setMenu(m_filterMenu);
|
||||||
|
|
||||||
m_toggleSort = new QToolButton(this);
|
m_toggleSort = new QToolButton(this);
|
||||||
|
Utils::StyleHelper::setPanelWidget(m_toggleSort);
|
||||||
m_toggleSort->setIcon(Utils::Icons::SORT_ALPHABETICALLY_TOOLBAR.icon());
|
m_toggleSort->setIcon(Utils::Icons::SORT_ALPHABETICALLY_TOOLBAR.icon());
|
||||||
m_toggleSort->setCheckable(true);
|
m_toggleSort->setCheckable(true);
|
||||||
m_toggleSort->setChecked(false);
|
m_toggleSort->setChecked(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user