VirtualBox

Changeset 101566 in vbox for trunk


Ignore:
Timestamp:
Oct 24, 2023 12:14:07 AM (15 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10450: Get rid of Qt5 stuff; This one is about QMetaType stuff.

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

Legend:

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

    r100604 r101566  
    137137{
    138138    QVariant data = m_itemData.value(UICustomFileSystemModelData_Name, QVariant());
    139 #ifndef VBOX_IS_QT6_OR_LATER /* QVariant/QMetaType ::Type is replaced with QMetaType in Qt6 for canConvert */
    140     if (!data.canConvert(QMetaType::QString))
    141 #else
    142139    if (!data.canConvert(QMetaType(QMetaType::QString)))
    143 #endif
    144140        return QString();
    145141    return data.toString();
     
    437433    if (index.isValid() && role == Qt::EditRole)
    438434    {
    439 #ifndef VBOX_IS_QT6_OR_LATER /* QVariant/QMetaType ::Type is replaced with QMetaType in Qt6 for canConvert */
    440         if (index.column() == 0 && value.canConvert(QMetaType::QString))
    441 #else
    442435        if (index.column() == 0 && value.canConvert(QMetaType(QMetaType::QString)))
    443 #endif
    444436        {
    445437            UICustomFileSystemItem *pItem = static_cast<UICustomFileSystemItem*>(index.internalPointer());
     
    471463            return QVariant();
    472464        /* Format date/time column: */
    473 #ifndef VBOX_IS_QT6_OR_LATER /* QVariant/QMetaType ::Type is replaced with QMetaType in Qt6 for canConvert */
    474         if (item->data(index.column()).canConvert(QMetaType::QDateTime))
    475 #else
    476465        if (item->data(index.column()).canConvert(QMetaType(QMetaType::QDateTime)))
    477 #endif
    478466        {
    479467            QDateTime dateTime = item->data(index.column()).toDateTime();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.cpp

    r100347 r101566  
    9797 * @return QVariant
    9898 */
    99 #ifndef VBOX_IS_QT6_OR_LATER /* QVariant::Type is replaced with QMetaType in Qt6 for retrieveData */
    100 QVariant UIDnDMIMEData::retrieveData(const QString &strMIMEType, QVariant::Type enmType) const
    101 {
    102     /* Acquire QMetaType::Type: */
    103     const QMetaType::Type vaType = (QMetaType::Type)enmType;
    104 
    105     LogFlowFunc(("state=%RU32, curAction=0x%x, defAction=0x%x, mimeType=%s, type=%d (%s)\n",
    106                  m_enmState, m_curAction, m_defAction, strMIMEType.toStdString().c_str(), vaType, QVariant::typeToName(vaType)));
    107 #else
    10899QVariant UIDnDMIMEData::retrieveData(const QString &strMIMEType, QMetaType metaType) const
    109100{
     
    113104    LogFlowFunc(("state=%RU32, curAction=0x%x, defAction=0x%x, mimeType=%s, type=%d (%s)\n",
    114105                 m_enmState, m_curAction, m_defAction, strMIMEType.toStdString().c_str(), vaType, metaType.name()));
    115 #endif
    116106
    117107    int rc = VINF_SUCCESS;
     
    171161                   || vaType == QMetaType::QStringList))
    172162        {
    173 # ifndef VBOX_IS_QT6_OR_LATER /* QVariant is replaced with QMetaType in Qt6 */
    174             LogRel(("DnD: Unsupported data type '%s'\n", QVariant::typeToName(vaType)));
    175 # else
    176163            LogRel(("DnD: Unsupported data type '%s'\n", metaType.name()));
    177 # endif
    178164            rc = VERR_NOT_SUPPORTED;
    179165        }
     
    189175        if (RT_SUCCESS(rc))
    190176        {
    191 #ifndef VBOX_IS_QT6_OR_LATER /* QVariant is replaced with QMetaType in Qt6 */
    192             LogRel3(("DnD: Returning data for MIME type=%s, variant type=%s, rc=%Rrc\n",
    193                      strMIMEType.toStdString().c_str(), QVariant::typeToName(vaData.type()), rc));
    194 #else
    195177            LogRel3(("DnD: Returning data for MIME type=%s, variant type=%s, rc=%Rrc\n",
    196178                     strMIMEType.toStdString().c_str(), metaType.name(), rc));
    197 #endif
    198179
    199180            return vaData;
     
    230211        vaType = QMetaType::UnknownType;
    231212
    232 #ifndef VBOX_IS_QT6_OR_LATER /* QVariant is replaced with QMetaType in Qt6 */
    233     LogFlowFunc(("strMIMEType=%s -> vaType=%s\n", qPrintable(strMIMEType), QVariant::typeToName(vaType)));
    234 #else
    235213    LogFlowFunc(("strMIMEType=%s -> vaType=%s\n", qPrintable(strMIMEType), QMetaType(vaType).name()));
    236 #endif
    237214    return vaType;
    238215}
     
    245222{
    246223    RT_NOREF(strMIMEType);
    247 #ifndef VBOX_IS_QT6_OR_LATER /* QVariant is replaced with QMetaType in Qt6 */
    248     LogFlowFunc(("vecDataSize=%d, strMIMEType=%s vaType=%s\n",
    249                  vecData.size(), qPrintable(strMIMEType), QVariant::typeToName(vaType)));
    250 #else
    251224    LogFlowFunc(("vecDataSize=%d, strMIMEType=%s vaType=%s\n",
    252225                 vecData.size(), qPrintable(strMIMEType), QMetaType(vaType).name()));
    253 #endif
    254226
    255227    int rc = VINF_SUCCESS;
     
    260232        {
    261233            vaData = QVariant::fromValue(QString(reinterpret_cast<const char *>(vecData.constData())));
    262 #ifndef VBOX_IS_QT6_OR_LATER /* type() is replaced with typeId() in Qt6 */
    263             Assert(vaData.type() == QVariant::String);
    264 #else
    265234            Assert(vaData.typeId() == QMetaType::QString);
    266 #endif
    267235
    268236            break;
     
    274242
    275243            vaData = QVariant::fromValue(ba);
    276 #ifndef VBOX_IS_QT6_OR_LATER /* type() is replaced with typeId() in Qt6 */
    277             Assert(vaData.type() == QVariant::ByteArray);
    278 #else
    279244            Assert(vaData.typeId() == QMetaType::QByteArray);
    280 #endif
    281245            break;
    282246        }
     
    297261            {
    298262                QVariant vaURL = QVariant::fromValue(QUrl(strCur));
    299 #ifndef VBOX_IS_QT6_OR_LATER /* type() is replaced with typeId() in Qt6 */
    300                 Assert(vaURL.type() == QVariant::Url);
    301 #else
    302263                Assert(vaURL.typeId() == QMetaType::QUrl);
    303 #endif
    304264                lstVariant.append(vaURL);
    305265            }
    306266
    307267            vaData = QVariant::fromValue(lstVariant);
    308 #ifndef VBOX_IS_QT6_OR_LATER /* type() is replaced with typeId() in Qt6 */
    309             Assert(vaData.type() == QVariant::List);
    310 #else
    311268            Assert(vaData.typeId() == QMetaType::QVariantList);
    312 #endif
    313269            break;
    314270        }
     
    329285#endif
    330286            vaData = QVariant::fromValue(lstString);
    331 #ifndef VBOX_IS_QT6_OR_LATER /* type() is replaced with typeId() in Qt6 */
    332             Assert(vaData.type() == QVariant::StringList);
    333 #else
    334287            Assert(vaData.typeId() == QMetaType::QStringList);
    335 #endif
    336288            break;
    337289        }
     
    339291        default:
    340292        {
    341 #ifndef VBOX_IS_QT6_OR_LATER /* QVariant is replaced with QMetaType in Qt6 */
    342             LogRel2(("DnD: Converting data (%d bytes) from guest to variant type '%s' not supported\n",
    343                      vecData.size(), QVariant::typeToName(vaType) ? QVariant::typeToName(vaType) : "<Invalid>"));
    344 #else
    345293            LogRel2(("DnD: Converting data (%d bytes) from guest to variant type '%s' not supported\n",
    346294                     vecData.size(), QMetaType(vaType).name() ? QMetaType(vaType).name() : "<Invalid>"));
    347 #endif
    348295
    349296            rc = VERR_NOT_SUPPORTED;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.h

    r100347 r101566  
    105105    virtual bool hasFormat(const QString &mimeType) const;
    106106
    107 #ifndef VBOX_IS_QT6_OR_LATER /* QVariant::Type is replaced with QMetaType in Qt6 for retrieveData */
    108     virtual QVariant retrieveData(const QString &strMIMEType, QVariant::Type enmType) const RT_OVERRIDE;
    109 #else
    110107    virtual QVariant retrieveData(const QString &strMIMEType, QMetaType metaType) const RT_OVERRIDE;
    111 #endif
    112108    /** @}  */
    113109
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