VirtualBox

Changeset 68295 in vbox for trunk/src


Ignore:
Timestamp:
Aug 4, 2017 10:00:45 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8900: UITabBar: Proper item layout counting (order); Separate main layout from the tab one.

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

Legend:

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

    r68253 r68295  
    374374UITabBar::UITabBar(QWidget *pParent /* = 0 */)
    375375    : QWidget(pParent)
    376     , m_pLayout(0)
     376    , m_pLayoutMain(0)
     377    , m_pLayoutTab(0)
    377378    , m_pCurrentItem(0)
    378379{
     
    393394        connect(pItem, &UITabBarItem::sigCloseClicked, this, &UITabBar::sltHandleChildClose);
    394395        /* Add item into layout and list: */
    395         m_pLayout->insertWidget(1, pItem);
    396         m_aItems << pItem;
     396        m_pLayoutTab->insertWidget(0, pItem);
     397        m_aItems.prepend(pItem);
    397398        /* Return unique ID: */
    398399        return uuid;
     
    495496{
    496497    /* Create main layout: */
    497     m_pLayout = new QHBoxLayout(this);
    498     if (m_pLayout)
     498    m_pLayoutMain = new QHBoxLayout(this);
     499    AssertPtrReturnVoid(m_pLayoutMain);
    499500    {
    500501        /* Configure layout: */
    501         m_pLayout->setSpacing(0);
    502         m_pLayout->setContentsMargins(0, 0, 0, 0);
     502        m_pLayoutMain->setSpacing(0);
     503        m_pLayoutMain->setContentsMargins(0, 0, 0, 0);
    503504
    504505        // TODO: Workout stretch at the and as well,
    505506        //       depending on which alignment is set.
    506507        /* Add strech into beginning: */
    507         m_pLayout->addStretch();
     508        m_pLayoutMain->addStretch();
     509
     510        /* Create tab layout: */
     511        m_pLayoutTab = new QHBoxLayout;
     512        AssertPtrReturnVoid(m_pLayoutTab);
     513        {
     514            /* Add into layout: */
     515            m_pLayoutMain->addLayout(m_pLayoutTab);
     516        }
    508517    }
    509518}
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.h

    r68145 r68295  
    7575    void prepare();
    7676
    77     /** Holds the main layout instance. */
    78     QHBoxLayout *m_pLayout;
     77    /** @name Contents: Widgets
     78      * @{ */
     79        /** Holds the main layout instance. */
     80        QHBoxLayout *m_pLayoutMain;
     81        /** Holds the tab layout instance. */
     82        QHBoxLayout *m_pLayoutTab;
    7983
    80     /** Holds the current item reference. */
    81     UITabBarItem *m_pCurrentItem;
     84        /** Holds the current item reference. */
     85        UITabBarItem *m_pCurrentItem;
    8286
    83     /** Holds the array of items instances. */
    84     QList<UITabBarItem*> m_aItems;
     87        /** Holds the array of items instances. */
     88        QList<UITabBarItem*> m_aItems;
     89    /** @} */
    8590};
    8691
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