Skip to content

Commit

Permalink
Fix displaying of context menu in task list of todo list dialog if no…
Browse files Browse the repository at this point in the history
… task is present (#1609)
  • Loading branch information
pbek committed Jan 27, 2020
1 parent 24a0880 commit 6df9774
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
(for [#93](https://github.com/pbek/qmarkdowntextedit/pull/93), thank you @Waqar144)
- fixed checking of checkboxes in checkbox lists in the preview
(for [#1607](https://github.com/pbek/QOwnNotes/issues/1607), thank you @Waqar144)
- fixed displaying of context menu in the task list of the todo list dialog
if no task is present (for [#1609](https://github.com/pbek/QOwnNotes/issues/1609))

## 20.1.17
- on Windows the application will now automatically be shown if the the update
Expand Down
7 changes: 6 additions & 1 deletion src/dialogs/tododialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,11 +836,16 @@ void TodoDialog::on_todoItemTreeWidget_itemChanged(QTreeWidgetItem *item, int co
}

void TodoDialog::on_todoItemTreeWidget_customContextMenuRequested(const QPoint &pos) {
QTreeWidgetItem *item = ui->todoItemTreeWidget->currentItem();

if (item == nullptr) {
return;
}

const QPoint globalPos = ui->todoItemTreeWidget->mapToGlobal(pos);
auto *menu = new QMenu();

QAction *newTaskAction = menu->addAction(tr("Create sub-task"));
QTreeWidgetItem *item = ui->todoItemTreeWidget->currentItem();

QAction *selectedItem = menu->exec(globalPos);
if (selectedItem) {
Expand Down

0 comments on commit 6df9774

Please sign in to comment.