Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxTreeView.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, 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 
40 public:
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 protected slots:
59  void onHeaderClicked( int );
60  void rowsAboutToBeRemoved( const QModelIndex&, int, int );
61  void selectionChanged( const QItemSelection&, const QItemSelection& );
62  void onAppropriate( Qt::Orientation, int, int );
63 
64 protected:
65  void setOpened( const QModelIndex&, const int, bool );
66 
67 signals:
68  void sortingEnabled( bool );
69  void selectionChanged();
70 
71 private:
72  void emitSortingEnabled( bool );
73 
74  friend class QtxTreeView::Header;
75 };
76 
77 #ifdef WIN32
78 #pragma warning( default:4251 )
79 #endif
80 
81 #endif // QTXTREEVIEW_H