From 0e02ad100b0e96c77b6030853bd88a6d4706a776 Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 6 Dec 2016 11:18:07 +0100 Subject: Prettify ProgressDialog Make it fixed width, show only the filename from the source instead of the full path and elide text if necessary. --- progressdialog.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'progressdialog.cpp') diff --git a/progressdialog.cpp b/progressdialog.cpp index 778a3b4..f354a07 100644 --- a/progressdialog.cpp +++ b/progressdialog.cpp @@ -17,9 +17,18 @@ ProgressDialog::ProgressDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(par mainLayout->addWidget(mLabel); mainLayout->addWidget(mProgress); mainLayout->addLayout(btnLayout); + setMaximumWidth(400); + setMinimumWidth(400); setLayout(mainLayout); } +void ProgressDialog::setLabelText(const QString &text){ + QFontMetrics fm(mLabel->font()); + int width = mLabel->width() - 4; + QString fixed = fm.elidedText(text, Qt::ElideRight, width); + mLabel->setText(fixed); +} + void ProgressDialog::setValue(int val){ mProgress->setValue(val); } -- cgit v1.2.3-70-g09d2