KD Chart API Documentation 3.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
KDGantt::DateTimeGrid Class Reference

This implementation of AbstractGrid works with QDateTime and shows days and week numbers in the header. More...

#include <kdganttdatetimegrid.h>

Inheritance diagram for KDGantt::DateTimeGrid:
Inheritance graph
[legend]
Collaboration diagram for KDGantt::DateTimeGrid:
Collaboration graph
[legend]

Public Types

enum  Scale {
  ScaleAuto , ScaleHour , ScaleDay , ScaleWeek ,
  ScaleMonth , ScaleUserDefined
}
 

Public Member Functions

 DateTimeGrid ()
 
 ~DateTimeGrid () override
 
qreal dayWidth () const
 
QSet< Qt::DayOfWeekfreeDays () const
 
QBrush freeDaysBrush () const
 
bool mapFromChart (const Span &span, const QModelIndex &idx, const QList< Constraint > &constraints=QList< Constraint >()) const override
 Maps the supplied Span to QDateTimes, and puts them as start time and end time for the supplied index.
 
QVariant mapFromChart (qreal x) const override
 
qreal mapFromDateTime (const QDateTime &dt) const
 Maps a given point in time dt to an X value in the scene.
 
Span mapToChart (const QModelIndex &idx) const override
 
qreal mapToChart (const QVariant &value) const override
 
QDateTime mapToDateTime (qreal x) const
 Maps a given X value x in scene coordinates to a point in time.
 
QBrush noInformationBrush () const
 
void paintGrid (QPainter *painter, const QRectF &sceneRect, const QRectF &exposedRect, AbstractRowController *rowController=nullptr, QWidget *widget=nullptr) override
 Implement this to paint the background of the view – typically with some grid lines.
 
void paintHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr) override
 Implement this to paint the header part of the view.
 
bool rowSeparators () const
 
Scale scale () const
 
void setDayWidth (qreal)
 
void setFreeDays (const QSet< Qt::DayOfWeek > &fd)
 
void setFreeDaysBrush (const QBrush brush)
 Sets the brush to use to paint free days.
 
void setNoInformationBrush (const QBrush &brush)
 Sets the brush used to display rows where no data is found.
 
void setRowSeparators (bool enable)
 
void setScale (Scale s)
 
void setStartDateTime (const QDateTime &dt)
 
void setUserDefinedLowerScale (DateTimeScaleFormatter *lower)
 Sets the scale formatter for the lower part of the header to the user defined formatter to lower.
 
void setUserDefinedUpperScale (DateTimeScaleFormatter *upper)
 Sets the scale formatter for the upper part of the header to the user defined formatter to upper.
 
void setWeekStart (Qt::DayOfWeek)
 
QDateTime startDateTime () const
 
DateTimeScaleFormatteruserDefinedLowerScale () const
 
DateTimeScaleFormatteruserDefinedUpperScale () const
 
Qt::DayOfWeek weekStart () const
 
- Public Member Functions inherited from KDGantt::AbstractGrid
 AbstractGrid (QObject *parent=nullptr)
 Constructor.
 
 ~AbstractGrid () override
 Destructor.
 
bool isSatisfiedConstraint (const Constraint &c) const
 
QAbstractItemModelmodel () const
 
QModelIndex rootIndex () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< TfindChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< TfindChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< TfindChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
T qFindChild (const QObject *obj, const QString &name)
 
QList< TqFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< TqFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

QRectF computeRect (const QDateTime &from, const QDateTime &to, const QRectF &rect) const
 
QPair< QDateTime, QDateTimedateTimeRange (const QRectF &rect) const
 
void drawBackground (QPainter *paint, const QRectF &rect) override
 
virtual void drawDayBackground (QPainter *painter, const QRectF &rect, const QDate &date)
 Draw the background for a day.
 
virtual void drawDayForeground (QPainter *painter, const QRectF &rect, const QDate &date)
 Draw the foreground for a day.
 
void drawForeground (QPainter *paint, const QRectF &rect) override
 
virtual void paintDayScaleHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr)
 Paints the day scale header.
 
virtual void paintHourScaleHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr)
 Paints the hour scale header.
 
virtual void paintMonthScaleHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr)
 Paints the week scale header.
 
virtual void paintUserDefinedHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, const DateTimeScaleFormatter *formatter, QWidget *widget=nullptr)
 
virtual void paintWeekScaleHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr)
 Paints the week scale header.
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Public Slots inherited from KDGantt::AbstractGrid
virtual void setModel (QAbstractItemModel *model)
 Sets the QAbstractItemModel used by this grid implementation.
 
