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

kdgantt2

  • sources
  • kde-4.14
  • kdepim
  • kdgantt2
kdganttdatetimegrid.h
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 #ifndef KDGANTTDATETIMEGRID_H
26 #define KDGANTTDATETIMEGRID_H
27 
28 #include "kdganttabstractgrid.h"
29 
30 #include <QDateTime>
31 #include <QSet>
32 
33 namespace KDGantt {
34  class KDGANTT_EXPORT DateTimeScaleFormatter
35  {
36  KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( DateTimeScaleFormatter )
37  public:
38  enum Range
39  {
40  Second,
41  Minute,
42  Hour,
43  Day,
44  Week,
45  Month,
46  Year
47  };
48  DateTimeScaleFormatter( Range range, const QString& formatString,
49  Qt::Alignment alignment = Qt::AlignCenter );
50  DateTimeScaleFormatter( Range range, const QString& formatString,
51  const QString& templ, Qt::Alignment alignment = Qt::AlignCenter );
52  DateTimeScaleFormatter( const DateTimeScaleFormatter& other );
53  virtual ~DateTimeScaleFormatter();
54 
55  DateTimeScaleFormatter& operator=( const DateTimeScaleFormatter& other );
56 
57  QString format() const;
58  Range range() const;
59  Qt::Alignment alignment() const;
60 
61  virtual QDateTime nextRangeBegin( const QDateTime& datetime ) const;
62  virtual QDateTime currentRangeBegin( const QDateTime& datetime ) const;
63 
64  QString format( const QDateTime& datetime ) const;
65  virtual QString text( const QDateTime& datetime ) const;
66  };
67 
68 
69  class KDGANTT_EXPORT DateTimeGrid : public AbstractGrid {
70  Q_OBJECT
71  KDGANTT_DECLARE_PRIVATE_DERIVED( DateTimeGrid )
72  public:
73  enum Scale { ScaleAuto,
74  ScaleHour,
75  ScaleDay,
76  ScaleWeek,
77  ScaleMonth,
78  ScaleUserDefined
79  };
80 
81  DateTimeGrid();
82  virtual ~DateTimeGrid();
83 
84  QDateTime startDateTime() const;
85  void setStartDateTime( const QDateTime& dt );
86 
87  qreal dayWidth() const;
88  void setDayWidth( qreal );
89 
90  qreal mapFromDateTime( const QDateTime& dt) const;
91  QDateTime mapToDateTime( qreal x ) const;
92 
93  void setWeekStart( Qt::DayOfWeek );
94  Qt::DayOfWeek weekStart() const;
95 
96  void setFreeDays( const QSet<Qt::DayOfWeek>& fd );
97  QSet<Qt::DayOfWeek> freeDays() const;
98 
99  void setScale( Scale s );
100  Scale scale() const;
101 
102  void setUserDefinedLowerScale( DateTimeScaleFormatter* lower );
103  void setUserDefinedUpperScale( DateTimeScaleFormatter* upper );
104  DateTimeScaleFormatter* userDefinedLowerScale() const;
105  DateTimeScaleFormatter* userDefinedUpperScale() const;
106 
107  bool rowSeparators() const;
108  void setRowSeparators( bool enable );
109 
110  void setNoInformationBrush( const QBrush& brush );
111  QBrush noInformationBrush() const;
112 
113  /*reimp*/ Span mapToChart( const QModelIndex& idx ) const;
114  /*reimp*/ bool mapFromChart( const Span& span, const QModelIndex& idx,
115  const QList<Constraint>& constraints=QList<Constraint>() ) const;
116  /*reimp*/ void paintGrid( QPainter* painter,
117  const QRectF& sceneRect, const QRectF& exposedRect,
118  AbstractRowController* rowController = 0,
119  QWidget* widget=0 );
120  /*reimp*/ void paintHeader( QPainter* painter,
121  const QRectF& headerRect, const QRectF& exposedRect,
122  qreal offset, QWidget* widget=0 );
123 
124  protected:
125  virtual void paintHourScaleHeader( QPainter* painter,
126  const QRectF& headerRect, const QRectF& exposedRect,
127  qreal offset, QWidget* widget=0 );
128  virtual void paintDayScaleHeader( QPainter* painter,
129  const QRectF& headerRect, const QRectF& exposedRect,
130  qreal offset, QWidget* widget=0 );
131 
132  virtual void paintUserDefinedHeader( QPainter* painter,
133  const QRectF& headerRect, const QRectF& exposedRect,
134  qreal offset, const DateTimeScaleFormatter* formatter,
135  QWidget* widget = 0 );
136  };
137 }
138 
139 #ifndef QT_NO_DEBUG_STREAM
140 QDebug KDGANTT_EXPORT operator<<( QDebug dbg, KDGantt::DateTimeScaleFormatter::Range );
141 #endif
142 
143 #endif /* KDGANTTDATETIMEGRID_H */
144 
QModelIndex
QWidget
KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC
#define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC(X)
Definition: kdganttglobal.h:121
KDGantt::DateTimeGrid::ScaleHour
Definition: kdganttdatetimegrid.h:74
KDGantt::DateTimeScaleFormatter
Definition: kdganttdatetimegrid.h:34
KDGantt::DateTimeScaleFormatter::Second
Definition: kdganttdatetimegrid.h:40
operator<<
QDebug KDGANTT_EXPORT operator<<(QDebug dbg, KDGantt::DateTimeScaleFormatter::Range)
Definition: kdganttdatetimegrid.cpp:42
KDGantt::DateTimeScaleFormatter::Range
Range
Definition: kdganttdatetimegrid.h:38
kdganttabstractgrid.h
KDGANTT_EXPORT
#define KDGANTT_EXPORT
Definition: kdgantt_export.h:40
QBrush
KDGantt::DateTimeScaleFormatter::Day
Definition: kdganttdatetimegrid.h:43
Qt::Alignment
typedef Alignment
KDGantt::DateTimeGrid::ScaleAuto
Definition: kdganttdatetimegrid.h:73
KDGantt::Span
A class representing a start point and a length.
Definition: kdganttglobal.h:220
KDGantt::AbstractGrid
Abstract baseclass for grids. A grid is used to convert between QModelIndex'es and gantt chart values...
Definition: kdganttabstractgrid.h:40
KDGantt::DateTimeGrid::ScaleMonth
Definition: kdganttdatetimegrid.h:77
QPainter
KDGantt::DateTimeScaleFormatter::Week
Definition: kdganttdatetimegrid.h:44
QSet< Qt::DayOfWeek >
KDGantt::DateTimeGrid::ScaleDay
Definition: kdganttdatetimegrid.h:75
QString
QList
KDGANTT_DECLARE_PRIVATE_DERIVED
#define KDGANTT_DECLARE_PRIVATE_DERIVED(X)
Definition: kdganttglobal.h:59
KDGantt::DateTimeGrid::ScaleWeek
Definition: kdganttdatetimegrid.h:76
KDGantt::DateTimeScaleFormatter::Hour
Definition: kdganttdatetimegrid.h:42
KDGantt::DateTimeGrid::Scale
Scale
Definition: kdganttdatetimegrid.h:73
KDGantt::DateTimeScaleFormatter::Month
Definition: kdganttdatetimegrid.h:45
QDebug
KDGantt::DateTimeScaleFormatter::Minute
Definition: kdganttdatetimegrid.h:41
QRectF
KDGantt::AbstractRowController
Abstract baseclass for row controllers. A row controller is used by the GraphicsView to nagivate the ...
Definition: kdganttabstractrowcontroller.h:34
KDGantt::DateTimeGrid
Definition: kdganttdatetimegrid.h:69
QDateTime
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:29 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
  • pimprint

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