VirtualBox

Changeset 77268 in vbox


Ignore:
Timestamp:
Feb 11, 2019 4:40:49 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128777
Message:

FE/Qt: bugref:9373: macOS: No buttons for UIGraphicsScrollBar on macOS, it's not a part of style there.

File:
1 edited

Legend:

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

    r77267 r77268  
    390390        {
    391391            /* We have to calculate the X coord of the token, leaving Y untouched: */
     392#ifdef VBOX_WS_MAC
     393            const int iMin = 0;
     394            const int iMax = size().width() - m_iExtent;
     395#else
    392396            const int iMin = m_iExtent;
    393397            const int iMax = size().width() - 2 * m_iExtent;
     398#endif
    394399            int iX = pos.x() - m_iExtent / 2;
    395400            iX = qMax(iX, iMin);
     
    402407        {
    403408            /* We have to calculate the Y coord of the token, leaving X untouched: */
     409#ifdef VBOX_WS_MAC
     410            const int iMin = 0;
     411            const int iMax = size().height() - m_iExtent;
     412#else
    404413            const int iMin = m_iExtent;
    405414            const int iMax = size().height() - 2 * m_iExtent;
     415#endif
    406416            int iY = pos.y() - m_iExtent / 2;
    407417            iY = qMax(iY, iMin);
     
    421431void UIGraphicsScrollBar::sltStateLeftDefault()
    422432{
    423     m_pButton1->hide();
    424     m_pButton2->hide();
    425     m_pToken->hide();
     433    if (m_pButton1)
     434        m_pButton1->hide();
     435    if (m_pButton2)
     436        m_pButton2->hide();
     437    if (m_pToken)
     438        m_pToken->hide();
    426439}
    427440
    428441void UIGraphicsScrollBar::sltStateLeftHovered()
    429442{
    430     m_pButton1->hide();
    431     m_pButton2->hide();
    432     m_pToken->hide();
     443    if (m_pButton1)
     444        m_pButton1->hide();
     445    if (m_pButton2)
     446        m_pButton2->hide();
     447    if (m_pToken)
     448        m_pToken->hide();
    433449}
    434450
    435451void UIGraphicsScrollBar::sltStateEnteredDefault()
    436452{
    437     m_pButton1->hide();
    438     m_pButton2->hide();
    439     m_pToken->hide();
     453    if (m_pButton1)
     454        m_pButton1->hide();
     455    if (m_pButton2)
     456        m_pButton2->hide();
     457    if (m_pToken)
     458        m_pToken->hide();
    440459}
    441460
    442461void UIGraphicsScrollBar::sltStateEnteredHovered()
    443462{
    444     m_pButton1->show();
    445     m_pButton2->show();
    446     m_pToken->show();
     463    if (m_pButton1)
     464        m_pButton1->show();
     465    if (m_pButton2)
     466        m_pButton2->show();
     467    if (m_pToken)
     468        m_pToken->show();
    447469}
    448470
     
    469491void UIGraphicsScrollBar::prepareButtons()
    470492{
     493#ifndef VBOX_WS_MAC
    471494    /* Create buttons depending on orientation: */
    472495    switch (m_enmOrientation)
     
    504527                this, &UIGraphicsScrollBar::sltButton2Clicked);
    505528    }
     529#endif
    506530}
    507531
     
    591615    /* Make sure extent value is not smaller than the button size: */
    592616    m_iExtent = QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent);
     617#ifndef VBOX_WS_MAC
    593618    m_iExtent = qMax(m_iExtent, (int)m_pButton1->minimumSizeHint().width());
    594619    m_iExtent = qMax(m_iExtent, (int)m_pButton2->minimumSizeHint().width());
     620#endif
    595621    updateGeometry();
    596622}
     
    604630void UIGraphicsScrollBar::layoutButtons()
    605631{
     632#ifndef VBOX_WS_MAC
    606633    // WORKAROUND:
    607634    // We are calculating proper button shift delta, because
     
    617644        iDelta2 = (m_iExtent - m_pButton2->minimumSizeHint().width() + 1) / 2;
    618645    m_pButton2->setPos(size().width() - m_iExtent + iDelta2, size().height() - m_iExtent + iDelta2);
     646#endif
    619647}
    620648
     
    638666        {
    639667            /* We have to adjust the X coord of the token, leaving Y unchanged: */
     668#ifdef VBOX_WS_MAC
     669            const int iMin = 0;
     670            const int iMax = size().width() - m_iExtent;
     671#else
    640672            const int iMin = m_iExtent;
    641673            const int iMax = size().width() - 2 * m_iExtent;
     674#endif
    642675            int iX = dRatio * (iMax - iMin) + iMin;
    643676            position = QPoint(iX, 0);
     
    647680        {
    648681            /* We have to adjust the Y coord of the token, leaving X unchanged: */
     682#ifdef VBOX_WS_MAC
     683            const int iMin = 0;
     684            const int iMax = size().height() - m_iExtent;
     685#else
    649686            const int iMin = m_iExtent;
    650687            const int iMax = size().height() - 2 * m_iExtent;
     688#endif
    651689            int iY = dRatio * (iMax - iMin) + iMin;
    652690            position = QPoint(0, iY);
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