diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2019-04-09 17:10:22 +0200 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2019-04-11 11:12:33 +0000 |
commit | 44f5b9318b9e41bf932b3c86f0e72ef225a2115a (patch) | |
tree | 8cfc99e70009746cf4f30034911a81a481e4caa6 | |
parent | 89e70ca785df08b448997927d7c28145f599857f (diff) |
Core: Turn progress detail expander into a real icon
Change-Id: Ie6173cc041b96cd10879189bedce1104cdbe7a33
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/libs/utils/images/toggleprogressdetails.png | bin | 0 -> 167 bytes | |||
-rw-r--r-- | src/libs/utils/images/toggleprogressdetails@2x.png | bin | 0 -> 216 bytes | |||
-rw-r--r-- | src/libs/utils/utils.qrc | 2 | ||||
-rw-r--r-- | src/libs/utils/utilsicons.cpp | 2 | ||||
-rw-r--r-- | src/libs/utils/utilsicons.h | 1 | ||||
-rw-r--r-- | src/plugins/coreplugin/progressmanager/progressmanager.cpp | 35 | ||||
-rw-r--r-- | src/plugins/coreplugin/progressmanager/progressmanager_p.h | 9 | ||||
-rw-r--r-- | src/tools/icons/qtcreatoricons.svg | 41 |
8 files changed, 48 insertions, 42 deletions
diff --git a/src/libs/utils/images/toggleprogressdetails.png b/src/libs/utils/images/toggleprogressdetails.png Binary files differnew file mode 100644 index 0000000000..b2353cd9d0 --- /dev/null +++ b/src/libs/utils/images/toggleprogressdetails.png diff --git a/src/libs/utils/images/toggleprogressdetails@2x.png b/src/libs/utils/images/toggleprogressdetails@2x.png Binary files differnew file mode 100644 index 0000000000..28a212491e --- /dev/null +++ b/src/libs/utils/images/toggleprogressdetails@2x.png diff --git a/src/libs/utils/utils.qrc b/src/libs/utils/utils.qrc index dc576ca806..9aa2fbb976 100644 --- a/src/libs/utils/utils.qrc +++ b/src/libs/utils/utils.qrc @@ -219,6 +219,8 @@ <file>images/settings@2x.png</file> <file>images/sort_alphabetically.png</file> <file>images/sort_alphabetically@2x.png</file> + <file>images/toggleprogressdetails.png</file> + <file>images/toggleprogressdetails@2x.png</file> </qresource> <qresource prefix="/codemodel"> <file>images/enum.png</file> diff --git a/src/libs/utils/utilsicons.cpp b/src/libs/utils/utilsicons.cpp index fe040c63d5..5afd3cc56a 100644 --- a/src/libs/utils/utilsicons.cpp +++ b/src/libs/utils/utilsicons.cpp @@ -188,6 +188,8 @@ const Icon LINK_TOOLBAR({ {QLatin1String(":/utils/images/linkicon.png"), Theme::IconsBaseColor}}); const Icon SORT_ALPHABETICALLY_TOOLBAR({ {QLatin1String(":/utils/images/sort_alphabetically.png"), Theme::IconsBaseColor}}); +const Icon TOGGLE_PROGRESSDETAILS_TOOLBAR({ + {QLatin1String(":/utils/images/toggleprogressdetails.png"), Theme::IconsBaseColor}}); const Icon WARNING({ {QLatin1String(":/utils/images/warningfill.png"), Theme::BackgroundColorNormal}, diff --git a/src/libs/utils/utilsicons.h b/src/libs/utils/utilsicons.h index 8cf7b21048..ca8ad69ff7 100644 --- a/src/libs/utils/utilsicons.h +++ b/src/libs/utils/utilsicons.h @@ -109,6 +109,7 @@ QTCREATOR_UTILS_EXPORT extern const Icon FILTER; QTCREATOR_UTILS_EXPORT extern const Icon LINK; QTCREATOR_UTILS_EXPORT extern const Icon LINK_TOOLBAR; QTCREATOR_UTILS_EXPORT extern const Icon SORT_ALPHABETICALLY_TOOLBAR; +QTCREATOR_UTILS_EXPORT extern const Icon TOGGLE_PROGRESSDETAILS_TOOLBAR; QTCREATOR_UTILS_EXPORT extern const Icon INFO; QTCREATOR_UTILS_EXPORT extern const Icon INFO_TOOLBAR; diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 318f84163c..bbf0f0b820 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -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; diff --git a/src/plugins/coreplugin/progressmanager/progressmanager_p.h b/src/plugins/coreplugin/progressmanager/progressmanager_p.h index c3509c1ce4..4eabe50204 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager_p.h +++ b/src/plugins/coreplugin/progressmanager/progressmanager_p.h @@ -112,14 +112,5 @@ private: bool m_hovered = false; }; -class ToggleButton : public QToolButton -{ - Q_OBJECT -public: - ToggleButton(QWidget *parent); - QSize sizeHint() const override; - void paintEvent(QPaintEvent *event) override; -}; - } // namespace Internal } // namespace Core diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg index f9abb04b4a..cb6e4836af 100644 --- a/src/tools/icons/qtcreatoricons.svg +++ b/src/tools/icons/qtcreatoricons.svg @@ -3607,6 +3607,45 @@ width="100%" height="100%" /> </g> + <g + style="display:inline" + transform="translate(160)" + id="src/libs/utils/images/toggleprogressdetails"> + <use + style="display:inline" + transform="translate(1740,132)" + height="100%" + width="100%" + id="use4105-8-8" + xlink:href="#backgroundRect" + y="0" + x="0" /> + <rect + style="display:inline;fill:#707070" + id="rect2566" + width="8" + height="2" + x="1726" + y="577" /> + <rect + style="display:inline;fill:none;stroke:#000000" + id="rect2564" + width="13" + height="3" + x="1725.5" + y="576.5" + ry="1" + rx="1" /> + <use + transform="matrix(1,0,0,-1,1529,1167)" + style="display:inline" + x="0" + y="0" + xlink:href="#expandarrow" + id="use2507" + width="100%" + height="100%" /> + </g> </g> <g inkscape:groupmode="layer" @@ -6593,7 +6632,7 @@ <path sodipodi:nodetypes="cccc" inkscape:connector-curvature="0" - id="path4784-17" + id="expandarrow" d="m 210,595 -2.5,2.5 -2.5,-2.5 z" style="fill:#000000;fill-opacity:1;stroke:none" /> </g> |