VirtualBox

Changeset 73799 in vbox


Ignore:
Timestamp:
Aug 21, 2018 9:22:39 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: UISlidingWidget: Add possibility to slide in vertical direction, not just in horizontal.

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

Legend:

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

    r73780 r73799  
    468468
    469469                    /* Create sliding-widget: */
    470                     m_pSlidingWidget = new UISlidingWidget;
     470                    m_pSlidingWidget = new UISlidingWidget(Qt::Vertical);
    471471                    if (m_pSlidingWidget)
    472472                    {
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r73735 r73799  
    20472047
    20482048            /* Create sliding-widget: */
    2049             m_pSlidingWidget = new UISlidingWidget;
     2049            m_pSlidingWidget = new UISlidingWidget(Qt::Horizontal);
    20502050            AssertPtrReturnVoid(m_pSlidingWidget);
    20512051            {
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISlidingWidget.cpp

    r73598 r73799  
    1919#include <QEvent>
    2020#include <QHBoxLayout>
     21#include <QVBoxLayout>
    2122
    2223/* GUI includes: */
     
    2526
    2627
    27 UISlidingWidget::UISlidingWidget(QWidget *pParent /* = 0 */)
     28UISlidingWidget::UISlidingWidget(Qt::Orientation enmOrientation, QWidget *pParent /* = 0 */)
    2829    : QWidget(pParent)
     30    , m_enmOrientation(enmOrientation)
    2931    , m_enmState(State_Start)
    3032    , m_pAnimation(0)
     
    117119    {
    118120        /* Create layout: */
    119         m_pLayout = new QHBoxLayout(m_pWidget);
     121        switch (m_enmOrientation)
     122        {
     123            case Qt::Horizontal: m_pLayout = new QHBoxLayout(m_pWidget); break;
     124            case Qt::Vertical:   m_pLayout = new QVBoxLayout(m_pWidget); break;
     125        }
    120126        if (m_pLayout)
    121127        {
     
    135141{
    136142    /* Recalculate sub-window geometry animation boundaries based on size-hint: */
    137     m_startWidgetGeometry = QRect(  0,           0,
    138                                     2 * width(), height());
    139     m_finalWidgetGeometry = QRect(- width(),     0,
    140                                     2 * width(), height());
     143    switch (m_enmOrientation)
     144    {
     145        case Qt::Horizontal:
     146        {
     147            m_startWidgetGeometry = QRect(  0,           0,
     148                                            2 * width(), height());
     149            m_finalWidgetGeometry = QRect(- width(),     0,
     150                                            2 * width(), height());
     151            break;
     152        }
     153        case Qt::Vertical:
     154        {
     155            m_startWidgetGeometry = QRect(0,       0,
     156                                          width(), 2 * height());
     157            m_finalWidgetGeometry = QRect(0,       -height(),
     158                                          width(), 2 * height());
     159            break;
     160        }
     161    }
    141162
    142163    /* Update animation finally: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISlidingWidget.h

    r73598 r73799  
    2323
    2424/* Forward declarations: */
    25 class QHBoxLayout;
     25class QBoxLayout;
    2626class QRect;
    2727class QWidget;
     
    5656    };
    5757
    58     /** Constructs sliding widget passing @a pParent to the base-class. */
    59     UISlidingWidget(QWidget *pParent = 0);
     58    /** Constructs sliding widget passing @a pParent to the base-class.
     59      * @param  enmOrientation  Brings the widget orientation. */
     60    UISlidingWidget(Qt::Orientation enmOrientation, QWidget *pParent = 0);
    6061
    6162    /** Holds the minimum widget size. */
     
    105106    QRect finalWidgetGeometry() const { return m_finalWidgetGeometry; }
    106107
     108    /** Holds the widget orientation. */
     109    Qt::Orientation  m_enmOrientation;
     110
    107111    /** Holds whether we are in animation final state. */
    108112    State        m_enmState;
     
    117121    QWidget     *m_pWidget;
    118122    /** Holds the widget layout instance. */
    119     QHBoxLayout *m_pLayout;
     123    QBoxLayout *m_pLayout;
    120124    /** Holds the 1st widget reference. */
    121125    QWidget     *m_pWidget1;
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