VirtualBox

Changeset 94029 in vbox


Ignore:
Timestamp:
Mar 1, 2022 11:09:14 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
150262
Message:

FE/Qt: qt6: QList, QSet & QVector adjustments. bugref:9898

  • QList::toSet was removed in "favor" of QSet's range constructors (5.14+). Similarly QSet::fromList. Very tedious and there were some unnecessary QSet conversions.
  • QVector was mapped to QList and fromStdVector discontinued in 6.
Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

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

    r94014 r94029  
    31653165
    31663166    /* Invalidate all known menus: */
     3167#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
     3168    QList<int> const updateHandlerKeys = m_menuUpdateHandlers.keys();
     3169    m_invalidations.unite(QSet<int>(updateHandlerKeys.begin(), updateHandlerKeys.end()));
     3170#else
    31673171    m_invalidations.unite(m_menuUpdateHandlers.keys().toSet());
     3172#endif
    31683173
    31693174    /* Apply language settings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r93996 r94029  
    212212        /* Get new group list/set: */
    213213        const QStringList &newGroupList = m_newLists.value(strId);
     214#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
     215        const UIStringSet newGroupSet(newGroupList.begin(), newGroupList.end());
     216#else
    214217        const UIStringSet &newGroupSet = UIStringSet::fromList(newGroupList);
     218#endif
    215219        /* Get old group list/set: */
    216220        const QStringList &oldGroupList = m_oldLists.value(strId);
     221#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
     222        const UIStringSet oldGroupSet(oldGroupList.begin(), oldGroupList.end());
     223#else
    217224        const UIStringSet &oldGroupSet = UIStringSet::fromList(oldGroupList);
     225#endif
    218226        /* Make sure group set changed: */
    219227        if (newGroupSet == oldGroupSet)
     
    899907            /* Remove unregistered cloud VM nodes: */
    900908            if (!unregisteredIDs.isEmpty())
     909            {
     910#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
     911                QList<QUuid> listUnregisteredIDs(unregisteredIDs.begin(), unregisteredIDs.end());
     912#else
     913                QList<QUuid> listUnregisteredIDs = unregisteredIDs.toList();
     914#endif
    901915                sltCloudMachinesUnregistered(guiCloudProfileKey.m_strProviderShortName,
    902916                                             guiCloudProfileKey.m_strProfileName,
    903                                              unregisteredIDs.toList());
     917                                             listUnregisteredIDs);
     918            }
    904919            /* Add registered cloud VM nodes: */
    905920            if (!registeredMachines.isEmpty())
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r94004 r94029  
    429429
    430430    /* If we have at least one of those items currently selected: */
     431#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     432    {
     433        QList<UIChooserItem *> selectedItemsList = selectedItems();
     434        QSet<UIChooserItem *> selectedItemsSet(selectedItemsList.begin(), selectedItemsList.end());
     435        if (selectedItemsSet.intersects(matchedItems))
     436            setSelectedItem(findClosestUnselectedItem());
     437    }
     438#else
    431439    if (selectedItems().toSet().intersects(matchedItems))
    432440        setSelectedItem(findClosestUnselectedItem());
     441#endif
    433442
    434443    /* If global item is currently chosen, selection should be invalidated: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp

    r94013 r94029  
    14361436bool UIKeyboardHandler::keyEventHandleNormal(int iKey, uint8_t uScan, int fFlags, LONG *pCodes, uint *puCodesCount)
    14371437{
    1438     /* Get host-combo key list: */
    1439     QSet<int> allHostComboKeys = UIHostCombo::toKeyCodeList(gEDataManager->hostKeyCombination()).toSet();
    14401438    /* Get the type of key - simple or extended: */
    14411439    uint8_t uWhatPressed = fFlags & KeyExtended ? IsExtKeyPressed : IsKeyPressed;
     
    14781476    /* Ignore key-release if that key was NOT pressed before,
    14791477     * but only if thats not one of the host-combination keys: */
    1480     else if (!allHostComboKeys.contains(iKey))
    1481         return true;
     1478    else
     1479    {
     1480        /* Get host-combo key list: */
     1481        QList<int> lstAllHostComboKey = UIHostCombo::toKeyCodeList(gEDataManager->hostKeyCombination());
     1482        if (!lstAllHostComboKey.contains(iKey))
     1483            return true;
     1484    }
    14821485    return false;
    14831486}
     
    16141617{
    16151618    /* Get host-combo key list: */
    1616     QSet<int> allHostComboKeys = UIHostCombo::toKeyCodeList(gEDataManager->hostKeyCombination()).toSet();
     1619    QList<int> allHostComboKeys = UIHostCombo::toKeyCodeList(gEDataManager->hostKeyCombination());
    16171620
    16181621    /* Update the map of pressed host-combo keys: */
     
    16321635        }
    16331636    }
     1637
    16341638    /* Check if we are currently holding FULL host-combo: */
    1635     bool fIsFullHostComboPresent = !allHostComboKeys.isEmpty() && allHostComboKeys == m_pressedHostComboKeys.keys().toSet();
     1639    bool fIsFullHostComboPresent = false;
     1640    if (!allHostComboKeys.isEmpty())
     1641    {
     1642        const QList<int> &pressedKeyList = m_pressedHostComboKeys.keys();
     1643        fIsFullHostComboPresent =    QSet<int>(allHostComboKeys.begin(), allHostComboKeys.end())
     1644                                  == QSet<int>(pressedKeyList.begin(), pressedKeyList.end());
     1645    }
     1646
    16361647    /* Check if currently pressed/released key had changed host-combo state: */
    16371648    const bool isHostComboStateChanged = (!m_bIsHostComboPressed &&  fIsFullHostComboPresent) ||
     
    17281739        {
    17291740            /* Send prepared scan-codes to the guest: */
     1741#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     1742            QVector<LONG> scancodes;
     1743            for (uint i = 0; i < uCodesCount; i++)
     1744                scancodes.push_back(pCodes[i]);
     1745            keyboard().PutScancodes(scancodes);
     1746#else
    17301747            std::vector<LONG> scancodes(pCodes, &pCodes[uCodesCount]);
    17311748            keyboard().PutScancodes(QVector<LONG>::fromStdVector(scancodes));
     1749#endif
    17321750        }
    17331751
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