修复显示右键菜单可能导致崩溃问题
This commit is contained in:
parent
24ca01368f
commit
c8e515fd74
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -189,11 +189,10 @@ void AppModel::insertData(QVector<DataEntity> &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)
|
||||
|
|
Loading…
Reference in New Issue