From 946d08c6fdb8b66e47d450c517a775633d5c564c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 4 Jul 2022 18:16:19 +0200 Subject: [PATCH] Fix display of build errors/warnings in status bar We show a summary of errors/warnings with icons in the status bar, if the "Progress Details" are toggled off. The change that fixed the size of that details widget to a grid, to prevent constant relayouting of the output pane buttons while indexing runs, broke the size of the build result summary. The size was adapted in ProgressManagerPrivate::updateStatusDetailsWidget() but that is only called when FutureProgress::setWidget is called. When the build manager later makes the warning/error details visible, the size was left at the minimum size of 20 pixels, leading to the widget being cut off. Amends b4f2ac0dd45c62d04a75c3e445734a0b37961dec Change-Id: Ia41cf3db7e4485dff4712412976c1d4f5dd315b2 Reviewed-by: David Schulz --- .../progressmanager/progressmanager.cpp | 40 ++++++++++++------- .../progressmanager/progressmanager_p.h | 1 - 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index fc14df4257e..cac1b2bc427 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -226,6 +226,27 @@ using namespace Utils; static ProgressManagerPrivate *m_instance = nullptr; +const int RASTER = 20; + +class StatusDetailsWidgetContainer : public QWidget +{ +public: + StatusDetailsWidgetContainer(QWidget *parent) + : QWidget(parent) + {} + + QSize sizeHint() const override + { + // make size fit on raster, to avoid flickering in status bar + // because the output pane buttons resize, if the widget changes a lot (like it is the case for + // the language server indexing) + const QSize preferredSize = layout()->sizeHint(); + const int preferredWidth = preferredSize.width(); + const int width = preferredWidth + (RASTER - preferredWidth % RASTER); + return {width, preferredSize.height()}; + } +}; + ProgressManagerPrivate::ProgressManagerPrivate() : m_opacityEffect(new QGraphicsOpacityEffect(this)) { @@ -273,13 +294,13 @@ void ProgressManagerPrivate::init() summaryProgressLayout->setContentsMargins(0, 0, 0, 2); summaryProgressLayout->setSpacing(0); m_summaryProgressWidget->setLayout(summaryProgressLayout); - m_statusDetailsWidgetContainer = new QWidget(m_summaryProgressWidget); - m_statusDetailsWidgetLayout = new QHBoxLayout(m_statusDetailsWidgetContainer); + auto statusDetailsWidgetContainer = new StatusDetailsWidgetContainer(m_summaryProgressWidget); + m_statusDetailsWidgetLayout = new QHBoxLayout(statusDetailsWidgetContainer); m_statusDetailsWidgetLayout->setContentsMargins(0, 0, 0, 0); m_statusDetailsWidgetLayout->setSpacing(0); m_statusDetailsWidgetLayout->addStretch(1); - m_statusDetailsWidgetContainer->setLayout(m_statusDetailsWidgetLayout); - summaryProgressLayout->addWidget(m_statusDetailsWidgetContainer); + statusDetailsWidgetContainer->setLayout(m_statusDetailsWidgetLayout); + summaryProgressLayout->addWidget(statusDetailsWidgetContainer); m_summaryProgressBar = new ProgressBar(m_summaryProgressWidget); m_summaryProgressBar->setMinimumWidth(70); m_summaryProgressBar->setTitleVisible(false); @@ -616,8 +637,6 @@ void ProgressManagerPrivate::updateVisibilityWithDelay() QTimer::singleShot(150, this, &ProgressManagerPrivate::updateVisibility); } -const int RASTER = 20; - void ProgressManagerPrivate::updateStatusDetailsWidget() { QWidget *candidateWidget = nullptr; @@ -645,15 +664,6 @@ void ProgressManagerPrivate::updateStatusDetailsWidget() } } - // make size fit on raster, to avoid flickering in status bar - // because the output pane buttons resize, if the widget changes a lot (like it is the case for - // the language server indexing) - if (candidateWidget) { - const int preferredWidth = candidateWidget->sizeHint().width(); - const int width = preferredWidth + (RASTER - preferredWidth % RASTER); - m_statusDetailsWidgetContainer->setFixedWidth(width); - } - if (candidateWidget == m_currentStatusDetailsWidget) return; diff --git a/src/plugins/coreplugin/progressmanager/progressmanager_p.h b/src/plugins/coreplugin/progressmanager/progressmanager_p.h index edd933fa2cb..b28ad4f711d 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager_p.h +++ b/src/plugins/coreplugin/progressmanager/progressmanager_p.h @@ -101,7 +101,6 @@ private: StatusBarWidget *m_statusBarWidgetContainer; QWidget *m_statusBarWidget; QWidget *m_summaryProgressWidget; - QWidget *m_statusDetailsWidgetContainer = nullptr; QHBoxLayout *m_statusDetailsWidgetLayout = nullptr; QWidget *m_currentStatusDetailsWidget = nullptr; QPointer m_currentStatusDetailsProgress;