VirtualBox

Changeset 93983 in vbox


Ignore:
Timestamp:
Feb 28, 2022 2:37:43 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: qt6: QStringRef replaced by QStringView, mainly a problem in XML parsing. The latter does not have compare operators for C-strings, so wrapping those in QLatin1String. bugref:9898

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

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

    r93115 r93983  
    9393        while (xmlReader.readNextStartElement())
    9494        {
    95             if (xmlReader.name() == "Counter")
     95            if (xmlReader.name() == QLatin1String("Counter"))
    9696            {
    9797                QXmlStreamAttributes attributes = xmlReader.attributes();
     
    9999                xmlData.push_back(UIDebuggerMetricData(attributes.value("name"), iCounter));
    100100            }
    101             else if (xmlReader.name() == "U64")
     101            else if (xmlReader.name() == QLatin1String("U64"))
    102102            {
    103103                QXmlStreamAttributes attributes = xmlReader.attributes();
  • trunk/src/VBox/Frontends/VirtualBox/src/activity/UIMonitorCommon.h

    r93115 r93983  
    2727    UIDebuggerMetricData()
    2828        : m_counter(0){}
    29     UIDebuggerMetricData(const QStringRef & strName, quint64 counter)
     29#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
     30    UIDebuggerMetricData(const QStringView &strName, quint64 counter)
     31#else
     32    UIDebuggerMetricData(const QStringRef &strName, quint64 counter)
     33#endif
    3034        : m_strName(strName.toString())
    3135        , m_counter(counter){}
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r93982 r93983  
    12791279
    12801280            /* Get the name of the current element: */
     1281#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     1282            const QStringView strElementName = stream.name();
     1283#else
    12811284            const QStringRef strElementName = stream.name();
     1285#endif
    12821286
    12831287            /* Search for the scope ID: */
    12841288            QUuid uLoadingID;
    1285             if (strElementName == "Global")
     1289            if (strElementName == QLatin1String("Global"))
    12861290                uLoadingID = UIExtraDataManager::GlobalID;
    1287             else if (strElementName == "Machine")
     1291            else if (strElementName == QLatin1String("Machine"))
    12881292            {
    12891293                const QXmlStreamAttributes attributes = stream.attributes();
     
    12911295                {
    12921296                    const QString strUuid = attributes.value("uuid").toString();
    1293                     const QUuid uLoadingID = strUuid;
     1297                    const QUuid uLoadingID(strUuid);
    12941298                    if (uLoadingID.isNull())
    12951299                        msgCenter().alert(this, MessageType_Warning,
     
    12991303            }
    13001304            /* Look particular extra-data entries: */
    1301             else if (strElementName == "ExtraDataItem")
     1305            else if (strElementName == QLatin1String("ExtraDataItem"))
    13021306            {
    13031307                const QXmlStreamAttributes attributes = stream.attributes();
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp

    r93982 r93983  
    32863286    m_xmlReader.setDevice(&xmlFile);
    32873287
    3288     if (!m_xmlReader.readNextStartElement() || m_xmlReader.name() != "physicallayout")
     3288    if (!m_xmlReader.readNextStartElement() || m_xmlReader.name() != QLatin1String("physicallayout"))
    32893289        return false;
    32903290    physicalLayout.setFileName(strFileName);
     
    32983298    while (m_xmlReader.readNextStartElement())
    32993299    {
    3300         if (m_xmlReader.name() == "row")
     3300        if (m_xmlReader.name() == QLatin1String("row"))
    33013301            parseRow(iDefaultWidth, iDefaultHeight, rows);
    3302         else if (m_xmlReader.name() == "name")
     3302        else if (m_xmlReader.name() == QLatin1String("name"))
    33033303            physicalLayout.setName(m_xmlReader.readElementText());
    3304         else if (m_xmlReader.name() == "id")
     3304        else if (m_xmlReader.name() == QLatin1String("id"))
    33053305            physicalLayout.setUid(m_xmlReader.readElementText());
    33063306        else
     
    33283328    while (m_xmlReader.readNextStartElement())
    33293329    {
    3330         if (m_xmlReader.name() == "key")
     3330        if (m_xmlReader.name() == QLatin1String("key"))
    33313331            parseKey(row);
    3332         else if (m_xmlReader.name() == "space")
     3332        else if (m_xmlReader.name() == QLatin1String("space"))
    33333333            parseKeySpace(row);
    33343334        else
     
    33463346    while (m_xmlReader.readNextStartElement())
    33473347    {
    3348         if (m_xmlReader.name() == "width")
     3348        if (m_xmlReader.name() == QLatin1String("width"))
    33493349            key.setWidth(m_xmlReader.readElementText().toInt());
    3350         else if (m_xmlReader.name() == "height")
     3350        else if (m_xmlReader.name() == QLatin1String("height"))
    33513351            key.setHeight(m_xmlReader.readElementText().toInt());
    3352         else if (m_xmlReader.name() == "scancode")
     3352        else if (m_xmlReader.name() == QLatin1String("scancode"))
    33533353        {
    33543354            QString strCode = m_xmlReader.readElementText();
     
    33563356            key.setScanCode(strCode.toInt(&fOk, 16));
    33573357        }
    3358         else if (m_xmlReader.name() == "scancodeprefix")
     3358        else if (m_xmlReader.name() == QLatin1String("scancodeprefix"))
    33593359        {
    33603360            QString strCode = m_xmlReader.readElementText();
     
    33733373            }
    33743374        }
    3375         else if (m_xmlReader.name() == "usageid")
     3375        else if (m_xmlReader.name() == QLatin1String("usageid"))
    33763376        {
    33773377            QString strCode = m_xmlReader.readElementText();
     
    33793379            key.setUsageId(strCode.toInt(&fOk, 16));
    33803380        }
    3381         else if (m_xmlReader.name() == "usagepage")
     3381        else if (m_xmlReader.name() == QLatin1String("usagepage"))
    33823382        {
    33833383            QString strCode = m_xmlReader.readElementText();
     
    33853385            key.setUsagePage(strCode.toInt(&fOk, 16));
    33863386        }
    3387         else if (m_xmlReader.name() == "cutout")
     3387        else if (m_xmlReader.name() == QLatin1String("cutout"))
    33883388            parseCutout(key);
    3389         else if (m_xmlReader.name() == "position")
     3389        else if (m_xmlReader.name() == QLatin1String("position"))
    33903390            key.setPosition(m_xmlReader.readElementText().toInt());
    3391         else if (m_xmlReader.name() == "type")
     3391        else if (m_xmlReader.name() == QLatin1String("type"))
    33923392        {
    33933393            QString strType = m_xmlReader.readElementText();
     
    33973397                key.setType(KeyType_Lock);
    33983398        }
    3399         else if (m_xmlReader.name() == "osmenukey")
     3399        else if (m_xmlReader.name() == QLatin1String("osmenukey"))
    34003400        {
    34013401            if (m_xmlReader.readElementText() == "true")
    34023402                key.setIsOSMenuKey(true);
    34033403        }
    3404         else if (m_xmlReader.name() == "staticcaption")
     3404        else if (m_xmlReader.name() == QLatin1String("staticcaption"))
    34053405            key.setStaticCaption(m_xmlReader.readElementText());
    34063406        else
     
    34153415    while (m_xmlReader.readNextStartElement())
    34163416    {
    3417         if (m_xmlReader.name() == "width")
     3417        if (m_xmlReader.name() == QLatin1String("width"))
    34183418            iWidth = m_xmlReader.readElementText().toInt();
    3419         else if (m_xmlReader.name() == "height")
     3419        else if (m_xmlReader.name() == QLatin1String("height"))
    34203420            iHeight = m_xmlReader.readElementText().toInt();
    34213421        else
     
    34383438    while (m_xmlReader.readNextStartElement())
    34393439    {
    3440         if (m_xmlReader.name() == "width")
     3440        if (m_xmlReader.name() == QLatin1String("width"))
    34413441            iWidth = m_xmlReader.readElementText().toInt();
    3442         else if (m_xmlReader.name() == "height")
     3442        else if (m_xmlReader.name() == QLatin1String("height"))
    34433443            iHeight = m_xmlReader.readElementText().toInt();
    3444         else if (m_xmlReader.name() == "corner")
     3444        else if (m_xmlReader.name() == QLatin1String("corner"))
    34453445        {
    34463446            QString strCorner = m_xmlReader.readElementText();
     
    35123512
    35133513/*********************************************************************************************************************************
    3514 *   UIKeyboardLayoutReader implementation.                                                                                  *
     3514*   UIKeyboardLayoutReader implementation.                                                                                       *
    35153515*********************************************************************************************************************************/
    35163516
     
    35293529    m_xmlReader.setDevice(&xmlFile);
    35303530
    3531     if (!m_xmlReader.readNextStartElement() || m_xmlReader.name() != "layout")
     3531    if (!m_xmlReader.readNextStartElement() || m_xmlReader.name() != QLatin1String("layout"))
    35323532        return false;
    35333533
    35343534    while (m_xmlReader.readNextStartElement())
    35353535    {
    3536         if (m_xmlReader.name() == "key")
     3536        if (m_xmlReader.name() == QLatin1String("key"))
    35373537            parseKey(layout);
    3538         else if (m_xmlReader.name() == "name")
     3538        else if (m_xmlReader.name() == QLatin1String("name"))
    35393539            layout.setName(m_xmlReader.readElementText());
    3540         else if (m_xmlReader.name() == "nativename")
     3540        else if (m_xmlReader.name() == QLatin1String("nativename"))
    35413541            layout.setNativeName(m_xmlReader.readElementText());
    3542         else if (m_xmlReader.name() == "physicallayoutid")
     3542        else if (m_xmlReader.name() == QLatin1String("physicallayoutid"))
    35433543            layout.setPhysicalLayoutUuid(QUuid(m_xmlReader.readElementText()));
    3544         else if (m_xmlReader.name() == "id")
     3544        else if (m_xmlReader.name() == QLatin1String("id"))
    35453545            layout.setUid(QUuid(m_xmlReader.readElementText()));
    35463546        else
     
    35563556    while (m_xmlReader.readNextStartElement())
    35573557    {
    3558         if (m_xmlReader.name() == "basecaption")
     3558        if (m_xmlReader.name() == QLatin1String("basecaption"))
    35593559        {
    35603560            keyCaptions.m_strBase = m_xmlReader.readElementText();
    35613561            keyCaptions.m_strBase.replace("\\n", "\n");
    35623562        }
    3563         else if (m_xmlReader.name() == "shiftcaption")
     3563        else if (m_xmlReader.name() == QLatin1String("shiftcaption"))
    35643564        {
    35653565            keyCaptions.m_strShift = m_xmlReader.readElementText();
    35663566            keyCaptions.m_strShift.replace("\\n", "\n");
    35673567        }
    3568         else if (m_xmlReader.name() == "altgrcaption")
     3568        else if (m_xmlReader.name() == QLatin1String("altgrcaption"))
    35693569        {
    35703570            keyCaptions.m_strAltGr = m_xmlReader.readElementText();
    35713571            keyCaptions.m_strAltGr.replace("\\n", "\n");
    35723572        }
    3573         else if (m_xmlReader.name() == "shiftaltgrcaption")
     3573        else if (m_xmlReader.name() == QLatin1String("shiftaltgrcaption"))
    35743574        {
    35753575            keyCaptions.m_strShiftAltGr = m_xmlReader.readElementText();
    35763576            keyCaptions.m_strShiftAltGr.replace("\\n", "\n");
    35773577        }
    3578         else if (m_xmlReader.name() == "position")
     3578        else if (m_xmlReader.name() == QLatin1String("position"))
    35793579            iKeyPosition = m_xmlReader.readElementText().toInt();
    35803580        else
     
    35863586
    35873587/*********************************************************************************************************************************
    3588 *   UISoftKeyboardStatusBarWidget  implementation.                                                                               *
     3588*   UISoftKeyboardStatusBarWidget implementation.                                                                                *
    35893589*********************************************************************************************************************************/
    35903590
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