VirtualBox

Changeset 97663 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 23, 2022 9:33:48 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154717
Message:

FE/Qt: bugref:10326: Bugfix for UIGraphicsScrollArea on macOS; When scrollbars set to be always visible on macOS, we should take their geometry into account only if they are visible indeed.

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

Legend:

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

    r96407 r97663  
    287287void UIGraphicsScrollArea::layoutWidgets()
    288288{
    289     layoutViewport();
    290     layoutScrollBar();
    291 }
    292 
    293 void UIGraphicsScrollArea::layoutViewport()
    294 {
    295     if (m_pViewport)
    296     {
    297         switch (m_enmOrientation)
    298         {
    299             case Qt::Horizontal:
    300             {
    301                 /* Align viewport and shift it horizontally: */
    302                 if (m_fAutoHideMode)
    303                     m_pViewport->resize(m_pViewport->minimumSizeHint().width(), size().height());
    304                 else
    305                     m_pViewport->resize(m_pViewport->minimumSizeHint().width(), size().height() - m_pScrollBar->minimumSizeHint().height());
    306                 m_pViewport->setPos(-m_pScrollBar->value(), 0);
    307                 break;
    308             }
    309             case Qt::Vertical:
    310             {
    311                 /* Align viewport and shift it vertically: */
    312                 if (m_fAutoHideMode)
    313                     m_pViewport->resize(size().width(), m_pViewport->minimumSizeHint().height());
    314                 else
    315                     m_pViewport->resize(size().width() - m_pScrollBar->minimumSizeHint().width(), m_pViewport->minimumSizeHint().height());
    316                 m_pViewport->setPos(0, -m_pScrollBar->value());
    317                 break;
    318             }
    319         }
    320     }
    321 }
    322 
    323 void UIGraphicsScrollArea::layoutScrollBar()
    324 {
    325289    switch (m_enmOrientation)
    326290    {
     
    361325    }
    362326
    363     /* Make scroll-bar visible only when there is viewport and maximum less than minimum: */
     327    /* Make scroll-bar visible only when there is viewport and maximum more than minimum: */
    364328    m_pScrollBar->setVisible(m_pViewport && m_pScrollBar->maximum() > m_pScrollBar->minimum());
    365 }
     329
     330    if (m_pViewport)
     331    {
     332        switch (m_enmOrientation)
     333        {
     334            case Qt::Horizontal:
     335            {
     336                /* Calculate geometry deduction: */
     337                const int iDeduction = !m_fAutoHideMode && m_pScrollBar->isVisible() ? m_pScrollBar->minimumSizeHint().height() : 0;
     338                /* Align viewport and shift it horizontally: */
     339                m_pViewport->resize(m_pViewport->minimumSizeHint().width(), size().height() - iDeduction);
     340                m_pViewport->setPos(-m_pScrollBar->value(), 0);
     341                break;
     342            }
     343            case Qt::Vertical:
     344            {
     345                /* Calculate geometry deduction: */
     346                const int iDeduction = !m_fAutoHideMode && m_pScrollBar->isVisible() ? m_pScrollBar->minimumSizeHint().width() : 0;
     347                /* Align viewport and shift it vertically: */
     348                m_pViewport->resize(size().width() - iDeduction, m_pViewport->minimumSizeHint().height());
     349                m_pViewport->setPos(0, -m_pScrollBar->value());
     350                break;
     351            }
     352        }
     353    }
     354}
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsScrollArea.h

    r96407 r97663  
    9292    /** Layout widgets. */
    9393    void layoutWidgets();
    94     /** Layout viewport. */
    95     void layoutViewport();
    96     /** Layout scroll-bar. */
    97     void layoutScrollBar();
    9894
    9995    /** Holds the orientation. */
Note: See TracChangeset for help on using the changeset viewer.

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