virtual void setRootIndex (const QModelIndex &idx)
 Sets the root index used by this grid implementation.
 
- Signals inherited from KDGantt::AbstractGrid
void gridChanged ()
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Properties inherited from QObject
 objectName
 

Detailed Description

This implementation of AbstractGrid works with QDateTime and shows days and week numbers in the header.

Definition at line 23 of file kdganttdatetimegrid.h.

Member Enumeration Documentation

◆ Scale

Enumerator
ScaleAuto 
ScaleHour 
ScaleDay 
ScaleWeek 
ScaleMonth 
ScaleUserDefined 

Definition at line 28 of file kdganttdatetimegrid.h.

Constructor & Destructor Documentation

◆ DateTimeGrid()

DateTimeGrid::DateTimeGrid ( )

Definition at line 288 of file kdganttdatetimegrid.cpp.

◆ ~DateTimeGrid()

DateTimeGrid::~DateTimeGrid ( )
override

Definition at line 293 of file kdganttdatetimegrid.cpp.

Member Function Documentation

◆ computeRect()

QRectF DateTimeGrid::computeRect ( const QDateTime from,
const QDateTime to,
const QRectF rect 
) const
protected

Return the rectangle that represents the date-range.

Definition at line 1237 of file kdganttdatetimegrid.cpp.

References d, QRectF::height(), QObject::qobject_cast(), and QRectF::top().

◆ dateTimeRange()

QPair< QDateTime, QDateTime > DateTimeGrid::dateTimeRange ( const QRectF rect) const
protected

Return a date-range represented by the rectangle.

Definition at line 1247 of file kdganttdatetimegrid.cpp.

References d, QRectF::left(), and QRectF::right().

◆ dayWidth()

qreal DateTimeGrid::dayWidth ( ) const
Returns
The width in pixels for each day in the grid.

The default is 100 pixels.

Definition at line 321 of file kdganttdatetimegrid.cpp.

References d.

Referenced by drawBackground(), drawForeground(), and paintGrid().

◆ drawBackground()

void DateTimeGrid::drawBackground ( QPainter paint,
const QRectF rect 
)
overrideprotectedvirtual

◆ drawDayBackground()

void DateTimeGrid::drawDayBackground ( QPainter painter,
const QRectF rect,
const QDate date 
)
protectedvirtual

Draw the background for a day.

Definition at line 1219 of file kdganttdatetimegrid.cpp.

References QObject::qobject_cast().

Referenced by drawBackground().

◆ drawDayForeground()

void DateTimeGrid::drawDayForeground ( QPainter painter,
const QRectF rect,
const QDate date 
)
protectedvirtual

Draw the foreground for a day.

Definition at line 1228 of file kdganttdatetimegrid.cpp.

References QObject::qobject_cast().

Referenced by drawForeground().

◆ drawForeground()

void DateTimeGrid::drawForeground ( QPainter paint,
const QRectF rect 
)
overrideprotectedvirtual

◆ freeDays()

QSet< Qt::DayOfWeek > DateTimeGrid::freeDays ( ) const
Returns
The days marked as free in the grid.

Definition at line 454 of file kdganttdatetimegrid.cpp.

References d.

◆ freeDaysBrush()

QBrush DateTimeGrid::freeDaysBrush ( ) const
Returns
The brush used to paint free days.

Definition at line 469 of file kdganttdatetimegrid.cpp.

References d.

◆ mapFromChart() [1/2]

bool DateTimeGrid::mapFromChart ( const Span span,
const QModelIndex idx,
const QList< Constraint > &  constraints = QList<Constraint>() 
) const
overridevirtual

Maps the supplied Span to QDateTimes, and puts them as start time and end time for the supplied index.

Parameters
spanThe span used to map from.
idxThe index used for setting the start time and end time in the model.
constraintsA list of hard constraints to match against the start time and end time mapped from the span.
Returns
true if the start time and time was successfully added to the model, or false if unsuccessful. Also returns false if any of the constraints isn't satisfied. That is, if the start time of the constrained index is before the end time of the dependency index, or the end time of the constrained index is before the start time of the dependency index.

Implements KDGantt::AbstractGrid.

Definition at line 582 of file kdganttdatetimegrid.cpp.

References d, QAbstractItemModel::data(), KDGantt::EndTimeRole, QVariant::fromValue(), KDGantt::AbstractGrid::isSatisfiedConstraint(), KDGantt::Span::length(), KDGantt::AbstractGrid::model(), QObject::qobject_cast(), QAbstractItemModel::setData(), KDGantt::Span::start(), KDGantt::StartTimeRole, QVariant::toDateTime(), and KDGantt::Constraint::TypeHard.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

