From a32d7866c0eacee95df1bf811c59b05ec7d25062 Mon Sep 17 00:00:00 2001 From: pascal Date: Mon, 21 Oct 2024 08:32:28 +0200 Subject: [PATCH] Better project edit --- src/views/perioddetailview.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/views/perioddetailview.cpp b/src/views/perioddetailview.cpp index 0648e65..86c8c94 100644 --- a/src/views/perioddetailview.cpp +++ b/src/views/perioddetailview.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -94,9 +95,11 @@ class ProjectItemDelegate final : public QStyledItemDelegate void setEditorData(QWidget* const editor, const QModelIndex& index) const override { + auto& combo_box = dynamic_cast(*editor); if (const auto* const project = interval(index).project(); project != nullptr) { - dynamic_cast(*editor).setCurrentText(project->name()); + combo_box.setCurrentText(project->name()); } + combo_box.lineEdit()->selectAll(); } void setModelData(QWidget* const editor, QAbstractItemModel* const model, const QModelIndex& index) const override