From 24b771550c1b9b1809376bee8ea319f1b27a1788 Mon Sep 17 00:00:00 2001 From: royqh1979 Date: Sun, 24 Oct 2021 12:37:00 +0800 Subject: [PATCH] - fix: the "add bookmark" menu item is not correctly disabled on a bookmarked line --- NEWS.md | 1 + RedPandaIDE/mainwindow.cpp | 2 +- RedPandaIDE/project.cpp | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index c2d73924..ef110f9c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,7 @@ Version 0.7.2 - enhancement: only editor area will receive file drop events - enhancement: change project file's folder by drag and drop in the project view - enhancement: open project file by drag it to the editor area + - fix: the "add bookmark" menu item is not correctly disabled on a bookmarked line Version 0.7.1 - fix: can't add bookmark at a breakpoint line diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 070df811..50292e62 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -2552,7 +2552,7 @@ void MainWindow::onEditorContextMenu(const QPoint &pos) ui->actionBreakpoint_property->setEnabled(editor->hasBreakpoint(line)); ui->actionAdd_bookmark->setEnabled( line>=0 && editor->lines()->count()>0 - && !editor->hasBreakpoint(line) + && !editor->hasBookmark(line) ); ui->actionRemove_Bookmark->setEnabled(editor->hasBookmark(line)); ui->actionModify_Bookmark_Description->setEnabled(editor->hasBookmark(line)); diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index 12ba63dc..d9a395ef 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -1833,8 +1833,10 @@ Qt::ItemFlags ProjectModel::flags(const QModelIndex &index) const if (p==mProject->node().get()) return Qt::ItemIsEnabled | Qt::ItemIsDropEnabled; Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled; - if (p->unitIndex<0) + if (p->unitIndex<0) { flags.setFlag(Qt::ItemIsDropEnabled); + flags.setFlag(Qt::ItemIsDragEnabled,false); + } return flags; } @@ -1948,7 +1950,7 @@ QModelIndex ProjectModel::getParentIndex(FolderNode * node) const return createIndex(row,0,parent.get()); } -bool ProjectModel::canDropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const +bool ProjectModel::canDropMimeData(const QMimeData * data, Qt::DropAction action, int /*row*/, int /*column*/, const QModelIndex &parent) const { if (!data || action != Qt::MoveAction) @@ -1993,7 +1995,7 @@ Qt::DropActions ProjectModel::supportedDropActions() const return Qt::MoveAction; } -bool ProjectModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) +bool ProjectModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int /*row*/, int /*column*/, const QModelIndex &parent) { // check if the action is supported if (!data || action != Qt::MoveAction)