- fix: the "add bookmark" menu item is not correctly disabled on a bookmarked line

This commit is contained in:
royqh1979 2021-10-24 12:37:00 +08:00
parent ff54e6c0e2
commit 24b771550c
3 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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));

View File

@ -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)