File indexing completed on 2024-05-12 16:44:00
0001 /* 0002 SPDX-FileCopyrightText: 2010-2014 Cristian Oneț <onet.cristian@gmail.com> 0003 SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KMYMONEYACCOUNTTREEVIEW_H 0008 #define KMYMONEYACCOUNTTREEVIEW_H 0009 0010 #include "kmm_widgets_export.h" 0011 0012 // ---------------------------------------------------------------------------- 0013 // QT Includes 0014 0015 #include <QTreeView> 0016 0017 // ---------------------------------------------------------------------------- 0018 // KDE Includes 0019 0020 // ---------------------------------------------------------------------------- 0021 // Project Includes 0022 0023 class MyMoneyObject; 0024 class AccountsViewProxyModel; 0025 0026 namespace eAccountsModel { 0027 enum class Column; 0028 } 0029 namespace eView { 0030 enum class Intent; 0031 } 0032 enum class View; 0033 0034 /** 0035 * This view was created to handle the actions that could be performed with the accounts. 0036 */ 0037 class KMyMoneyAccountTreeViewPrivate; 0038 class KMM_WIDGETS_EXPORT KMyMoneyAccountTreeView : public QTreeView 0039 { 0040 Q_OBJECT 0041 Q_DISABLE_COPY(KMyMoneyAccountTreeView) 0042 0043 public: 0044 explicit KMyMoneyAccountTreeView(QWidget* parent = nullptr); 0045 ~KMyMoneyAccountTreeView(); 0046 0047 AccountsViewProxyModel *init(View view); 0048 0049 protected: 0050 void mouseDoubleClickEvent(QMouseEvent *event) override; 0051 void keyPressEvent(QKeyEvent *event) override; 0052 0053 protected Q_SLOTS: 0054 void customContextMenuRequested(const QPoint); 0055 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override; 0056 0057 Q_SIGNALS: 0058 void selectByObject(const MyMoneyObject&, eView::Intent); 0059 void selectByVariant(const QVariantList&, eView::Intent); 0060 void returnPressed(); 0061 0062 private: 0063 KMyMoneyAccountTreeViewPrivate * const d_ptr; 0064 Q_DECLARE_PRIVATE(KMyMoneyAccountTreeView) 0065 0066 private Q_SLOTS: 0067 void slotColumnToggled(const eAccountsModel::Column column, const bool show); 0068 }; 0069 0070 #endif // KMYMONEYACCOUNTTREEVIEW_H