From 6aa6053adedaf9b6ef23f01fe77b1a53ff1dcdb9 Mon Sep 17 00:00:00 2001 From: Jussi Kuokkanen Date: Mon, 24 Jul 2023 14:40:59 +0300 Subject: [PATCH] edit Assignable with a single click when selected --- src/tuxclocker-qt/widgets/DeviceTreeView.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/tuxclocker-qt/widgets/DeviceTreeView.hpp b/src/tuxclocker-qt/widgets/DeviceTreeView.hpp index bf407a6..9f3e0be 100644 --- a/src/tuxclocker-qt/widgets/DeviceTreeView.hpp +++ b/src/tuxclocker-qt/widgets/DeviceTreeView.hpp @@ -18,16 +18,21 @@ public: //const DeviceModel &deviceModel() {return m_deviceModel;} // TODO: make this more generalized // Defers the complexity to DeviceBrowser + // TODO: this can be handled in the delegate with QAbstractItemDelegate::editorEvent boost::signals2::signal functionEditorRequested; protected: /* Workaround for the retarded behavior of waiting for a double click, you can't even disable it! */ - bool edit(const QModelIndex &index, QAbstractItemView::EditTrigger trigger, - QEvent *event) { - return QTreeView::edit(index, + bool edit(const QModelIndex &index, QAbstractItemView::EditTrigger trigger, + QEvent *event) { + return QTreeView::edit(index, trigger == QAbstractItemView::SelectedClicked ? QAbstractItemView::AllEditTriggers : trigger, event); - } + } + // TODO: allow to start editing with the keyboard + EditTriggers editTriggers() { + return QAbstractItemView::AllEditTriggers; + } private: //DeviceModel &m_deviceModel; DeviceModelDelegate *m_delegate;