QmlDesigner: Fix warnings about deprecated function

TableView.modelIndex function was deprecated in Qt 6.4.3 and replaced
with TableView.index function.

Change-Id: I65638c002015c556a78ce6341ebcb3ce6448e825
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2023-03-09 17:17:03 +02:00
parent d9e8228c4a
commit 0c7ae672a2
4 changed files with 10 additions and 7 deletions

View File

@@ -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 {

View File

@@ -309,8 +309,11 @@ TreeView {
{
// 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 Qt 6.4, the order of
// the arguments was changed.
if (assetsRoot.qtVersion6_4)
// 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)

View File

@@ -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)

View File

@@ -78,7 +78,7 @@ public:
Q_INVOKABLE QSet<QString> 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);