9#include "kgantttreeviewrowcontroller.h"
10#include "kgantttreeviewrowcontroller_p.h"
12#include <QAbstractProxyModel>
22TreeViewRowController::TreeViewRowController(
QTreeView* tv,
26 _d->treeview =
static_cast<Private::HackTreeView*
>(tv);
30TreeViewRowController::~TreeViewRowController()
32 delete _d; _d =
nullptr;
40 return d->treeview->viewport()->y()-d->treeview->frameWidth();
43int TreeViewRowController::maximumItemHeight()
const
45 return d->treeview->fontMetrics().height();
50 return d->treeview->verticalScrollBar()->maximum()+d->treeview->viewport()->height();
56 const QModelIndex idx = d->proxy->mapToSource( _idx );
57 assert( idx.
isValid() ? ( idx.
model() == d->treeview->model() ):(
true ) );
58 return d->treeview->visualRect(idx).isValid();
61bool TreeViewRowController::isRowExpanded(
const QModelIndex& _idx )
const
63 const QModelIndex idx = d->proxy->mapToSource( _idx );
64 assert( idx.
isValid() ? ( idx.
model() == d->treeview->model() ):(
true ) );
65 return d->treeview->isExpanded( idx );
70 const QModelIndex idx = d->proxy->mapToSource( _idx );
71 assert( idx.
isValid() ? ( idx.
model() == d->treeview->model() ):(
true ) );
72 QRect r = d->treeview->visualRect(idx).translated(
QPoint( 0, d->treeview->verticalOffset() ) );
76QModelIndex TreeViewRowController::indexAt(
int height )
const
86 int y = d->treeview->verticalOffset();
87 QModelIndex idx = d->treeview->model()->index( 0, 0, d->treeview->rootIndex() );
89 if ( y >= height )
break;
90 y += d->treeview->rowHeight( idx );
91 idx = d->treeview->indexBelow( idx );
93 return d->proxy->mapFromSource( idx );
98 const QModelIndex idx = d->proxy->mapToSource( _idx );
99 return d->proxy->mapFromSource( d->treeview->indexAbove( idx ) );
104 const QModelIndex idx = d->proxy->mapToSource( _idx );
105 return d->proxy->mapFromSource( d->treeview->indexBelow( idx ) );
A class representing a start point and a length.
QModelIndex indexBelow(const QModelIndex &idx) const override
int headerHeight() const override
bool isRowVisible(const QModelIndex &idx) const override
QModelIndex indexAbove(const QModelIndex &idx) const override
int totalHeight() const override
Span rowGeometry(const QModelIndex &idx) const override
bool isValid() const const
const QAbstractItemModel * model() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Sep 27 2024 11:49:41 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.