mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Fix empty tooltips showed at the progress bar borders
If tooltip text contains an empty HTML body, Qt still shows it as an empty rectangle. Thus, output HTML tags only if we are within the image region, and return true empty string if we are at the borders.
This commit is contained in:
parent
29fb8e8085
commit
d43466d466
1 changed files with 3 additions and 3 deletions
|
@ -253,11 +253,11 @@ void PiecesBar::showToolTip(const QHelpEvent *e)
|
|||
QTextStream stream(&toolTipText, QIODevice::WriteOnly);
|
||||
bool showDetailedInformation = QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
|
||||
if (showDetailedInformation) {
|
||||
stream << "<html><body>";
|
||||
const int imagePos = e->pos().x() - borderWidth;
|
||||
if ((imagePos >=0) && (imagePos < m_image.width())) {
|
||||
stream << "<html><body>";
|
||||
PieceIndexToImagePos transform {m_torrent->info(), m_image};
|
||||
int pieceIndex = transform.pieceIndex(e->pos().x() - borderWidth);
|
||||
int pieceIndex = transform.pieceIndex(imagePos);
|
||||
QVector<int> files {m_torrent->info().fileIndicesForPiece(pieceIndex)};
|
||||
|
||||
QString tooltipTitle;
|
||||
|
@ -281,8 +281,8 @@ void PiecesBar::showToolTip(const QHelpEvent *e)
|
|||
|
||||
renderer(Utils::Misc::friendlyUnit(m_torrent->info().fileSize(f)), filePath);
|
||||
}
|
||||
stream << "</body></html>";
|
||||
}
|
||||
stream << "</body></html>";
|
||||
}
|
||||
else {
|
||||
stream << simpleToolTipText();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue