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 b4f2ac0dd4

Change-Id: Ia41cf3db7e4485dff4712412976c1d4f5dd315b2
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2022-07-04 18:16:19 +02:00
parent de4c8cb174
commit 946d08c6fd
2 changed files with 25 additions and 16 deletions

View File

@@ -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;

View File

@@ -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<FutureProgress> m_currentStatusDetailsProgress;