VirtualBox

Changeset 31059 in vbox for trunk/src


Ignore:
Timestamp:
Jul 23, 2010 1:09:33 PM (14 years ago)
Author:
vboxsync
Message:

Shared Folders/Fe/Qt4: Introduced automatic resizing to better show path contents; take new auto-mount column into account.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/vm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSF.cpp

    r31002 r31059  
    235235}
    236236
     237void VBoxVMSettingsSF::resizeEvent (QResizeEvent *aEvent)
     238{
     239    adjustList();
     240}
     241
    237242void VBoxVMSettingsSF::getFromGlobal()
    238243{
     
    477482void VBoxVMSettingsSF::adjustList()
    478483{
    479     /* Calculating required columns size & watching those columns (0 and 2) to feat 1/3 of total width. */
     484    /*
     485     * Calculates required columns sizes to max out column 2
     486     * and let all other columns stay at their minimum sizes.
     487     *
     488     * Columns
     489     * 0 = Tree view
     490     * 1 = Shared Folder name
     491     * 2 = Auto-mount flag
     492     * 3 = Writable flag
     493     */
    480494    QAbstractItemView *itemView = mTwFolders;
    481495    QHeaderView *itemHeader = mTwFolders->header();
    482496    int total = mTwFolders->viewport()->width();
     497
    483498    int mw0 = qMax (itemView->sizeHintForColumn (0), itemHeader->sectionSizeHint (0));
    484499    int mw2 = qMax (itemView->sizeHintForColumn (2), itemHeader->sectionSizeHint (2));
    485     int w0 = mw0 < total / 3 ? mw0 : total / 3;
    486     int w2 = mw2 < total / 3 ? mw2 : total / 3;
     500    int mw3 = qMax (itemView->sizeHintForColumn (3), itemHeader->sectionSizeHint (3));
     501
     502    int w0 = mw0 < total / 4 ? mw0 : total / 4;
     503    int w2 = mw2 < total / 4 ? mw2 : total / 4;
     504    int w3 = mw3 < total / 4 ? mw3 : total / 4;
    487505
    488506    /* Giving 1st column all the available space. */
    489507    mTwFolders->setColumnWidth (0, w0);
    490     mTwFolders->setColumnWidth (1, total - w0 - w2);
     508    mTwFolders->setColumnWidth (1, total - w0 - w2 - w3);
    491509    mTwFolders->setColumnWidth (2, w2);
     510    mTwFolders->setColumnWidth (3, w3);
    492511}
    493512
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSF.h

    r31002 r31059  
    7979private:
    8080
     81    void resizeEvent (QResizeEvent *aEvent);
     82
    8183    void showEvent (QShowEvent *aEvent);
    8284
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