forked from qt-creator/qt-creator
Core: Turn progress detail expander into a real icon
Change-Id: Ie6173cc041b96cd10879189bedce1104cdbe7a33 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stylehelper.h>
|
||||
#include <utils/theme/theme.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QEvent>
|
||||
@@ -319,7 +320,7 @@ void ProgressManagerPrivate::init()
|
||||
m_summaryProgressBar->setCancelEnabled(false);
|
||||
m_summaryProgressLayout->addWidget(m_summaryProgressBar);
|
||||
layout->addWidget(m_summaryProgressWidget);
|
||||
auto toggleButton = new ToggleButton(m_statusBarWidget);
|
||||
auto toggleButton = new QToolButton(m_statusBarWidget);
|
||||
layout->addWidget(toggleButton);
|
||||
m_statusBarWidget->installEventFilter(this);
|
||||
StatusBarManager::addStatusBarWidget(m_statusBarWidget, StatusBarManager::RightCorner);
|
||||
@@ -327,10 +328,7 @@ void ProgressManagerPrivate::init()
|
||||
QAction *toggleProgressView = new QAction(tr("Toggle Progress Details"), this);
|
||||
toggleProgressView->setCheckable(true);
|
||||
toggleProgressView->setChecked(m_progressViewPinned);
|
||||
// we have to set an transparent icon to prevent the tool button to show text
|
||||
QPixmap p(1, 1);
|
||||
p.fill(Qt::transparent);
|
||||
toggleProgressView->setIcon(QIcon(p));
|
||||
toggleProgressView->setIcon(Utils::Icons::TOGGLE_PROGRESSDETAILS_TOOLBAR.icon());
|
||||
Command *cmd = ActionManager::registerAction(toggleProgressView,
|
||||
"QtCreator.ToggleProgressDetails");
|
||||
|
||||
@@ -712,33 +710,6 @@ void ProgressManagerPrivate::progressDetailsToggled(bool checked)
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
ToggleButton::ToggleButton(QWidget *parent)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
if (creatorTheme()->flag(Theme::FlatToolBars)) {
|
||||
QPalette p = palette();
|
||||
p.setBrush(QPalette::Base, creatorTheme()->color(Theme::ToggleButtonBackgroundColor));
|
||||
setPalette(p);
|
||||
}
|
||||
}
|
||||
|
||||
QSize ToggleButton::sizeHint() const
|
||||
{
|
||||
return QSize(13, 12); // Uneven width, because the arrow's width is also uneven.
|
||||
}
|
||||
|
||||
void ToggleButton::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QToolButton::paintEvent(event);
|
||||
QPainter p(this);
|
||||
QStyleOption arrowOpt;
|
||||
arrowOpt.initFrom(this);
|
||||
arrowOpt.rect.adjust(2, 0, -1, -2);
|
||||
StyleHelper::drawArrow(QStyle::PE_IndicatorArrowUp, &p, &arrowOpt);
|
||||
}
|
||||
|
||||
|
||||
ProgressManager::ProgressManager() = default;
|
||||
|
||||
ProgressManager::~ProgressManager() = default;
|
||||
|
||||
Reference in New Issue
Block a user