X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/9c7ccd477a32ad52ff0126024ffbad0f6ea164b5..d6488887ecf69d7f192b94de8dce34fae0b7eb76:/src/dolphinstatusbar.cpp diff --git a/src/dolphinstatusbar.cpp b/src/dolphinstatusbar.cpp index b2c621dbd..df67ac28f 100644 --- a/src/dolphinstatusbar.cpp +++ b/src/dolphinstatusbar.cpp @@ -51,18 +51,20 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent, const KUrl& url) : m_progressBar = new QProgressBar(this); m_progressBar->hide(); - const QSize size(m_progressBar->sizeHint()); - const int barHeight = size.height(); + const int contentHeight = QFontMetrics(m_messageLabel->font()).height(); + const int barHeight = contentHeight + 8; - m_progressBar->setMaximumWidth(200); setMinimumHeight(barHeight); m_messageLabel->setMinimumTextHeight(barHeight); - m_spaceInfo->setFixedHeight(barHeight); + m_spaceInfo->setFixedHeight(contentHeight); + m_progressBar->setFixedHeight(contentHeight); + m_progressBar->setMaximumWidth(200); } DolphinStatusBar::~DolphinStatusBar() -{} +{ +} void DolphinStatusBar::setMessage(const QString& msg, Type type) @@ -144,7 +146,7 @@ const QString& DolphinStatusBar::defaultText() const void DolphinStatusBar::resizeEvent(QResizeEvent* event) { QWidget::resizeEvent(event); - QTimer::singleShot(0, this, SLOT(showSpaceInfo())); + QMetaObject::invokeMethod(this, "showSpaceInfo", Qt::QueuedConnection); } void DolphinStatusBar::updateProgressInfo() @@ -180,7 +182,6 @@ void DolphinStatusBar::showSpaceInfo() // The space information is shown currently. Hide it // if the progress bar is visible or if the status bar // text does not fit into the available width. - const QSize size(m_progressBar->sizeHint()); if (isProgressBarVisible || (widthGap > 0)) { m_spaceInfo->hide(); }