diff --git a/src/gui/properties/piecesbar.cpp b/src/gui/properties/piecesbar.cpp index 843c1dd62..963cbcf29 100644 --- a/src/gui/properties/piecesbar.cpp +++ b/src/gui/properties/piecesbar.cpp @@ -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 << ""; const int imagePos = e->pos().x() - borderWidth; if ((imagePos >=0) && (imagePos < m_image.width())) { + stream << ""; PieceIndexToImagePos transform {m_torrent->info(), m_image}; - int pieceIndex = transform.pieceIndex(e->pos().x() - borderWidth); + int pieceIndex = transform.pieceIndex(imagePos); QVector 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 << ""; } - stream << ""; } else { stream << simpleToolTipText();