diff --git a/share/qtcreator/qmldesigner/assetsLibraryQmlSources/Assets.qml b/share/qtcreator/qmldesigner/assetsLibraryQmlSources/Assets.qml index c6f3987b1b1..4f9fe6ac9f3 100644 --- a/share/qtcreator/qmldesigner/assetsLibraryQmlSources/Assets.qml +++ b/share/qtcreator/qmldesigner/assetsLibraryQmlSources/Assets.qml @@ -19,7 +19,7 @@ Item { // Array of supported externally dropped files that trigger custom import process property var dropComplexExtFiles: [] - readonly property int qtVersion6_4: rootView.qtVersionIs6_4() + readonly property int qtVersion: rootView.qtVersion() property bool __searchBoxEmpty: true AssetsContextMenu { diff --git a/share/qtcreator/qmldesigner/assetsLibraryQmlSources/AssetsView.qml b/share/qtcreator/qmldesigner/assetsLibraryQmlSources/AssetsView.qml index f82c89a2880..276dd2e2aef 100644 --- a/share/qtcreator/qmldesigner/assetsLibraryQmlSources/AssetsView.qml +++ b/share/qtcreator/qmldesigner/assetsLibraryQmlSources/AssetsView.qml @@ -308,9 +308,12 @@ TreeView { function __modelIndex(row) { // The modelIndex() function exists since 6.3. In Qt 6.3, this modelIndex() function was a - // member of the TreeView, while in Qt6.4 it was moved to TableView. In Qt6.4, the order of - // the arguments was changed. - if (assetsRoot.qtVersion6_4) + // member of the TreeView, while in Qt6.4 it was moved to TableView. In Qt 6.4, the order of + // the arguments was changed, and in Qt 6.5 the order was changed again. Due to this mess, + // the whole function was deprecated in Qt 6.4.3 and replaced with index() function. + if (assetsRoot.qtVersion >= 0x060403) + return root.index(row, 0) + else if (assetsRoot.qtVersion >= 0x060400) return root.modelIndex(0, row) else return root.modelIndex(row, 0) diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp index f54a94332ce..8778cd77895 100644 --- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp @@ -202,9 +202,9 @@ QString AssetsLibraryWidget::showInGraphicalShellMsg() const return Core::FileUtils::msgGraphicalShellAction(); } -bool AssetsLibraryWidget::qtVersionIs6_4() const +int AssetsLibraryWidget::qtVersion() const { - return QT_VERSION_MAJOR == 6 && QT_VERSION_MINOR == 4; + return QT_VERSION; } void AssetsLibraryWidget::addTextures(const QStringList &filePaths) diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h index a38246ae71b..3221d24a80a 100644 --- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h +++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h @@ -78,7 +78,7 @@ public: Q_INVOKABLE QSet supportedAssetSuffixes(bool complex); Q_INVOKABLE void openEffectMaker(const QString &filePath); - Q_INVOKABLE bool qtVersionIs6_4() const; + Q_INVOKABLE int qtVersion() const; Q_INVOKABLE void invalidateThumbnail(const QString &id); Q_INVOKABLE QSize imageSize(const QString &id); Q_INVOKABLE QString assetFileSize(const QString &id);