VirtualBox

Changeset 8609 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
May 5, 2008 5:11:37 PM (17 years ago)
Author:
vboxsync
Message:

2797: "FE/Qt: CD images not sorted in drop-down list": fix request complete.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp

    r8418 r8609  
    261261                                    QPixmap       *aPixmap)
    262262{
    263     aPixmap ? insertItem (*aPixmap, aName) : insertItem (aName);
    264     mUuidList << aId;
    265     mTipList  << aTip;
     263    int currentIndex = currentItem();
     264
     265    int insertPosition = -1;
     266    for (int i = 0; i < count(); ++ i)
     267        if (text (i) > aName)
     268        {
     269            insertPosition = i;
     270            break;
     271        }
     272
     273    insertPosition == -1 ? mUuidList.append (aId) :
     274        mUuidList.insert (mUuidList.at (insertPosition), aId);
     275
     276    insertPosition == -1 ? mTipList.append (aId) :
     277        mTipList.insert (mTipList.at (insertPosition), aTip);
     278
     279    aPixmap ? insertItem (*aPixmap, aName, insertPosition) :
     280              insertItem (aName, insertPosition);
     281
     282    if (insertPosition != -1 && currentIndex >= insertPosition)
     283        QComboBox::setCurrentItem (currentIndex + 1);
    266284}
    267285
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