VirtualBox

Changeset 86652 in vbox for trunk/src


Ignore:
Timestamp:
Oct 20, 2020 2:37:58 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: Restore root group scrolling position if possible while rebuilding the tree.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r84625 r86652  
    145145    /* Relayout model: */
    146146    model()->updateLayout();
     147}
     148
     149int UIChooserItemGroup::scrollingValue() const
     150{
     151    return m_pScrollArea->scrollingValue();
     152}
     153
     154void UIChooserItemGroup::setScrollingValue(int iValue)
     155{
     156    m_pScrollArea->setScrollingValue(iValue);
    147157}
    148158
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h

    r84625 r86652  
    9696    /** @name Navigation stuff.
    9797      * @{ */
     98        /** Returns scrolling location value in pixels. */
     99        int scrollingValue() const;
     100        /** Defines scrolling location @a iValue in pixels. */
     101        void setScrollingValue(int iValue);
    98102        /** Performs scrolling by @a iDelta pixels. */
    99103        void scrollBy(int iDelta);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r86651 r86652  
    16581658void UIChooserModel::buildTreeForMainRoot(bool fPreserveSelection /* = false */)
    16591659{
     1660    /* Remember scrolling location: */
     1661    const int iScrollLocation = m_pRoot ? m_pRoot->toGroupItem()->scrollingValue() : 0;
     1662
    16601663    /* Remember all selected items if requested: */
    16611664    QStringList selectedItemDefinitions;
     
    16921695        makeSureAtLeastOneItemSelected();
    16931696    }
     1697
     1698    /* Restore scrolling location: */
     1699    m_pRoot->toGroupItem()->setScrollingValue(iScrollLocation);
    16941700
    16951701    /* Repeat search if search widget is visible: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsScrollArea.cpp

    r82968 r86652  
    114114}
    115115
     116int UIGraphicsScrollArea::scrollingValue() const
     117{
     118    return m_pScrollBar->value();
     119}
     120
     121void UIGraphicsScrollArea::setScrollingValue(int iValue)
     122{
     123    iValue = qMax(iValue, 0);
     124    iValue = qMin(iValue, m_pScrollBar->maximum());
     125    m_pScrollBar->setValue(iValue);
     126}
     127
    116128void UIGraphicsScrollArea::scrollBy(int iDelta)
    117129{
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsScrollArea.h

    r82968 r86652  
    5050    QIGraphicsWidget *viewport() const;
    5151
     52    /** Returns scrolling location value in pixels. */
     53    int scrollingValue() const;
     54    /** Defines scrolling location @a iValue in pixels. */
     55    void setScrollingValue(int iValue);
    5256    /** Performs scrolling by @a iDelta pixels. */
    5357    void scrollBy(int iDelta);
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