KDGantt::ListViewRowController Class Reference

#include <kdganttlistviewrowcontroller.h>

Inheritance diagram for KDGantt::ListViewRowController:

Inheritance graph
[legend]
Collaboration diagram for KDGantt::ListViewRowController:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 34 of file kdganttlistviewrowcontroller.h.


Public Member Functions

int headerHeight () const
QModelIndex indexAbove (const QModelIndex &idx) const
QModelIndex indexAt (int height) const
QModelIndex indexBelow (const QModelIndex &idx) const
bool isRowExpanded (const QModelIndex &idx) const
bool isRowVisible (const QModelIndex &idx) const
 ListViewRowController (QListView *lv, QAbstractProxyModel *proxy)
int maximumItemHeight () const
Span rowGeometry (const QModelIndex &idx) const
int totalHeight () const
 ~ListViewRowController ()

Constructor & Destructor Documentation

ListViewRowController::ListViewRowController ( QListView *  lv,
QAbstractProxyModel proxy 
)

Definition at line 42 of file kdganttlistviewrowcontroller.cpp.

00043   : _d( new Private(lv,proxy) )
00044 {
00045 }

ListViewRowController::~ListViewRowController (  ) 

Definition at line 47 of file kdganttlistviewrowcontroller.cpp.

00048 {
00049     delete _d; _d = 0;
00050 }


Member Function Documentation

int ListViewRowController::headerHeight (  )  const [virtual]

Returns:
The height of the header part of the view.
Implement this to control how much space is reserved at the top of the view for a header

Implements KDGantt::AbstractRowController.

Definition at line 54 of file kdganttlistviewrowcontroller.cpp.

References d.

00055 {
00056     return d->listview->viewport()->y()-d->listview->frameWidth();
00057 }

QModelIndex ListViewRowController::indexAbove ( const QModelIndex &  idx  )  const [virtual]

Returns:
The modelindex for the previous row before idx.
See also:
QTreeView::indexAbove

Implements KDGantt::AbstractRowController.

Definition at line 95 of file kdganttlistviewrowcontroller.cpp.

References d.

00096 {
00097     const QModelIndex idx = d->proxy->mapToSource( _idx );
00098     return d->proxy->mapFromSource( idx.sibling( idx.row()-1, idx.column()) );
00099 }

QModelIndex ListViewRowController::indexAt ( int  height  )  const [virtual]

Implements KDGantt::AbstractRowController.

Definition at line 90 of file kdganttlistviewrowcontroller.cpp.

References d.

00091 {
00092     return d->proxy->mapFromSource( d->listview->indexAt( QPoint( 1,height ) ) );
00093 }

QModelIndex ListViewRowController::indexBelow ( const QModelIndex &  idx  )  const [virtual]

Returns:
The modelindex for the next row after idx.
See also:
QTreeView::indexBelow

Implements KDGantt::AbstractRowController.

Definition at line 101 of file kdganttlistviewrowcontroller.cpp.

References d.

00102 {
00103     const QModelIndex idx = d->proxy->mapToSource( _idx );
00104     if( !idx.isValid() || idx.column()!=0 ) return QModelIndex();
00105     if( idx.model()->rowCount(idx.parent())<idx.row()+1 ) return QModelIndex();
00106     return d->proxy->mapFromSource( idx.sibling( idx.row()+1, idx.column()) );
00107 }

bool ListViewRowController::isRowExpanded ( const QModelIndex &  idx  )  const [virtual]

Implements KDGantt::AbstractRowController.

Definition at line 76 of file kdganttlistviewrowcontroller.cpp.

00077 {
00078     return false;
00079 }

bool ListViewRowController::isRowVisible ( const QModelIndex &  idx  )  const [virtual]

Returns:
true if the row containing index idx is visible in the view.
Implement this to allow KDGantt to optimise how items on screen are created. It is not harmful to always return true here, but the View will not perform optimally.

Implements KDGantt::AbstractRowController.

Definition at line 69 of file kdganttlistviewrowcontroller.cpp.

References d.

00070 {
00071     const QModelIndex idx = d->proxy->mapToSource( _idx );
00072     assert( idx.isValid() ? ( idx.model() == d->listview->model() ):( true ) );
00073     return d->listview->visualRect(idx).isValid();
00074 }

int ListViewRowController::maximumItemHeight (  )  const [virtual]

Implements KDGantt::AbstractRowController.

Definition at line 59 of file kdganttlistviewrowcontroller.cpp.

References d.

00060 {
00061     return d->listview->fontMetrics().height();
00062 }

Span ListViewRowController::rowGeometry ( const QModelIndex &  idx  )  const [virtual]

Returns:
A Span consisting of the row offset and height for the row containing idx. A simple implementation might look like
 Span MyRowCtrlr::rowGeometry(const QModelIndex& idx)
 {
      return Span(idx.row()*10,10);
 }

Implements KDGantt::AbstractRowController.

Definition at line 81 of file kdganttlistviewrowcontroller.cpp.

References d, and r.

00082 {
00083     const QModelIndex idx = d->proxy->mapToSource( _idx );
00084     assert( idx.isValid() ? ( idx.model() == d->listview->model() ):( true ) );
00085     QRect r = d->listview->visualRect(idx).translated( QPoint( 0,
00086                   static_cast<Private::HackListView*>(d->listview)->verticalOffset() ) );
00087     return Span( r.y(), r.height() );
00088 }

int ListViewRowController::totalHeight (  )  const [virtual]

Returns:
the total height of the rows. For uniformly sized rows that would be number_of_rows*row_height.

Implements KDGantt::AbstractRowController.

Definition at line 64 of file kdganttlistviewrowcontroller.cpp.

References d.

00065 {
00066     return d->listview->verticalScrollBar()->maximum()+d->listview->viewport()->height();
00067 }


The documentation for this class was generated from the following files:
Generated on Thu Mar 4 23:27:15 2010 for KD Chart 2 by  doxygen 1.5.4