- Timestamp:
- May 23, 2008 12:57:29 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxMediaComboBox.h
r8155 r9079 45 45 void setUseEmptyItem (bool); 46 46 void setBelongsTo (const QUuid &); 47 QUuid getId ();47 QUuid getId (int aId = -1); 48 48 QUuid getBelongsTo(); 49 49 void setCurrentItem (const QUuid &); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxMediaComboBox.cpp
r8155 r9079 258 258 } 259 259 260 QUuid VBoxMediaComboBox::getId() 261 { 262 return mUuidList.isEmpty() ? QUuid() : QUuid (mUuidList [currentItem()]); 260 QUuid VBoxMediaComboBox::getId (int aId) 261 { 262 return mUuidList.isEmpty() ? QUuid() : 263 aId == -1 ? QUuid (mUuidList [currentItem()]) : 264 QUuid (mUuidList [aId]); 263 265 } 264 266 … … 268 270 QPixmap *aPixmap) 269 271 { 270 aPixmap ? insertItem (*aPixmap, aName) : insertItem (aName); 271 mUuidList << aId; 272 mTipList << aTip; 272 int currentIndex = currentItem(); 273 274 int insertPosition = -1; 275 for (int i = 0; i < count(); ++ i) 276 /* Searching for the first real (non-null) vdi item 277 which have name greater than the item to be inserted. 278 This is necessary for sorting items alphabetically. */ 279 if (text (i).localeAwareCompare (aName) > 0 && 280 !getId (i).isNull()) 281 { 282 insertPosition = i; 283 break; 284 } 285 286 insertPosition == -1 ? mUuidList.append (aId) : 287 mUuidList.insert (insertPosition, aId); 288 289 insertPosition == -1 ? mTipList.append (aId) : 290 mTipList.insert (insertPosition, aTip); 291 292 aPixmap ? insertItem (*aPixmap, aName, insertPosition) : 293 insertItem (aName, insertPosition); 294 295 if (insertPosition != -1 && currentIndex >= insertPosition) 296 QComboBox::setCurrentItem (currentIndex + 1); 273 297 } 274 298
Note:
See TracChangeset
for help on using the changeset viewer.