Changeset 43549 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 5, 2012 10:32:09 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 81161
- 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 71 71 else if (UIGChooserItemMachine *pMachineItem = qgraphicsitem_cast<UIGChooserItemMachine*>(pItemUnderMouse)) 72 72 pClickedItem = pMachineItem; 73 /* If we had clicked one of therequired item types: */73 /* If we had clicked one of required item types: */ 74 74 if (pClickedItem && !pClickedItem->isRoot()) 75 75 { … … 128 128 else if (UIGChooserItemMachine *pMachineItem = qgraphicsitem_cast<UIGChooserItemMachine*>(pItemUnderMouse)) 129 129 pClickedItem = pMachineItem; 130 /* If we had clicked one of therequired item types: */130 /* If we had clicked one of required item types: */ 131 131 if (pClickedItem) 132 132 { … … 135 135 { 136 136 /* Is clicked item in selection list: */ 137 bool fIsClickedItemInSelectionList = contains(model()->currentItems(),pClickedItem);137 bool fIsClickedItemInSelectionList = model()->currentItems().contains(pClickedItem); 138 138 /* Move focus to clicked item (with selection if not selected yet): */ 139 139 model()->setFocusItem(pClickedItem, !fIsClickedItemInSelectionList); … … 216 216 model()->activate(); 217 217 } 218 #if 0219 /* 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 else236 {237 /* Activate machine item: */238 model()->activate();239 }240 /* Filter that event out: */241 return true;242 }243 #endif244 218 break; 245 219 } … … 252 226 } 253 227 254 bool UIGChooserHandlerMouse::contains(QList<UIGChooserItem*> list,255 UIGChooserItem *pRequiredItem,256 bool fRecursively /* = false */) const257 {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 59 59 bool handleMouseDoubleClick(QGraphicsSceneMouseEvent *pEvent) const; 60 60 61 /* Helper: Check if some list contains some item: */62 bool contains(QList<UIGChooserItem*> list, UIGChooserItem *pRequiredItem, bool fRecursively = false) const;63 64 61 /* Variables: */ 65 62 UIGChooserModel *m_pModel;
Note:
See TracChangeset
for help on using the changeset viewer.