◆ mapFromChart() [2/2]

QVariant DateTimeGrid::mapFromChart ( qreal  x) const
overridevirtual
Parameters
xThe x value get the datetime for.
Returns
The datetime corresponding to x or an invalid datetime if x cannot be mapped.

Reimplemented from KDGantt::AbstractGrid.

Definition at line 518 of file kdganttdatetimegrid.cpp.

References d.

◆ mapFromDateTime()

qreal DateTimeGrid::mapFromDateTime ( const QDateTime dt) const

Maps a given point in time dt to an X value in the scene.

Definition at line 328 of file kdganttdatetimegrid.cpp.

References d, and QObject::qobject_cast().

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

◆ mapToChart() [1/2]

Span DateTimeGrid::mapToChart ( const QModelIndex idx) const
overridevirtual
Parameters
idxThe index to get the Span for.
Returns
The start and end pixels, in a Span, of the specified index.

Implements KDGantt::AbstractGrid.

Definition at line 526 of file kdganttdatetimegrid.cpp.

References d, QAbstractItemModel::data(), QVariant::DateTime, KDGantt::EndTimeRole, KDGantt::AbstractGrid::model(), QObject::qobject_cast(), KDGantt::StartTimeRole, and QVariant::String.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

◆ mapToChart() [2/2]

qreal DateTimeGrid::mapToChart ( const QVariant value) const
overridevirtual
Parameters
valueThe datetime to get the x value for.
Returns
The x value corresponding to value or -1.0 if value is not a datetime variant.

Reimplemented from KDGantt::AbstractGrid.

Definition at line 506 of file kdganttdatetimegrid.cpp.

References QVariant::canConvert(), d, QVariant::DateTime, QString::isEmpty(), QVariant::String, QVariant::toDateTime(), QVariant::toString(), and QVariant::type().

◆ mapToDateTime()

QDateTime DateTimeGrid::mapToDateTime ( qreal  x) const

Maps a given X value x in scene coordinates to a point in time.

Definition at line 335 of file kdganttdatetimegrid.cpp.

References d.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

◆ noInformationBrush()

QBrush DateTimeGrid::noInformationBrush ( ) const
Returns
the brush used to mark rows with no information.

Definition at line 497 of file kdganttdatetimegrid.cpp.

References d.

◆ paintDayScaleHeader()

void DateTimeGrid::paintDayScaleHeader ( QPainter painter,
const QRectF headerRect,
const QRectF exposedRect,
qreal  offset,
QWidget widget = nullptr 
)
protectedvirtual

Paints the day scale header.

See also
paintHeader()

Definition at line 1062 of file kdganttdatetimegrid.cpp.

References d, QString::fromLatin1(), QString::number(), QObject::qobject_cast(), QRectF::toAlignedRect(), and QRectF::toRect().

Referenced by paintHeader().

◆ paintGrid()

void DateTimeGrid::paintGrid ( QPainter painter,
const QRectF sceneRect,
const QRectF exposedRect,
AbstractRowController rowController = nullptr,
QWidget widget = nullptr 
)
overridevirtual

Implement this to paint the background of the view – typically with some grid lines.

Parameters
painter– the QPainter to paint with.
sceneRect– the total bounding rectangle of the scene.
exposedRect– the rectangle that needs to be painted.
rowController– the row controller used by the view – may be 0.
widget– the widget used by the view – may be 0.

Implements KDGantt::AbstractGrid.

Definition at line 772 of file kdganttdatetimegrid.cpp.

References d, Qt::DashLine, dayWidth(), QPainter::drawLine(), QPainter::fillRect(), QApplication::fontMetrics(), QFontMetrics::horizontalAdvance(), KDGantt::AbstractRowController::indexAbove(), KDGantt::AbstractRowController::indexAt(), KDGantt::AbstractRowController::indexBelow(), QModelIndex::isValid(), KDGantt::ItemTypeRole, QRectF::left(), Qt::NoBrush, QGuiApplication::palette(), QPainter::pen(), QObject::qobject_cast(), QRectF::right(), KDGantt::AbstractRowController::rowGeometry(), scale(), ScaleAuto, ScaleDay, ScaleHour, ScaleMonth, ScaleUserDefined, ScaleWeek, QPen::setBrush(), QPainter::setPen(), QPen::setStyle(), and KDGantt::Span::start().

◆ paintHeader()

void DateTimeGrid::paintHeader ( QPainter painter,
const QRectF headerRect,
const QRectF exposedRect,
qreal  offset,
QWidget widget = nullptr 
)
overridevirtual

