VirtualBox

Ignore:
Timestamp:
Oct 5, 2012 10:32:09 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
81161
Message:

FE/Qt: VM group feature UI: Mouse-handler cleanup (part 1).

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

Legend:

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

    r43539 r43549  
    7171                else if (UIGChooserItemMachine *pMachineItem = qgraphicsitem_cast<UIGChooserItemMachine*>(pItemUnderMouse))
    7272                    pClickedItem = pMachineItem;
    73                 /* If we had clicked one of the required item types: */
     73                /* If we had clicked one of required item types: */
    7474                if (pClickedItem && !pClickedItem->isRoot())
    7575                {
     
    128128                else if (UIGChooserItemMachine *pMachineItem = qgraphicsitem_cast<UIGChooserItemMachine*>(pItemUnderMouse))
    129129                    pClickedItem = pMachineItem;
    130                 /* If we had clicked one of the required item types: */
     130                /* If we had clicked one of required item types: */
    131131                if (pClickedItem)
    132132                {
     
    135135                    {
    136136                        /* Is clicked item in selection list: */
    137                         bool fIsClickedItemInSelectionList = contains(model()->currentItems(), pClickedItem);
     137                        bool fIsClickedItemInSelectionList = model()->currentItems().contains(pClickedItem);
    138138                        /* Move focus to clicked item (with selection if not selected yet): */
    139139                        model()->setFocusItem(pClickedItem, !fIsClickedItemInSelectionList);
     
    216216                    model()->activate();
    217217                }
    218 #if 0
    219                 /* Or a machine one? */
    220                 else if (UIGChooserItemMachine *pMachineItem = qgraphicsitem_cast<UIGChooserItemMachine*>(pItemUnderMouse))
    221                 {
    222                     /* Prepare variables: */
    223                     int iMachineItemWidth = pMachineItem->geometry().toRect().width();
    224                     int iMouseDoubleClickX = pEvent->scenePos().toPoint().x();
    225                     /* If click was at left part: */
    226                     if (iMouseDoubleClickX < iMachineItemWidth / 2)
    227                     {
    228                         /* Unindent root if possible: */
    229                         if (model()->root() != model()->mainRoot())
    230                         {
    231                             pMachineItem->setHovered(false);
    232                             model()->unindentRoot();
    233                         }
    234                     }
    235                     else
    236                     {
    237                         /* Activate machine item: */
    238                         model()->activate();
    239                     }
    240                     /* Filter that event out: */
    241                     return true;
    242                 }
    243 #endif
    244218                break;
    245219            }
     
    252226}
    253227
    254 bool UIGChooserHandlerMouse::contains(QList<UIGChooserItem*> list,
    255                                       UIGChooserItem *pRequiredItem,
    256                                       bool fRecursively /* = false */) const
    257 {
    258     /* Search throught the all passed list items: */
    259     foreach (UIGChooserItem *pItem, list)
    260     {
    261         /* Check item first: */
    262         if (pItem == pRequiredItem)
    263             return true;
    264         /* Check if this item supports children: */
    265         if (fRecursively && pItem->type() == UIGChooserItemType_Group)
    266         {
    267             /* Check items recursively: */
    268             if (contains(pItem->items(), pRequiredItem))
    269                 return true;
    270         }
    271     }
    272     return false;
    273 }
    274 
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerMouse.h

    r42529 r43549  
    5959    bool handleMouseDoubleClick(QGraphicsSceneMouseEvent *pEvent) const;
    6060
    61     /* Helper: Check if some list contains some item: */
    62     bool contains(QList<UIGChooserItem*> list, UIGChooserItem *pRequiredItem, bool fRecursively = false) const;
    63 
    6461    /* Variables: */
    6562    UIGChooserModel *m_pModel;
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