VirtualBox

Ignore:
Timestamp:
Nov 26, 2012 10:00:56 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: VM group UI: More strict chooser-view minimum-width-hint handling.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.cpp

    r43885 r43957  
    135135{
    136136    /* Setup chooser-model connections: */
    137     connect(m_pChooserModel, SIGNAL(sigRootItemResized(const QSizeF&, int)),
    138             m_pChooserView, SLOT(sltHandleRootItemResized(const QSizeF&, int)));
     137    connect(m_pChooserModel, SIGNAL(sigRootItemResized(const QSizeF&)),
     138            m_pChooserView, SLOT(sltHandleRootItemResized(const QSizeF&)));
     139    connect(m_pChooserModel, SIGNAL(sigRootItemMinimumWidthHintChanged(int)),
     140            m_pChooserView, SLOT(sltHandleRootItemMinimumWidthHintChanged(int)));
    139141    connect(m_pChooserModel, SIGNAL(sigFocusChanged(UIGChooserItem*)),
    140142            m_pChooserView, SLOT(sltFocusChanged(UIGChooserItem*)));
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp

    r43955 r43957  
    3939    , m_fTemporary(fTemporary)
    4040    , m_pParent(pParent)
     41    , m_iPreviousMinimumWidthHint(0)
    4142    , m_dragTokenPlace(DragToken_Off)
    4243    , m_fHovered(false)
     
    163164    if (parentItem())
    164165        parentItem()->updateGeometry();
     166
     167    /* Special handling for root-items: */
     168    if (isRoot())
     169    {
     170        /* Root-item should notify chooser-view if minimum-width-hint was changed: */
     171        int iMinimumWidthHint = minimumWidthHint();
     172        if (m_iPreviousMinimumWidthHint != iMinimumWidthHint)
     173        {
     174            /* Save new minimum-width-hint, notify listener: */
     175            m_iPreviousMinimumWidthHint = iMinimumWidthHint;
     176            emit sigMinimumWidthHintChanged(m_iPreviousMinimumWidthHint);
     177        }
     178    }
    165179}
    166180
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.h

    r43885 r43957  
    6767
    6868signals:
     69
     70    /* Notifier: Layout stuff: */
     71    void sigMinimumWidthHintChanged(int iMinimumWidthHint);
    6972
    7073    /* Notifiers: Hover stuff: */
     
    189192    UIGChooserItem *m_pParent;
    190193    QRectF m_previousGeometry;
     194    int m_iPreviousMinimumWidthHint;
    191195    DragToken m_dragTokenPlace;
    192196
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp

    r43955 r43957  
    5353    /* Translate finally: */
    5454    retranslateUi();
     55
     56    /* Prepare connections: */
     57    connect(this, SIGNAL(sigMinimumWidthHintChanged(int)),
     58            model(), SIGNAL(sigRootItemMinimumWidthHintChanged(int)));
    5559
    5660    /* Init: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp

    r43937 r43957  
    177177    root()->show();
    178178    /* Notify listener about root-item relayouted: */
    179     emit sigRootItemResized(root()->geometry().size(), root()->minimumWidthHint());
     179    emit sigRootItemResized(root()->geometry().size());
    180180}
    181181
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h

    r43937 r43957  
    7474
    7575    /* Notifiers: Root-item stuff: */
    76     void sigRootItemResized(const QSizeF &size, int iMinimumWidth);
     76    void sigRootItemResized(const QSizeF &size);
     77    void sigRootItemMinimumWidthHintChanged(int iRootItemMinimumWidthHint);
    7778    void sigSlidingStarted();
    7879
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.cpp

    r43885 r43957  
    3939}
    4040
    41 void UIGChooserView::sltHandleRootItemResized(const QSizeF &size, int iMinimumWidth)
     41void UIGChooserView::sltHandleRootItemResized(const QSizeF &size)
    4242{
    4343    /* Update scene-rect: */
    4444    updateSceneRect(size);
     45}
    4546
    46     /* Set minimum width: */
    47     setMinimumWidth(2 * frameWidth() + iMinimumWidth +
    48                     verticalScrollBar()->sizeHint().width());
     47void UIGChooserView::sltHandleRootItemMinimumWidthHintChanged(int iRootItemMinimumWidthHint)
     48{
     49    /* Set minimum view width according to root-item minimum-width-hint: */
     50    setMinimumWidth(2 * frameWidth() + iRootItemMinimumWidthHint + verticalScrollBar()->sizeHint().width());
    4951}
    5052
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.h

    r43936 r43957  
    4343private slots:
    4444
    45     /* Handler: Root-item stuff: */
    46     void sltHandleRootItemResized(const QSizeF &size, int iMinimumWidth);
     45    /* Handlers: Root-item stuff: */
     46    void sltHandleRootItemResized(const QSizeF &size);
     47    void sltHandleRootItemMinimumWidthHintChanged(int iRootItemMinimumWidthHint);
    4748
    4849    /* Handler: Focus-item stuff: */
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