Implement this to paint the header part of the view.

Parameters
painter– the QPainter to paint with.
headerRect– the total rectangle occupied by the header.
exposedRect– the rectangle that needs to be painted.
offset– the horizontal scroll offset of the view.
widget– the widget used by the view – may be 0.

Implements KDGantt::AbstractGrid.

Definition at line 876 of file kdganttdatetimegrid.cpp.

References QPainterPath::addRect(), d, Qt::IntersectClip, paintDayScaleHeader(), paintHourScaleHeader(), paintMonthScaleHeader(), paintUserDefinedHeader(), paintWeekScaleHeader(), QObject::qobject_cast(), QPainter::restore(), QPainter::save(), scale(), ScaleAuto, ScaleDay, ScaleHour, ScaleMonth, ScaleUserDefined, ScaleWeek, QPainter::setClipPath(), startDateTime(), and KDGantt::DateTimeScaleFormatter::text().

◆ paintHourScaleHeader()

void DateTimeGrid::paintHourScaleHeader ( QPainter painter,
const QRectF headerRect,
const QRectF exposedRect,
qreal  offset,
QWidget widget = nullptr 
)
protectedvirtual

Paints the hour scale header.

See also
paintHeader()

Definition at line 1009 of file kdganttdatetimegrid.cpp.

References d, QString::fromLatin1(), QObject::qobject_cast(), QRectF::toAlignedRect(), and QRectF::toRect().

Referenced by paintHeader().

◆ paintMonthScaleHeader()

void DateTimeGrid::paintMonthScaleHeader ( QPainter painter,
const QRectF headerRect,
const QRectF exposedRect,
qreal  offset,
QWidget widget = nullptr 
)
protectedvirtual

Paints the week scale header.

See also
paintHeader()

Definition at line 1171 of file kdganttdatetimegrid.cpp.

References d, QLocale::monthName(), QString::number(), QObject::qobject_cast(), QLocale::ShortFormat, and QRectF::toRect().

Referenced by paintHeader().

◆ paintUserDefinedHeader()

void DateTimeGrid::paintUserDefinedHeader ( QPainter painter,
const QRectF headerRect,
const QRectF exposedRect,
qreal  offset,
const DateTimeScaleFormatter formatter,
QWidget widget = nullptr 
)
protectedvirtual

◆ paintWeekScaleHeader()

void DateTimeGrid::paintWeekScaleHeader ( QPainter painter,
const QRectF headerRect,
const QRectF exposedRect,
qreal  offset,
QWidget widget = nullptr 
)
protectedvirtual

Paints the week scale header.

See also
paintHeader()

Definition at line 1120 of file kdganttdatetimegrid.cpp.

References d, QLocale::LongFormat, QLocale::monthName(), QString::number(), QObject::qobject_cast(), and QRectF::toRect().

Referenced by paintHeader().

◆ rowSeparators()

bool DateTimeGrid::rowSeparators ( ) const
Returns
true if row separators are used.

Definition at line 475 of file kdganttdatetimegrid.cpp.

References d.

◆ scale()

DateTimeGrid::Scale DateTimeGrid::scale ( ) const
Returns
The scale used to paint the grid.

The default is ScaleAuto, which means the day scale will be used as long as the day width is less or equal to 500.

See also
Scale

Definition at line 377 of file kdganttdatetimegrid.cpp.

References d.

Referenced by paintGrid(), and paintHeader().

◆ setDayWidth()

void DateTimeGrid::setDayWidth ( qreal  w)
Parameters
wThe width in pixels for each day in the grid.

The signal gridChanged() is emitted after the day width is changed.

Definition at line 344 of file kdganttdatetimegrid.cpp.

References d, KDGantt::AbstractGrid::gridChanged(), QObject::Q_EMIT(), and QObject::qobject_cast().

◆ setFreeDays()

void DateTimeGrid::setFreeDays ( const QSet< Qt::DayOfWeek > &  fd)
Parameters
fdA set of days to mark as free in the grid.

Free days are filled with the alternate base brush of the palette used by the view. The signal gridChanged() is emitted after the free days are changed.

Definition at line 447 of file kdganttdatetimegrid.cpp.

References d, KDGantt::AbstractGrid::gridChanged(), QObject::Q_EMIT(), and QObject::qobject_cast().

◆ setFreeDaysBrush()

void DateTimeGrid::setFreeDaysBrush ( const QBrush  brush)

Sets the brush to use to paint free days.

Definition at line 461 of file kdganttdatetimegrid.cpp.

References d.

◆ setNoInformationBrush()

