diff --git a/plugin-mainmenu/actionview.cpp b/plugin-mainmenu/actionview.cpp index 2c710e217..48e44c6d8 100644 --- a/plugin-mainmenu/actionview.cpp +++ b/plugin-mainmenu/actionview.cpp @@ -186,10 +186,9 @@ bool ActionView::existsAction(QAction const * action) const bool exists = false; for (int row = mModel->rowCount() - 1; 0 <= row; --row) { - const QModelIndex index = mModel->index(row, 0); - if (action->text() == mModel->data(index, Qt::DisplayRole) - && action->toolTip() == mModel->data(index, Qt::ToolTipRole) - ) + auto a = qobject_cast(action); + auto b = qobject_cast(mModel->item(row)->data(ActionRole).value()); + if (a->desktopFile().fileName() == b->desktopFile().fileName()) { exists = true; break; diff --git a/plugin-mainmenu/actionview.h b/plugin-mainmenu/actionview.h index e020a83e8..506dc959b 100644 --- a/plugin-mainmenu/actionview.h +++ b/plugin-mainmenu/actionview.h @@ -74,8 +74,6 @@ class ActionView : public QListView */ void addAction(QAction * action); /*! \brief Check if action already exists in the view/model. - * - * \note The equality is evaluated just on text() & toolTip() */ bool existsAction(QAction const * action) const; /*! \brief Fill the view with all actions from \param menu