KGantt

kganttabstractrowcontroller.h
1 /*
2  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KGantt library.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef KGANTTABSTRACTROWCONTROLLER_H
10 #define KGANTTABSTRACTROWCONTROLLER_H
11 
12 #include <QPair>
13 #include "kganttglobal.h"
14 
15 QT_BEGIN_NAMESPACE
16 class QModelIndex;
17 QT_END_NAMESPACE
18 
19 namespace KGantt {
20 
21 
22  /*!\class KGantt::AbstractRowController kganttabstractrowcontroller.h KGanttAbstractRowController
23  * \ingroup KGantt
24  * \brief Abstract baseclass for row controllers. A row controller is used
25  * by the GraphicsView to nagivate the model and to determine the
26  * row geometries
27  */
28  class KGANTT_EXPORT AbstractRowController {
29  public:
30  /*! Constructor. Does nothing */
32 
33  /*! Destructor. Does nothing */
34  virtual ~AbstractRowController();
35 
36  /*!\fn virtual int AbstractRowController::headerHeight() const = 0
37  * \returns The height of the header part of the view.
38  *
39  * Implement this to control how much space is reserved at
40  * the top of the view for a header
41  */
42  virtual int headerHeight() const = 0;
43  virtual int maximumItemHeight() const = 0;
44 
45 
46  /*!\fn virtual int AbstractRowController::totalHeight() const = 0
47  * \returns the total height of the rows. For uniformly sized rows that would be
48  * number_of_rows*row_height.
49  */
50  virtual int totalHeight() const = 0;
51 
52  /*!\fn virtual bool AbstractRowController::isRowVisible( const QModelIndex& idx ) const
53  * \returns true if the row containing index \a idx is visible
54  * in the view.
55  *
56  * Implement this to allow KGantt to optimize how items on
57  * screen are created. It is not harmful to always return true here,
58  * but the View will not perform optimally.
59  */
60  virtual bool isRowVisible( const QModelIndex& idx ) const = 0;
61  virtual bool isRowExpanded( const QModelIndex& idx ) const = 0;
62 
63  /*!\fn virtual Span AbstractRowController::rowGeometry( const QModelIndex& idx ) const
64  * \returns A Span consisting of the row offset and height for the row
65  * containing \a idx. A simple implementation might look like
66  *
67  * \code
68  * Span MyRowCtrlr::rowGeometry(const QModelIndex& idx)
69  * {
70  * return Span(idx.row()*10,10);
71  * }
72  * \endcode
73  */
74  virtual Span rowGeometry( const QModelIndex& idx ) const = 0;
75 
76  virtual QModelIndex indexAt( int height ) const = 0;
77 
78  /*!\fn virtual QModelIndex AbstractRowController::indexAbove( const QModelIndex& idx ) const
79  *\returns The modelindex for the previous row before \a idx.
80  *
81  *\see QTreeView::indexAbove
82  */
83  virtual QModelIndex indexAbove( const QModelIndex& idx ) const = 0;
84 
85 
86  /*!\fn virtual QModelIndex AbstractRowController::indexBelow( const QModelIndex& idx ) const
87  *\returns The modelindex for the next row after \a idx.
88  *
89  *\see QTreeView::indexBelow
90  */
91  virtual QModelIndex indexBelow( const QModelIndex& idx ) const = 0;
92  };
93 }
94 
95 #endif /* KGANTTABSTRACTROWCONTROLLER_H */
96 
Abstract baseclass for row controllers. A row controller is used by the GraphicsView to nagivate the ...
Global namespace.
Contains KGantt macros.
A class representing a start point and a length.
Definition: kganttglobal.h:240
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 22:32:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.