File indexing completed on 2024-04-21 03:57:21
0001 /* 0002 SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org> 0003 SPDX-FileCopyrightText: 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KATECOMPLETIONTREE_H 0009 #define KATECOMPLETIONTREE_H 0010 0011 #include <QTreeView> 0012 0013 class KateCompletionWidget; 0014 class KateCompletionModel; 0015 0016 class QTimer; 0017 0018 class KateCompletionTree final : public QTreeView 0019 { 0020 public: 0021 explicit KateCompletionTree(KateCompletionWidget *parent); 0022 0023 KateCompletionWidget *widget() const; 0024 KateCompletionModel *kateModel() const; 0025 0026 void resizeColumns(bool firstShow = false, bool forceResize = false); 0027 0028 int sizeHintForColumn(int column) const override 0029 { 0030 return columnWidth(column); 0031 } 0032 0033 // Navigation 0034 bool nextCompletion(); 0035 bool previousCompletion(); 0036 bool pageDown(); 0037 bool pageUp(); 0038 void top(); 0039 void bottom(); 0040 0041 void scheduleUpdate(); 0042 0043 void setScrollingEnabled(bool); 0044 0045 private: 0046 void resizeColumnsSlot(); 0047 0048 protected: 0049 void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override; /// Not available as a signal in this way 0050 void scrollContentsBy(int dx, int dy) override; 0051 void initViewItemOption(QStyleOptionViewItem *option) const override; 0052 0053 private: 0054 bool m_scrollingEnabled; 0055 QTimer *m_resizeTimer; 0056 }; 0057 0058 #endif