File indexing completed on 2024-10-06 04:26:03
0001 /* 0002 SPDX-FileCopyrightText: 2008 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl> 0004 SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org> 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef _K3B_VIEW_COLUMN_ADJUSTER_H_ 0009 #define _K3B_VIEW_COLUMN_ADJUSTER_H_ 0010 0011 #include <QList> 0012 #include <QObject> 0013 0014 class QEvent; 0015 class QTreeView; 0016 0017 namespace K3b { 0018 class ViewColumnAdjuster : public QObject 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 explicit ViewColumnAdjuster( QObject* parent = 0 ); 0024 explicit ViewColumnAdjuster( QTreeView* parent ); 0025 ~ViewColumnAdjuster() override; 0026 0027 /** 0028 * Takes header into account if not hidden. 0029 */ 0030 int columnSizeHint( int col ) const; 0031 0032 /** 0033 * Sets the view column adjuster operates on. 0034 * Call this *after* calling setModel() on view, 0035 * otherwise column adjuster won't work. 0036 */ 0037 void setView( QTreeView* view ); 0038 void addFixedColumn( int ); 0039 0040 void setColumnMargin( int column, int margin ); 0041 int columnMargin( int column ) const; 0042 0043 bool eventFilter( QObject* watched, QEvent* event ) override; 0044 0045 Q_SIGNALS: 0046 /** 0047 * If something is connected to this slot, adjustColumns 0048 * will not be called automatically. 0049 */ 0050 void columnsNeedAjusting(); 0051 0052 public Q_SLOTS: 0053 void adjustColumns(); 0054 0055 private: 0056 class Private; 0057 Private* const d; 0058 0059 Q_PRIVATE_SLOT( d, void _k_adjustColumns() ) 0060 }; 0061 } 0062 0063 #endif