diff --git a/src/menu/menu-manager.cpp b/src/menu/menu-manager.cpp index 9b758d5..c0b398b 100644 --- a/src/menu/menu-manager.cpp +++ b/src/menu/menu-manager.cpp @@ -226,7 +226,7 @@ void MenuManager::showMenu(const DataEntity &entity, const QPoint &point) showMenu(MenuProvider::DataType, QVariant::fromValue(entity), point); } -void MenuManager::showMenu(const MenuProvider::RequestType &type, const QVariant &data, const QPoint &point) +void MenuManager::showMenu(const MenuProvider::RequestType &type, QVariant data, const QPoint &point) { QMenu menu; diff --git a/src/menu/menu-manager.h b/src/menu/menu-manager.h index 935e26e..e15f455 100644 --- a/src/menu/menu-manager.h +++ b/src/menu/menu-manager.h @@ -38,7 +38,7 @@ public: void registerMenuProvider(MenuProvider *provider); Q_INVOKABLE void showMenu(const QString &appid, const QPoint &point = QPoint()); void showMenu(const DataEntity &entity, const QPoint &point = QPoint()); - void showMenu(const MenuProvider::RequestType &type, const QVariant &data, const QPoint &point = QPoint()); + void showMenu(const MenuProvider::RequestType &type, QVariant data, const QPoint &point = QPoint()); private: MenuManager(); diff --git a/src/model/app-model.cpp b/src/model/app-model.cpp index 2e56065..4e3ae88 100644 --- a/src/model/app-model.cpp +++ b/src/model/app-model.cpp @@ -189,11 +189,10 @@ void AppModel::insertData(QVector &data, int index) void AppModel::openMenu(const int &index) { - if (index < 0 || index >= m_apps.size()) { - return; + QModelIndex modelIndex = createIndex(index, 0, nullptr); + if (modelIndex.isValid()) { + MenuManager::instance()->showMenu(modelIndex.data(DataEntity::Id).toString()); } - - MenuManager::instance()->showMenu(m_apps.at(index)); } void AppModel::renameFolder(const QString &index, const QString &folderName)