Back to index

salome-gui  6.5.0
QtxTreeView.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File:      QtxTreeView.h
00021 // Author:    Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
00022 //
00023 #ifndef QTXTREEVIEW_H
00024 #define QTXTREEVIEW_H
00025 
00026 #include "Qtx.h"
00027 
00028 #ifdef WIN32
00029 #pragma warning( disable:4251 )
00030 #endif
00031 
00032 #include <QTreeView>
00033 
00034 class QTX_EXPORT QtxTreeView : public QTreeView
00035 {
00036   Q_OBJECT
00037 
00038   class Header;
00039 
00040 public:
00041   QtxTreeView( QWidget* = 0 );
00042   QtxTreeView( const bool, QWidget* = 0 );
00043   virtual ~QtxTreeView();
00044 
00045   void     expandLevels( const int );
00046   void     collapseLevels( const int );
00047 
00048   void     expandAll( const QModelIndex& );
00049   void     collapseAll( const QModelIndex& );
00050 
00051   void     setSortMenuEnabled( const bool );
00052   bool     sortMenuEnabled() const;
00053 
00054   void     resizeColumnToEncloseContents( int );
00055 
00056   virtual void setModel( QAbstractItemModel* );
00057 
00058 protected slots:
00059   void     onHeaderClicked( int );
00060   void     rowsAboutToBeRemoved( const QModelIndex&, int, int );
00061   void     selectionChanged( const QItemSelection&, const QItemSelection& );
00062   void     onAppropriate( Qt::Orientation, int, int );
00063   
00064 protected:
00065   void     setOpened( const QModelIndex&, const int, bool );
00066 
00067 signals:
00068   void     sortingEnabled( bool );
00069   void     selectionChanged();
00070 
00071 private:
00072   void     emitSortingEnabled( bool );
00073 
00074   friend class QtxTreeView::Header;
00075 };
00076 
00077 #ifdef WIN32
00078 #pragma warning( default:4251 )
00079 #endif
00080 
00081 #endif // QTXTREEVIEW_H