diff --git a/retroshare-gui/src/gui/FileTransfer/xprogressbar.cpp b/retroshare-gui/src/gui/FileTransfer/xprogressbar.cpp index 9ab743f87..003904b30 100644 --- a/retroshare-gui/src/gui/FileTransfer/xprogressbar.cpp +++ b/retroshare-gui/src/gui/FileTransfer/xprogressbar.cpp @@ -233,7 +233,9 @@ void xProgressBar::paint() uint32_t ss = _pinfo.nb_chunks ; - if(ss > 1) // for small files we use a more progressive display + QRect bounding = painter->boundingRect(rect, Qt::AlignCenter, QLocale().toString(_pinfo.progress, 'f', 2) + "%"); + + if((ss > 1) && (rect.width() > (1.5*bounding.width()))) // for small files we use a more progressive display { if(!_pinfo.cmap._map.empty()) { @@ -303,7 +305,7 @@ void xProgressBar::paint() overPaintSelectedChunks( _pinfo.chunks_in_progress , QColor(170, 20,9), QColor(223,121,123), width,ss) ; overPaintSelectedChunks( _pinfo.chunks_in_checking , QColor(186,143,0), QColor(223,196, 61), width,ss) ; } - else + else if ((rect.width() < bounding.width()) || !displayText) { // calculate progress value int preWidth = static_cast((rect.width() - 1 - hSpan)*(_pinfo.progress/100.0f)); @@ -318,9 +320,8 @@ void xProgressBar::paint() // paint text? - if (displayText) + if (displayText && (rect.width() >= bounding.width())) { - QRect bounding = painter->boundingRect(rect, Qt::AlignCenter, QLocale().toString(_pinfo.progress, 'f', 2) + "%"); QColor color (255-textColor.red(), 255-textColor.green(), 255-textColor.blue(), 125); painter->setPen(color); painter->setBrush(QBrush(color));