diff options
author | kh1 <karsten.heimrich@nokia.com> | 2011-12-01 00:26:21 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@nokia.com> | 2011-12-01 11:30:28 +0100 |
commit | 29224714f92813c04565947c37065a8feb8778e0 (patch) | |
tree | d088e3a4bf527d945915b69aa5b133d6bca0a7cb | |
parent | f18a946482d89636044c40cf96e6601386175579 (diff) |
Fix QTIFW-85.
Do not use word wrap and provide a better size policy. Also
elide the text if it does not fit the width of the widget.
Change-Id: I18fbdd64c6aa7e07b66d36bf708f709d00787199
Reviewed-by: Niels Weber <niels.2.weber@nokia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
-rw-r--r-- | installerbuilder/libinstaller/performinstallationform.cpp | 16 | ||||
-rw-r--r-- | installerbuilder/libinstaller/performinstallationform.h | 1 |
2 files changed, 13 insertions, 4 deletions
diff --git a/installerbuilder/libinstaller/performinstallationform.cpp b/installerbuilder/libinstaller/performinstallationform.cpp index 64547bf87..7d367d85a 100644 --- a/installerbuilder/libinstaller/performinstallationform.cpp +++ b/installerbuilder/libinstaller/performinstallationform.cpp @@ -74,14 +74,15 @@ void PerformInstallationForm::setupUi(QWidget *widget) m_progressLabel = new QLabel(widget); m_progressLabel->setObjectName(QLatin1String("ProgressLabel")); + m_progressLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); topLayout->addWidget(m_progressLabel); m_downloadStatus = new QLabel(widget); m_downloadStatus->setObjectName(QLatin1String("DownloadStatus")); - m_downloadStatus->setWordWrap(true); + m_downloadStatus->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); topLayout->addWidget(m_downloadStatus); - connect(ProgressCoordinator::instance(), SIGNAL(downloadStatusChanged(QString)), m_downloadStatus, - SLOT(setText(QString))); + connect(ProgressCoordinator::instance(), SIGNAL(downloadStatusChanged(QString)), this, + SLOT(onDownloadStatusChanged(QString))); m_detailsButton = new QPushButton(tr("&Show Details"), widget); m_detailsButton->setObjectName(QLatin1String("DetailsButton")); @@ -126,7 +127,8 @@ void PerformInstallationForm::updateProgress() m_progressBar->setRange(0, 100); m_progressBar->setValue(progressPercentage); - m_progressLabel->setText(progressCoordninator->labelText()); + m_progressLabel->setText(m_progressLabel->fontMetrics().elidedText(progressCoordninator->labelText(), + Qt::ElideRight, m_progressLabel->width())); } void PerformInstallationForm::toggleDetails() @@ -180,3 +182,9 @@ bool PerformInstallationForm::isShowingDetails() const { return m_detailsBrowser->isVisible(); } + +void PerformInstallationForm::onDownloadStatusChanged(const QString &status) +{ + m_downloadStatus->setText(m_downloadStatus->fontMetrics().elidedText(status, Qt::ElideRight, + m_downloadStatus->width())); +} diff --git a/installerbuilder/libinstaller/performinstallationform.h b/installerbuilder/libinstaller/performinstallationform.h index 755cebee7..9c5a2a39c 100644 --- a/installerbuilder/libinstaller/performinstallationform.h +++ b/installerbuilder/libinstaller/performinstallationform.h @@ -64,6 +64,7 @@ public slots: void updateProgress(); void toggleDetails(); void clearDetailsBrowser(); + void onDownloadStatusChanged(const QString &status); private: QProgressBar *m_progressBar; |