diff --git a/modules/gui/qt/medialibrary/mlbasemodel.cpp b/modules/gui/qt/medialibrary/mlbasemodel.cpp index c3d00d65cb1b3d6d2053557ced3a384c3b0f397f..5af3cd3916c0f70f94bed9509821309b11d72df1 100644 --- a/modules/gui/qt/medialibrary/mlbasemodel.cpp +++ b/modules/gui/qt/medialibrary/mlbasemodel.cpp @@ -52,16 +52,29 @@ void MLBaseModel::sortByColumn(QByteArray name, Qt::SortOrder order) endResetModel(); } -QMap<QString, QVariant> MLBaseModel::getDataAt(int idx) +//------------------------------------------------------------------------------------------------- + +/* Q_INVOKABLE */ QMap<QString, QVariant> MLBaseModel::getDataAt(const QModelIndex & index) { QMap<QString, QVariant> dataDict; - QHash<int,QByteArray> roles = roleNames(); - for (auto role: roles.keys()) { - dataDict[roles[role]] = data(index(idx), role); + + QHash<int, QByteArray> roles = roleNames(); + + for (int role: roles.keys()) + { + dataDict[roles[role]] = data(index, role); } + return dataDict; } +/* Q_INVOKABLE */ QMap<QString, QVariant> MLBaseModel::getDataAt(int idx) +{ + return getDataAt(index(idx)); +} + +//------------------------------------------------------------------------------------------------- + void MLBaseModel::onResetRequested() { beginResetModel(); diff --git a/modules/gui/qt/medialibrary/mlbasemodel.hpp b/modules/gui/qt/medialibrary/mlbasemodel.hpp index 349a75a3fc9e22cfb0cc2f208cf48d02676c38ca..2c54681a4574ce34c7fe83a16d5782da2f140cfb 100644 --- a/modules/gui/qt/medialibrary/mlbasemodel.hpp +++ b/modules/gui/qt/medialibrary/mlbasemodel.hpp @@ -74,7 +74,8 @@ public: // Interface Q_INVOKABLE virtual QVariantList getItemsForIndexes(const QModelIndexList & indexes) const; - Q_INVOKABLE QMap<QString, QVariant> getDataAt(int index); + Q_INVOKABLE QMap<QString, QVariant> getDataAt(const QModelIndex & index); + Q_INVOKABLE QMap<QString, QVariant> getDataAt(int idx); signals: void parentIdChanged();