Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 378:a7a643988390
Fix #1024 - avoid status bar repainting all its siblings when its message changes (and it resizes) by using a widget in the status bar for the label instead of the bar itself.
author | Chris Cannam |
---|---|
date | Wed, 02 Jul 2014 15:09:51 +0100 |
parents | 20bab95852c1 |
children | 6a84102c006a |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Wed Jul 02 08:42:58 2014 +0100 +++ b/framework/MainWindowBase.cpp Wed Jul 02 15:09:51 2014 +0100 @@ -154,7 +154,8 @@ m_labeller(0), m_lastPlayStatusSec(0), m_initialDarkBackground(false), - m_defaultFfwdRwdStep(2, 0) + m_defaultFfwdRwdStep(2, 0), + m_statusLabel(0) { Profiler profiler("MainWindowBase::MainWindowBase"); @@ -2450,6 +2451,16 @@ } } +QLabel * +MainWindowBase::getStatusLabel() const +{ + if (!m_statusLabel) { + m_statusLabel = new QLabel(); + statusBar()->addWidget(m_statusLabel, 1); + } + return m_statusLabel; +} + void MainWindowBase::toggleStatusBar() { @@ -2748,7 +2759,7 @@ updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); } else { m_myStatusMessage = ""; - statusBar()->showMessage(""); + getStatusLabel()->setText(""); } } @@ -3055,7 +3066,7 @@ m_myStatusMessage = tr("Playing: %1 of %2 (%3 remaining)") .arg(nowStr).arg(thenStr).arg(remainingStr); - statusBar()->showMessage(m_myStatusMessage); + getStatusLabel()->setText(m_myStatusMessage); } void @@ -3272,16 +3283,16 @@ void MainWindowBase::contextHelpChanged(const QString &s) { - QStatusBar *bar = statusBar(); + QLabel *lab = getStatusLabel(); if (s == "" && m_myStatusMessage != "") { - if (bar->currentMessage() != m_myStatusMessage) { - bar->showMessage(m_myStatusMessage); + if (lab->text() != m_myStatusMessage) { + lab->setText(m_myStatusMessage); } return; } - bar->showMessage(s); + lab->setText(s); } void