• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kdgantt2

  • sources
  • kde-4.12
  • kdepim
  • kdgantt2
kdganttlistviewrowcontroller.cpp
Go to the documentation of this file.
1 /****************************************************************************
2  ** Copyright (C) 2001-2006 Klarälvdalens Datakonsult AB. All rights reserved.
3  **
4  ** This file is part of the KD Gantt library.
5  **
6  ** This file may be distributed and/or modified under the terms of the
7  ** GNU General Public License version 2 as published by the Free Software
8  ** Foundation and appearing in the file LICENSE.GPL included in the
9  ** packaging of this file.
10  **
11  ** Licensees holding valid commercial KD Gantt licenses may use this file in
12  ** accordance with the KD Gantt Commercial License Agreement provided with
13  ** the Software.
14  **
15  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17  **
18  ** See http://www.kdab.net/kdgantt for
19  ** information about KD Gantt Commercial License Agreements.
20  **
21  ** Contact info@kdab.net if any conditions of this
22  ** licensing are not clear to you.
23  **
24  **********************************************************************/
25 #include "kdganttlistviewrowcontroller.h"
26 #include "kdganttlistviewrowcontroller_p.h"
27 
28 #include <QAbstractProxyModel>
29 #include <QScrollBar>
30 
31 #include <cassert>
32 
33 using namespace KDGantt;
34 
42 ListViewRowController::ListViewRowController( QListView* lv, QAbstractProxyModel* proxy )
43  : _d( new Private(lv,proxy) )
44 {
45 }
46 
47 ListViewRowController::~ListViewRowController()
48 {
49  delete _d; _d = 0;
50 }
51 
52 #define d d_func()
53 
54 int ListViewRowController::headerHeight() const
55 {
56  return d->listview->viewport()->y()-d->listview->frameWidth();
57 }
58 
59 int ListViewRowController::maximumItemHeight() const
60 {
61  return d->listview->fontMetrics().height();
62 }
63 
64 int ListViewRowController::totalHeight() const
65 {
66  return d->listview->verticalScrollBar()->maximum()+d->listview->viewport()->height();
67 }
68 
69 bool ListViewRowController::isRowVisible( const QModelIndex& _idx ) const
70 {
71  const QModelIndex idx = d->proxy->mapToSource( _idx );
72  assert( idx.isValid() ? ( idx.model() == d->listview->model() ):( true ) );
73  return d->listview->visualRect(idx).isValid();
74 }
75 
76 bool ListViewRowController::isRowExpanded( const QModelIndex& _idx ) const
77 {
78  Q_UNUSED( _idx );
79  return false;
80 }
81 
82 Span ListViewRowController::rowGeometry( const QModelIndex& _idx ) const
83 {
84  const QModelIndex idx = d->proxy->mapToSource( _idx );
85  assert( idx.isValid() ? ( idx.model() == d->listview->model() ):( true ) );
86  QRect r = d->listview->visualRect(idx).translated( QPoint( 0,
87  static_cast<Private::HackListView*>(d->listview)->verticalOffset() ) );
88  return Span( r.y(), r.height() );
89 }
90 
91 QModelIndex ListViewRowController::indexAt( int height ) const
92 {
93  return d->proxy->mapFromSource( d->listview->indexAt( QPoint( 1,height ) ) );
94 }
95 
96 QModelIndex ListViewRowController::indexAbove( const QModelIndex& _idx ) const
97 {
98  const QModelIndex idx = d->proxy->mapToSource( _idx );
99  return d->proxy->mapFromSource( idx.sibling( idx.row()-1, idx.column()) );
100 }
101 
102 QModelIndex ListViewRowController::indexBelow( const QModelIndex& _idx ) const
103 {
104  const QModelIndex idx = d->proxy->mapToSource( _idx );
105  if( !idx.isValid() || idx.column()!=0 ) return QModelIndex();
106  if( idx.model()->rowCount(idx.parent())<idx.row()+1 ) return QModelIndex();
107  return d->proxy->mapFromSource( idx.sibling( idx.row()+1, idx.column()) );
108 }
109 
KDGantt::ListViewRowController::isRowVisible
bool isRowVisible(const QModelIndex &idx) const
Definition: kdganttlistviewrowcontroller.cpp:69
KDGantt::ListViewRowController::maximumItemHeight
int maximumItemHeight() const
Definition: kdganttlistviewrowcontroller.cpp:59
KDGantt::ListViewRowController::indexBelow
QModelIndex indexBelow(const QModelIndex &idx) const
Definition: kdganttlistviewrowcontroller.cpp:102
d
#define d
Definition: kdganttlistviewrowcontroller.cpp:52
KDGantt::Span
A class representing a start point and a length.
Definition: kdganttglobal.h:220
kdganttlistviewrowcontroller_p.h
KDGantt::ListViewRowController::ListViewRowController
ListViewRowController(QListView *lv, QAbstractProxyModel *proxy)
Definition: kdganttlistviewrowcontroller.cpp:42
KDGantt::ListViewRowController::rowGeometry
Span rowGeometry(const QModelIndex &idx) const
Definition: kdganttlistviewrowcontroller.cpp:82
KDGantt::ListViewRowController::indexAt
QModelIndex indexAt(int height) const
Definition: kdganttlistviewrowcontroller.cpp:91
kdganttlistviewrowcontroller.h
KDGantt::ListViewRowController::totalHeight
int totalHeight() const
Definition: kdganttlistviewrowcontroller.cpp:64
KDGantt::ListViewRowController::headerHeight
int headerHeight() const
Definition: kdganttlistviewrowcontroller.cpp:54
QAbstractProxyModel
QListView
KDGantt::ListViewRowController::~ListViewRowController
~ListViewRowController()
Definition: kdganttlistviewrowcontroller.cpp:47
KDGantt::ListViewRowController::isRowExpanded
bool isRowExpanded(const QModelIndex &idx) const
Definition: kdganttlistviewrowcontroller.cpp:76
KDGantt::ListViewRowController::indexAbove
QModelIndex indexAbove(const QModelIndex &idx) const
Definition: kdganttlistviewrowcontroller.cpp:96
KDGantt::ListViewRowController::Private
Definition: kdganttlistviewrowcontroller_p.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:05 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdgantt2

Skip menu "kdgantt2"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal