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