#include <kdgantttreeviewrowcontroller.h>
Definition at line 34 of file kdgantttreeviewrowcontroller.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 |
int | maximumItemHeight () const |
Span | rowGeometry (const QModelIndex &idx) const |
int | totalHeight () const |
TreeViewRowController (QTreeView *tv, QAbstractProxyModel *proxy) | |
virtual | ~TreeViewRowController () |
TreeViewRowController::TreeViewRowController | ( | QTreeView * | tv, | |
QAbstractProxyModel * | proxy | |||
) |
Definition at line 41 of file kdgantttreeviewrowcontroller.cpp.
00043 : _d( new Private ) 00044 { 00045 _d->treeview = static_cast<Private::HackTreeView*>(tv); 00046 _d->proxy = proxy; 00047 }
TreeViewRowController::~TreeViewRowController | ( | ) | [virtual] |
int TreeViewRowController::headerHeight | ( | ) | const [virtual] |
Implements KDGantt::AbstractRowController.
Definition at line 56 of file kdgantttreeviewrowcontroller.cpp.
References d.
00057 { 00058 //return d->treeview->header()->sizeHint().height(); 00059 return d->treeview->viewport()->y()-d->treeview->frameWidth(); 00060 }
QModelIndex TreeViewRowController::indexAbove | ( | const QModelIndex & | idx | ) | const [virtual] |
Implements KDGantt::AbstractRowController.
Definition at line 121 of file kdgantttreeviewrowcontroller.cpp.
References d.
00122 { 00123 const QModelIndex idx = d->proxy->mapToSource( _idx ); 00124 return d->proxy->mapFromSource( d->treeview->indexAbove( idx ) ); 00125 }
QModelIndex TreeViewRowController::indexAt | ( | int | height | ) | const [virtual] |
Implements KDGantt::AbstractRowController.
Definition at line 95 of file kdgantttreeviewrowcontroller.cpp.
References d.
00096 { 00097 /* using indexAt( QPoint ) wont work here, since it does hit detection 00098 * against the actual item text/icon, so we would return wrong values 00099 * for items with no text etc. 00100 * 00101 * The code below could cache for performance, but currently it doesn't 00102 * seem to be the performance bottleneck at all. 00103 */ 00104 if ( !d->treeview->model() ) return QModelIndex(); 00105 int y = d->treeview->verticalOffset(); 00106 QModelIndex idx = d->treeview->model()->index( 0, 0, d->treeview->rootIndex() ); 00107 do { 00108 if ( y >= height ) break; 00109 #if QT_VERSION >= 0x040300 00110 y += d->treeview->rowHeight( idx ); 00111 #else 00112 // Since TreeViewRowController is NOT using uniform row height 00113 // we can use this: 00114 y += d->treeview->indexRowSizeHint( idx ); 00115 #endif 00116 idx = d->treeview->indexBelow( idx ); 00117 } while ( idx.isValid() ); 00118 return d->proxy->mapFromSource( idx ); 00119 }
QModelIndex TreeViewRowController::indexBelow | ( | const QModelIndex & | idx | ) | const [virtual] |
Implements KDGantt::AbstractRowController.
Definition at line 127 of file kdgantttreeviewrowcontroller.cpp.
References d.
00128 { 00129 const QModelIndex idx = d->proxy->mapToSource( _idx ); 00130 return d->proxy->mapFromSource( d->treeview->indexBelow( idx ) ); 00131 }
bool TreeViewRowController::isRowExpanded | ( | const QModelIndex & | idx | ) | const [virtual] |
Implements KDGantt::AbstractRowController.
Definition at line 80 of file kdgantttreeviewrowcontroller.cpp.
References d.
00081 { 00082 const QModelIndex idx = d->proxy->mapToSource( _idx ); 00083 assert( idx.isValid() ? ( idx.model() == d->treeview->model() ):( true ) ); 00084 return d->treeview->isExpanded( idx ); 00085 }
bool TreeViewRowController::isRowVisible | ( | const QModelIndex & | idx | ) | const [virtual] |
Implements KDGantt::AbstractRowController.
Definition at line 72 of file kdgantttreeviewrowcontroller.cpp.
References d.
00073 { 00074 //qDebug() << _idx.model()<<d->proxy << d->treeview->model(); 00075 const QModelIndex idx = d->proxy->mapToSource( _idx ); 00076 assert( idx.isValid() ? ( idx.model() == d->treeview->model() ):( true ) ); 00077 return d->treeview->visualRect(idx).isValid(); 00078 }
int TreeViewRowController::maximumItemHeight | ( | ) | const [virtual] |
Implements KDGantt::AbstractRowController.
Definition at line 62 of file kdgantttreeviewrowcontroller.cpp.
References d.
00063 { 00064 return d->treeview->fontMetrics().height(); 00065 }
Span TreeViewRowController::rowGeometry | ( | const QModelIndex & | idx | ) | const [virtual] |
Span MyRowCtrlr::rowGeometry(const QModelIndex& idx) { return Span(idx.row()*10,10); }
Implements KDGantt::AbstractRowController.
Definition at line 87 of file kdgantttreeviewrowcontroller.cpp.
00088 { 00089 const QModelIndex idx = d->proxy->mapToSource( _idx ); 00090 assert( idx.isValid() ? ( idx.model() == d->treeview->model() ):( true ) ); 00091 QRect r = d->treeview->visualRect(idx).translated( QPoint( 0, d->treeview->verticalOffset() ) ); 00092 return Span( r.y(), r.height() ); 00093 }
int TreeViewRowController::totalHeight | ( | ) | const [virtual] |
Implements KDGantt::AbstractRowController.
Definition at line 67 of file kdgantttreeviewrowcontroller.cpp.
References d.
00068 { 00069 return d->treeview->verticalScrollBar()->maximum()+d->treeview->viewport()->height(); 00070 }