VirtualBox

Changeset 68287 in vbox


Ignore:
Timestamp:
Aug 3, 2017 2:23:53 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
117403
Message:

FE/Qt: bugref:8900: UISlidingWidget: Proper way of doing layout handling in such complex case (where children are not linked to parent through QLayout interface).

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

Legend:

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

    r68166 r68287  
    1717
    1818/* Qt includes: */
     19#include <QEvent>
    1920#include <QHBoxLayout>
    2021
     
    7576}
    7677
     78bool UISlidingWidget::event(QEvent *pEvent)
     79{
     80    /* Process desired events: */
     81    switch (pEvent->type())
     82    {
     83        case QEvent::LayoutRequest:
     84        {
     85            // WORKAROUND:
     86            // Since we are not connected to
     87            // our children LayoutRequest,
     88            // we should update geometry
     89            // ourselves.
     90            updateGeometry();
     91            break;
     92        }
     93        default:
     94            break;
     95    }
     96
     97    /* Call to base class: */
     98    return QWidget::event(pEvent);
     99}
     100
    77101void UISlidingWidget::resizeEvent(QResizeEvent *pEvent)
    78102{
     
    84108    /* Update widget geometry: */
    85109    m_pWidget->setGeometry(m_fStateIsFinal ? m_finalWidgetGeometry : m_startWidgetGeometry);
    86 
    87     // TODO: Make this properly, dirty hack.
    88     /* A bit expensive but.. */
    89     updateGeometry();
    90110}
    91111
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISlidingWidget.h

    r68166 r68287  
    6363protected:
    6464
     65    /** Handles any Qt @a pEvent. */
     66    virtual bool event(QEvent *pEvent) /* override */;
     67
    6568    /** Handles resize @a pEvent. */
    6669    virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette