VirtualBox

Ignore:
Timestamp:
Apr 20, 2016 4:43:23 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: ​​​​​​​​bugref:6577: Runtime UI: Make sure machine-view scroll-bars are shown independent of each other, i.e. if there is enough place in one of directions corresponding scroll-bar should not appear.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r60362 r60607  
    8181    }
    8282
     83    /* For scroll-bars of the machine-view: */
     84    if (   pWatched == verticalScrollBar()
     85        || pWatched == horizontalScrollBar())
     86    {
     87        switch (pEvent->type())
     88        {
     89            /* On show/hide event: */
     90            case QEvent::Show:
     91            case QEvent::Hide:
     92            {
     93                /* Set maximum-size to size-hint: */
     94                setMaximumSize(sizeHint());
     95                break;
     96            }
     97            default:
     98                break;
     99        }
     100    }
     101
    83102    return UIMachineView::eventFilter(pWatched, pEvent);
    84103}
     
    91110    /* Setup size-policy: */
    92111    setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
    93     /* Maximum size to sizehint: */
     112    /* Set maximum-size to size-hint: */
    94113    setMaximumSize(sizeHint());
    95114}
     
    99118    /* Base class filters: */
    100119    UIMachineView::prepareFilters();
     120
     121    /* Install scroll-bars event-filters: */
     122    verticalScrollBar()->installEventFilter(this);
     123    horizontalScrollBar()->installEventFilter(this);
    101124
    102125#ifdef VBOX_WS_WIN
     
    208231        sltPerformGuestResize(machineWindow()->centralWidget()->size());
    209232    }
     233}
     234
     235QSize UIMachineViewNormal::sizeHint() const
     236{
     237    /* Call to base-class: */
     238    QSize size = UIMachineView::sizeHint();
     239
     240    /* If guest-screen auto-resize is not enabled
     241     * or the guest-additions doesn't support graphics
     242     * we should take scroll-bars size-hints into account: */
     243    if (!m_bIsGuestAutoresizeEnabled || !uisession()->isGuestSupportsGraphics())
     244    {
     245        if (verticalScrollBar()->isVisible())
     246            size += QSize(verticalScrollBar()->sizeHint().width(), 0);
     247        if (horizontalScrollBar()->isVisible())
     248            size += QSize(0, horizontalScrollBar()->sizeHint().height());
     249    }
     250
     251    /* Return resulting size-hint finally: */
     252    return size;
    210253}
    211254
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h

    r59380 r60607  
    6868
    6969    /* Private helpers: */
     70    QSize sizeHint() const;
    7071    QRect workingArea() const;
    7172    QSize calculateMaxGuestSize() const;
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