void DateTimeGrid::setNoInformationBrush ( const QBrush brush)

Sets the brush used to display rows where no data is found.

Default is a red pattern. If set to QBrush() rows with no information will not be marked.

Definition at line 489 of file kdganttdatetimegrid.cpp.

References d, KDGantt::AbstractGrid::gridChanged(), and QObject::Q_EMIT().

◆ setRowSeparators()

void DateTimeGrid::setRowSeparators ( bool  enable)
Parameters
enableWhether to use row separators or not.

Definition at line 480 of file kdganttdatetimegrid.cpp.

References d, and QObject::qobject_cast().

◆ setScale()

void DateTimeGrid::setScale ( Scale  s)
Parameters
sThe scale to be used to paint the grid.

The signal gridChanged() is emitted after the scale has changed.

See also
Scale

Following example demonstrates how to change the format of the header to use a date-scaling with the header-label displayed with the ISO date-notation.

grid->setUserDefinedUpperScale( formatter );
grid->setUserDefinedLowerScale( formatter );
This class formats dates and times used in DateTimeGrid follawing a given format.
T qobject_cast(QObject *object)
QString fromLatin1(const char *str, int size)

Definition at line 365 of file kdganttdatetimegrid.cpp.

References d, KDGantt::AbstractGrid::gridChanged(), QObject::Q_EMIT(), and QObject::qobject_cast().

◆ setStartDateTime()

void DateTimeGrid::setStartDateTime ( const QDateTime dt)
Parameters
dtThe start date of the grid. It is used as the beginning of the horizontal scrollbar in the view.

Emits gridChanged() after the start date has changed.

Definition at line 311 of file kdganttdatetimegrid.cpp.

References d, KDGantt::AbstractGrid::gridChanged(), QObject::Q_EMIT(), and QObject::qobject_cast().

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

◆ setUserDefinedLowerScale()

void DateTimeGrid::setUserDefinedLowerScale ( DateTimeScaleFormatter lower)

Sets the scale formatter for the lower part of the header to the user defined formatter to lower.

The DateTimeGrid object takes ownership of the formatter, which has to be allocated with new.

You have to set the scale to ScaleUserDefined for this setting to take effect.

See also
DateTimeScaleFormatter

Definition at line 389 of file kdganttdatetimegrid.cpp.

References d, KDGantt::AbstractGrid::gridChanged(), and QObject::Q_EMIT().

◆ setUserDefinedUpperScale()

void DateTimeGrid::setUserDefinedUpperScale ( DateTimeScaleFormatter upper)

Sets the scale formatter for the upper part of the header to the user defined formatter to upper.

The DateTimeGrid object takes ownership of the formatter, which has to be allocated with new.

You have to set the scale to ScaleUserDefined for this setting to take effect.

See also
DateTimeScaleFormatter

Definition at line 403 of file kdganttdatetimegrid.cpp.

References d, KDGantt::AbstractGrid::gridChanged(), QObject::Q_EMIT(), and QObject::qobject_cast().

◆ setWeekStart()

void DateTimeGrid::setWeekStart ( Qt::DayOfWeek  ws)
Parameters
wsThe start day of the week.

A solid line is drawn on the grid to mark the beginning of a new week. Emits gridChanged() after the start day has changed.

Definition at line 429 of file kdganttdatetimegrid.cpp.

References d, KDGantt::AbstractGrid::gridChanged(), and QObject::Q_EMIT().

◆ startDateTime()

QDateTime DateTimeGrid::startDateTime ( ) const
Returns
The QDateTime used as start date for the grid.

The default is three days before the current date.

Definition at line 301 of file kdganttdatetimegrid.cpp.

References d.

Referenced by paintHeader().

◆ userDefinedLowerScale()

DateTimeScaleFormatter * DateTimeGrid::userDefinedLowerScale ( ) const
Returns
The DateTimeScaleFormatter being used to render the lower scale.

Definition at line 412 of file kdganttdatetimegrid.cpp.

References d.

◆ userDefinedUpperScale()

DateTimeScaleFormatter * DateTimeGrid::userDefinedUpperScale ( ) const
Returns
The DateTimeScaleFormatter being used to render the upper scale.

Definition at line 419 of file kdganttdatetimegrid.cpp.

References d.

◆ weekStart()

Qt::DayOfWeek DateTimeGrid::weekStart ( ) const
Returns
The start day of the week

Definition at line 436 of file kdganttdatetimegrid.cpp.

References d.


The documentation for this class was generated from the following files:

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated on Fri Apr 26 2024 00:04:58 for KD Chart API Documentation by doxygen 1.9.8