VirtualBox

Ignore:
Timestamp:
Aug 6, 2018 6:26:58 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: UITabBar: Support for left|right alignment types.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r72707 r73533  
    19571957
    19581958        /* Create Machine tab-bar: */
    1959         m_pTabBarMachine = new UITabBar;
     1959        m_pTabBarMachine = new UITabBar(UITabBar::Align_Right);
    19601960        AssertPtrReturnVoid(m_pTabBarMachine);
    19611961        {
     
    19701970
    19711971        /* Create Global tab-bar: */
    1972         m_pTabBarGlobal = new UITabBar;
     1972        m_pTabBarGlobal = new UITabBar(UITabBar::Align_Right);
    19731973        AssertPtrReturnVoid(m_pTabBarGlobal);
    19741974        {
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.cpp

    r72715 r73533  
    720720*********************************************************************************************************************************/
    721721
    722 UITabBar::UITabBar(QWidget *pParent /* = 0 */)
     722UITabBar::UITabBar(Alignment enmAlignment, QWidget *pParent /* = 0 */)
    723723    : QWidget(pParent)
     724    , m_enmAlignment(enmAlignment)
    724725    , m_pLayoutMain(0)
    725726    , m_pLayoutTab(0)
     
    745746        connect(pItem, &UITabBarItem::sigDragObjectDestroy, this, &UITabBar::sltHandleDragObjectDestroy);
    746747        /* Add item into layout and list: */
    747         m_pLayoutTab->insertWidget(0, pItem);
    748         m_aItems.prepend(pItem);
     748        switch (m_enmAlignment)
     749        {
     750            case Align_Left:
     751                m_pLayoutTab->addWidget(pItem);
     752                m_aItems.append(pItem);
     753                break;
     754            case Align_Right:
     755                m_pLayoutTab->insertWidget(0, pItem);
     756                m_aItems.prepend(pItem);
     757                break;
     758        }
    749759        /* Update children styles: */
    750760        updateChildrenStyles();
     
    10211031        m_pLayoutMain->setContentsMargins(0, 0, 0, 0);
    10221032
    1023         /// @todo Workout stretch at the and as well,
    1024         //       depending on which alignment is set.
    1025         /* Add strech into beginning: */
    1026         m_pLayoutMain->addStretch();
     1033        /* Add strech to beginning: */
     1034        if (m_enmAlignment == Align_Right)
     1035            m_pLayoutMain->addStretch();
    10271036
    10281037        /* Create tab layout: */
     
    10331042            m_pLayoutMain->addLayout(m_pLayoutTab);
    10341043        }
     1044
     1045        /* Add strech to end: */
     1046        if (m_enmAlignment == Align_Left)
     1047            m_pLayoutMain->addStretch();
    10351048    }
    10361049}
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.h

    r69057 r73533  
    5656public:
    5757
     58    /** Alignment types. */
     59    enum Alignment { Align_Left, Align_Right };
     60
    5861    /** Constructs tab-bar passing @a pParent to the base-class. */
    59     UITabBar(QWidget *pParent = 0);
     62    UITabBar(Alignment enmAlignment, QWidget *pParent = 0);
    6063
    6164    /** Adds new tab for passed @a pAction. @returns unique tab ID. */
     
    104107    void updateChildrenStyles();
    105108
     109    /** @name Contents: Common
     110      * @{ */
     111        /** Holds the alignment. */
     112        Alignment m_enmAlignment;
     113    /** @} */
     114
    106115    /** @name Contents: Widgets
    107116      * @{ */
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