Changeset 70452 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 3, 2018 6:05:20 PM (7 years ago)
- 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/UIGChooserModel.cpp
r69500 r70452 349 349 /* Call for wrapper above: */ 350 350 setCurrentItems(list); 351 } 352 353 UIGChooserItem* UIGChooserModel::findClosestUnselectedItem() const 354 { 355 /* 356 * Take the focus item (if any) as a starting point and find 357 * the closest non-selected item 358 */ 359 UIGChooserItem *pItem = focusItem(); 360 if (!pItem) 361 pItem = currentItem(); 362 if (pItem) 363 { 364 int idxBefore = navigationList().indexOf(pItem) - 1; 365 int idxAfter = idxBefore + 2; 366 while(idxBefore >= 0 || idxAfter < navigationList().size()) 367 { 368 if (idxBefore >= 0) 369 { 370 pItem = navigationList().at(idxBefore); 371 if (!currentItems().contains(pItem)) 372 return pItem; 373 idxBefore--; 374 } 375 if (idxAfter < navigationList().size()) 376 { 377 pItem = navigationList().at(idxAfter); 378 if (!currentItems().contains(pItem)) 379 return pItem; 380 idxAfter++; 381 } 382 } 383 } 384 return 0; 351 385 } 352 386 … … 1527 1561 return; 1528 1562 1529 /* Unset current item(s): */1530 unsetCurrentItem();1563 /* Change selection to some close by item: */ 1564 setCurrentItem(findClosestUnselectedItem()); 1531 1565 1532 1566 /* For every selected item: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h
r69500 r70452 120 120 void addToCurrentItems(UIGChooserItem *pItem); 121 121 void removeFromCurrentItems(UIGChooserItem *pItem); 122 UIGChooserItem* findClosestUnselectedItem() const; 122 123 void makeSureSomeItemIsSelected(); 123 124 void notifyCurrentItemChanged();
Note:
See TracChangeset
for help on using the changeset viewer.