KDPropertyView Class Reference
[KDPropertyView]

A widget for displaying and editing a collection of (name,value) properties. More...

List of all members.

Public Slots

void expand ()

Public Member Functions

 KDPropertyView (QWidget *parent=0)
void reset ()


Detailed Description

A widget for displaying and editing a collection of (name,value) properties.

This widget follows the Qt model/view design, but most often it will probably be used with the convenient KDPropertyModel model class instead of general QAbstractItemModels.

kdpropertyview.png

Definition at line 31 of file kdpropertyview.h.


Constructor & Destructor Documentation

KDPropertyView::KDPropertyView ( QWidget *  parent = 0  )  [explicit]

Constructor. Creates a KDPropertyView with parent parent.

Definition at line 53 of file kdpropertyview.cpp.

00054   : QTreeView(parent), d()
00055 {
00056   setItemDelegate( new KDPropertyViewDelegate(this) );
00057   setEditTriggers( QAbstractItemView::AllEditTriggers );
00058   setSelectionBehavior( QAbstractItemView::SelectRows );
00059   setSelectionMode( QAbstractItemView::ExtendedSelection );
00060   setTextElideMode(Qt::ElideRight);
00061   //header()->setResizeMode( QHeaderView::Stretch );
00062 }


Member Function Documentation

void KDPropertyView::reset (  ) 

Reimplementation from QTreeView. This expands the first level of categories.

Definition at line 78 of file kdpropertyview.cpp.

00079 {
00080   //qDebug() << "KDPropertyView::reset()";
00081   QTreeView::reset();
00082   /* By default we want all categories at the top level to
00083      be expanded */
00084 
00085   /* Due to a bug in Qt-4.1, we need to do this
00086      delayed.
00087      TODO: Review when 4.1.1 is out.
00088   */
00089   QTimer::singleShot( 0, this, SLOT(expand()) );
00090 }

void KDPropertyView::expand (  )  [slot]

Expands the top level categories

Definition at line 93 of file kdpropertyview.cpp.

00094 {
00095   for( int i = 0; i < model()->rowCount( rootIndex() ); ++i ) {
00096     QModelIndex idx = model()->index( i, 0, rootIndex() );
00097     if( model()->hasChildren(idx) ) {
00098       setExpanded( idx, true );
00099     }
00100   }
00101 }


The documentation for this class was generated from the following files:
Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.net/

http://www.kdab.net/kdtools/