File indexing completed on 2024-05-12 05:07:59
0001 /* 0002 SPDX-FileCopyrightText: 2020 Thomas Baumgart <tbaumgart@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef KMYMONEYTREEVIEW_H 0007 #define KMYMONEYTREEVIEW_H 0008 0009 #include "kmm_base_widgets_export.h" 0010 0011 // ---------------------------------------------------------------------------- 0012 // QT Includes 0013 0014 #include <QTreeView> 0015 0016 // ---------------------------------------------------------------------------- 0017 // KDE Includes 0018 0019 // ---------------------------------------------------------------------------- 0020 // Project Includes 0021 0022 /** 0023 * This class overrides a standard QTreeView in such a way that 0024 * it emits the signal startEdit upon a mouse double click event 0025 * or a Return/Enter key press and suppresses further processing 0026 * of the event. 0027 */ 0028 class KMM_BASE_WIDGETS_EXPORT KMyMoneyTreeView : public QTreeView 0029 { 0030 Q_OBJECT 0031 Q_DISABLE_COPY(KMyMoneyTreeView) 0032 0033 public: 0034 explicit KMyMoneyTreeView(QWidget* parent = nullptr); 0035 ~KMyMoneyTreeView(); 0036 0037 protected: 0038 void mouseDoubleClickEvent(QMouseEvent *event) override; 0039 void keyPressEvent(QKeyEvent *event) override; 0040 0041 Q_SIGNALS: 0042 void startEdit(const QModelIndex& idx); 0043 }; 0044 0045 #endif // KMYMONEYTREEVIEW_H