Version: 9.16.0
QtxTreeView.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20// File: QtxTreeView.h
21// Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
22//
23#ifndef QTXTREEVIEW_H
24#define QTXTREEVIEW_H
25
26#include "Qtx.h"
27
28#ifdef WIN32
29#pragma warning( disable:4251 )
30#endif
31
32#include <QTreeView>
33
35{
36 Q_OBJECT
37
38 class Header;
39
40public:
41 QtxTreeView( QWidget* = 0 );
42 QtxTreeView( const bool, QWidget* = 0 );
43 virtual ~QtxTreeView();
44
45 void expandLevels( const int );
46 void collapseLevels( const int );
47
48 void expandAll( const QModelIndex& );
49 void collapseAll( const QModelIndex& );
50
51 void setSortMenuEnabled( const bool );
52 bool sortMenuEnabled() const;
53
54 void resizeColumnToEncloseContents( int );
55
56 virtual void setModel( QAbstractItemModel* );
57
58 virtual void scrollTo(const QModelIndex &index,
59 QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible);
60
61protected slots:
62 void onHeaderClicked( int );
63 void rowsAboutToBeRemoved( const QModelIndex&, int, int );
64 void selectionChanged( const QItemSelection&, const QItemSelection& );
65 void onAppropriate( Qt::Orientation, int, int );
66
67protected:
68 void setOpened( const QModelIndex&, const int, bool );
69
70signals:
71 void sortingEnabled( bool );
73
74private:
75 void emitSortingEnabled( bool );
76
77 friend class QtxTreeView::Header;
78};
79
80#ifdef WIN32
81#pragma warning( default:4251 )
82#endif
83
84#endif // QTXTREEVIEW_H
#define QTX_EXPORT
Definition: Qtx.h:36
Orientation
Orientation.
Definition: SalomePyQt.h:147
Custom tree view header class.
Definition: QtxTreeView.cxx:37
Tree view class with possibility to display columns popup menu.
Definition: QtxTreeView.h:35
void selectionChanged()
Emitted when selection is changed in the tree view.
void sortingEnabled(bool)
Emitted when "Sorting" commans is enabled/disabled from the popup menu.