mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
desktop: better handling of progress dialog width
We shouldn't need to manually set it, but it appears we do. To avoid constant resizing, let's only grow it - and let's set the size before we update the text. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3f012f4bdb
commit
b9318a9ab1
1 changed files with 5 additions and 2 deletions
|
@ -77,10 +77,13 @@ extern "C" int updateProgress(const char *text)
|
|||
if (verbose)
|
||||
qDebug() << "git storage:" << text;
|
||||
if (progressDialog) {
|
||||
// apparently we don't always get enough space to show the full label
|
||||
// so let's manually make enough space (but don't shrink the existing size)
|
||||
int width = QFontMetrics(qApp->font()).width(text) + 100;
|
||||
if (width > progressDialog->width())
|
||||
progressDialog->resize(width + 20, progressDialog->height());
|
||||
progressDialog->setLabelText(text);
|
||||
progressDialog->setValue(++progressCounter);
|
||||
int width = QFontMetrics(qApp->font()).width(text) + 100;
|
||||
progressDialog->resize(width, progressDialog->height());
|
||||
if (progressCounter == 100)
|
||||
progressCounter = 0; // yes this is silly, but we really don't know how long it will take
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue