File indexing completed on 2024-12-22 04:40:11

0001 /*
0002     SPDX-FileCopyrightText: 2007-2009 Sergio Pistone <sergio_pistone@yahoo.com.ar>
0003     SPDX-FileCopyrightText: 2010-2022 Mladen Milinkovic <max@smoothware.net>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef TREEVIEW_H
0009 #define TREEVIEW_H
0010 
0011 #include <QTreeView>
0012 
0013 QT_FORWARD_DECLARE_CLASS(QTimer)
0014 
0015 class TreeView : public QTreeView
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     explicit TreeView(QWidget *parent);
0021     virtual ~TreeView();
0022 
0023 public slots:
0024     void setModel(QAbstractItemModel *model) override;
0025 
0026 protected slots:
0027     void onRowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
0028     void onRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
0029 
0030     void updateGeometries() override;
0031 
0032     void onUpdateGeometriesTimeout();
0033 
0034 protected:
0035     QTimer *m_updateGeometriesTimer;
0036     int m_currentModelRows;
0037     int m_instantGeometryUpdate;
0038 };
0039 
0040 #endif