File indexing completed on 2025-01-05 04:55:51
0001 /* 0002 ui/treewidget.h 0003 0004 This file is part of libkleopatra 0005 SPDX-FileCopyrightText: 2022 g10 Code GmbH 0006 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de> 0007 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 */ 0010 0011 #pragma once 0012 0013 #include "kleo_export.h" 0014 0015 #include <QTreeWidget> 0016 0017 namespace Kleo 0018 { 0019 0020 /** 0021 * A tree widget that allows accessible column by column keyboard navigation 0022 * and that has customizable columns through a context menu in the header. 0023 * 0024 * This is the QTreeWidget-derived variant of TreeView. 0025 * 0026 * \sa TreeView 0027 */ 0028 class KLEO_EXPORT TreeWidget : public QTreeWidget 0029 { 0030 Q_OBJECT 0031 public: 0032 TreeWidget(QWidget *parent = nullptr); 0033 ~TreeWidget() override; 0034 0035 /** 0036 * Restores the layout state under key @p stateGroupName and enables state 0037 * saving when the object is destroyed. Make sure that @p stateGroupName is 0038 * unique for each place the widget occurs. Returns true if some state was 0039 * restored. If false is returned, no state was restored and the caller should 0040 * apply the default configuration. 0041 */ 0042 bool restoreColumnLayout(const QString &stateGroupName); 0043 Q_SIGNALS: 0044 void columnEnabled(int column); 0045 void columnDisabled(int column); 0046 0047 protected: 0048 bool eventFilter(QObject *watched, QEvent *event) override; 0049 0050 QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override; 0051 0052 private: 0053 class Private; 0054 const std::unique_ptr<Private> d; 0055 }; 0056 0057 }