VirtualBox

Changeset 77219 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 8, 2019 1:53:15 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128726
Message:

FE/Qt: bugref:9373: A bit of refactoring for UIGraphicsScrollBar to make some stuff reusable.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsScrollBar.cpp

    r77214 r77219  
    595595void UIGraphicsScrollBar::layoutToken()
    596596{
     597    m_pToken->setPos(actualTokenPosition());
     598}
     599
     600QPoint UIGraphicsScrollBar::actualTokenPosition() const
     601{
    597602    /* We calculating ratio on the basis of current/minimum/maximum values: */
    598603    const double dRatio = m_iMaximum > m_iMinimum ? (double)(m_iValue - m_iMinimum) / (m_iMaximum - m_iMinimum) : 0;
     604
     605    /* Prepare result: */
     606    QPoint position;
    599607
    600608    /* Depending on orientation: */
     
    607615            const int iMax = size().width() - 2 * m_iExtent;
    608616            int iX = dRatio * (iMax - iMin) + iMin;
    609             m_pToken->setPos(iX, 0);
     617            position = QPoint(iX, 0);
    610618            break;
    611619        }
     
    616624            const int iMax = size().height() - 2 * m_iExtent;
    617625            int iY = dRatio * (iMax - iMin) + iMin;
    618             m_pToken->setPos(0, iY);
     626            position = QPoint(0, iY);
    619627            break;
    620628        }
    621629    }
     630
     631    /* Return result: */
     632    return position;
    622633}
    623634
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsScrollBar.h

    r77214 r77219  
    133133    void layoutToken();
    134134
     135    /** Returns actual token position. */
     136    QPoint actualTokenPosition() const;
     137
    135138    /** Paints background using specified @a pPainter and certain @a rectangle. */
    136139    void paintBackground(QPainter *pPainter, const QRect &rectangle) const;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette