KGantt
kganttdatetimegrid.cpp
33 case KGantt::DateTimeScaleFormatter::Second: dbg << "KGantt::DateTimeScaleFormatter::Second"; break;
34 case KGantt::DateTimeScaleFormatter::Minute: dbg << "KGantt::DateTimeScaleFormatter::Minute"; break;
38 case KGantt::DateTimeScaleFormatter::Month: dbg << "KGantt::DateTimeScaleFormatter::Month"; break;
80DateTimeScaleFormatter::DateTimeScaleFormatter( Range range, const QString& format, Qt::Alignment alignment )
116 const QString shortWeekNumber = QString::number( datetime.date().weekNumber()) + QLatin1String("/")
118 const QString longWeekNumber = ( shortWeekNumber.length() == 1 ? QString::fromLatin1( "0" ) : QString() ) + shortWeekNumber;
430 if ( sv.canConvert( QVariant::DateTime ) && !(sv.type() == QVariant::String && sv.toString().isEmpty()) ) {
481Qt::PenStyle DateTimeGrid::Private::gridLinePenStyle( QDateTime dt, Private::HeaderType headerType ) const
519QDateTime DateTimeGrid::Private::adjustDateTimeForHeader( QDateTime dt, Private::HeaderType headerType ) const
579 painter->fillRect( QRectF( x, exposedRect.top(), dayWidth, exposedRect.height() ), painter->brush() );
617 painter->fillRect( QRectF( x, exposedRect.top(), dayWidth, exposedRect.height() ), painter->brush() );
624 for ( qreal x = dateTimeToChartX( dt ); x < exposedRect.right(); dt = upperFormatter->nextRangeBegin( dt ), x=dateTimeToChartX( dt ) ) {
646DateTimeGrid::Private::HeaderType DateTimeGrid::Private::headerTypeForScale( DateTimeGrid::Scale scale )
676 d->paintVerticalLines( painter, sceneRect, exposedRect, widget, d->headerTypeForScale( scale() ) );
700 painter->fillRect( QRectF( exposedRect.left(), s.start(), exposedRect.width(), s.length() ), d->noInformationBrush );
722void DateTimeGrid::Private::getAutomaticFormatters( DateTimeScaleFormatter** lower, DateTimeScaleFormatter** upper)
724 const qreal tabw = QApplication::fontMetrics().boundingRect( QLatin1String( "XXXXX" ) ).width();
747void DateTimeGrid::Private::getFormatters( DateTimeScaleFormatter** lower, DateTimeScaleFormatter** upper)
776DateTimeGrid::HeaderType DateTimeGrid::sectionHandleAtPos(int x, int y, const QRect &headerRect) const
789 const QRectF lowerHeaderRect( x, upperHeaderRect.bottom()+1, 5, headerRect.height()-upperHeaderRect.height()-1 );
799void DateTimeGrid::paintHeader( QPainter* painter, const QRectF& headerRect, const QRectF& exposedRect,
828 const QRectF upperHeaderRect( headerRect.x(), headerRect.top(), headerRect.width()-1, headerRect.height() * upperRatio );
829 const QRectF lowerHeaderRect( headerRect.x(), upperHeaderRect.bottom()+1, headerRect.width()-1, headerRect.height()-upperHeaderRect.height()-1 );
841 const QRectF upperHeaderRect( headerRect.x(), headerRect.top(), headerRect.width()-1, headerRect.height() * upperRatio );
859 QDateTime dt = formatter->currentRangeBegin( d->chartXtoDateTime( offset + exposedRect.left() ));
869 opt.rect = QRectF( x - offset+1, headerRect.top(), qMax<qreal>( 1., nextx-x-1 ), headerRect.height() ).toAlignedRect();
921 dt = dt.addSecs( offsetSeconds ), dt = dt.addDays( offsetDays ), dt = dt.addMonths( offsetMonths ),
947 QRect textRect( qreal x, qreal offset, qreal dayWidth, const QRectF& headerRect, const QDateTime& dt ) override {
950 return QRectF( QPointF( x, headerRect.top() ) + QPointF( -offset + 1.0, headerRect.height() / 2.0 ),
975void DateTimeGrid::paintDayScaleHeader( QPainter* painter, const QRectF& headerRect, const QRectF& exposedRect,
985 QRect textRect( qreal x, qreal offset, qreal dayWidth, const QRectF& headerRect, const QDateTime& dt ) override {
988 return QRectF( QPointF( x, headerRect.top() ) + QPointF( -offset + 1.0, headerRect.height() / 2.0 ),
999 return QString::number(dt.date().weekNumber()) + QLatin1String("/") + QString::number(dt.date().year());
1013void DateTimeGrid::paintWeekScaleHeader( QPainter* painter, const QRectF& headerRect, const QRectF& exposedRect,
1023 QRect textRect( qreal x, qreal offset, qreal dayWidth, const QRectF& headerRect, const QDateTime& dt ) override {
1038 return QLocale().monthName(dt.date().month(), QLocale::LongFormat) + QLatin1String("/") + QString::number(dt.date().year());
1050void DateTimeGrid::paintMonthScaleHeader( QPainter* painter, const QRectF& headerRect, const QRectF& exposedRect,
1058 return QLocale().monthName(dt.date().month(), QLocale::ShortFormat) + QLatin1String("/") + QString::number(dt.date().year());
1060 QRect textRect( qreal x, qreal offset, qreal dayWidth, const QRectF& headerRect, const QDateTime& dt ) override {
1282 assertTrue( grid.isSatisfiedConstraint( Constraint( model.index( 0, 0 ), model.index( 2, 0 ) ) ) );
1283 assertFalse( grid.isSatisfiedConstraint( Constraint( model.index( 2, 0 ), model.index( 0, 0 ) ) ) );
1307 QDateTime result2 = dt2.addDays( days ).addSecs( static_cast<int>(secs-(days*24.*60.*60.) ) ).addMSecs( qRound( ( secs-static_cast<int>( secs ) )*1000. ) );
Abstract baseclass for grids. A grid is used to convert between QModelIndex'es and gantt chart values...
bool isSatisfiedConstraint(const Constraint &c) const
Definition kganttabstractgrid.cpp:50
virtual void setModel(QAbstractItemModel *model)
Definition kganttabstractgrid.cpp:30
Abstract baseclass for row controllers. A row controller is used by the GraphicsView to nagivate the ...
virtual QModelIndex indexBelow(const QModelIndex &idx) const =0
virtual Span rowGeometry(const QModelIndex &idx) const =0
virtual QModelIndex indexAbove(const QModelIndex &idx) const =0
A class used to represent a dependency.
virtual void paintHourScaleHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr)
Definition kganttdatetimegrid.cpp:936
virtual void drawDayForeground(QPainter *painter, const QRectF &rect, const QDate &date)
Definition kganttdatetimegrid.cpp:1094
bool mapFromChart(const Span &span, const QModelIndex &idx, const QList< Constraint > &constraints=QList< Constraint >()) const override
Definition kganttdatetimegrid.cpp:454
virtual void paintDayScaleHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr)
Definition kganttdatetimegrid.cpp:975
DateTimeTimeLine * timeLine() const
Definition kganttdatetimegrid.cpp:1212
void paintHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr) override
Definition kganttdatetimegrid.cpp:799
QBrush noInformationBrush() const
Definition kganttdatetimegrid.cpp:385
DateTimeScaleFormatter * userDefinedUpperScale() const
Definition kganttdatetimegrid.cpp:323
QDateTime startDateTime() const
Definition kganttdatetimegrid.cpp:249
void setStartDateTime(const QDateTime &dt)
Definition kganttdatetimegrid.cpp:255
virtual void drawDayBackground(QPainter *painter, const QRectF &rect, const QDate &date)
Definition kganttdatetimegrid.cpp:1085
void drawForeground(QPainter *paint, const QRectF &rect) override
Definition kganttdatetimegrid.cpp:1168
void setRowSeparators(bool enable)
Definition kganttdatetimegrid.cpp:372
DateTimeScaleFormatter * userDefinedLowerScale() const
Definition kganttdatetimegrid.cpp:317
qreal mapFromDateTime(const QDateTime &dt) const
Definition kganttdatetimegrid.cpp:268
void setWeekStart(Qt::DayOfWeek)
Definition kganttdatetimegrid.cpp:329
Span mapToChart(const QModelIndex &idx) const override
Definition kganttdatetimegrid.cpp:408
QRectF computeRect(const QDateTime &from, const QDateTime &to, const QRectF &rect) const
Return the rectangle that represents the date-range.
Definition kganttdatetimegrid.cpp:1103
void setNoInformationBrush(const QBrush &brush)
Definition kganttdatetimegrid.cpp:378
void drawBackground(QPainter *paint, const QRectF &rect) override
Definition kganttdatetimegrid.cpp:1123
QPair< QDateTime, QDateTime > dateTimeRange(const QRectF &rect) const
Return a date-range represented by the rectangle.
Definition kganttdatetimegrid.cpp:1112
QDateTime mapToDateTime(qreal x) const
Definition kganttdatetimegrid.cpp:274
virtual void paintWeekScaleHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr)
Definition kganttdatetimegrid.cpp:1013
QBrush freeDaysBrush() const
Definition kganttdatetimegrid.cpp:361
void setUserDefinedLowerScale(DateTimeScaleFormatter *lower)
Definition kganttdatetimegrid.cpp:301
virtual void paintMonthScaleHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=nullptr)
Definition kganttdatetimegrid.cpp:1050
void paintGrid(QPainter *painter, const QRectF &sceneRect, const QRectF &exposedRect, AbstractRowController *rowController=nullptr, QWidget *widget=nullptr) override
Definition kganttdatetimegrid.cpp:665
QSet< Qt::DayOfWeek > freeDays() const
Definition kganttdatetimegrid.cpp:349
void setUserDefinedUpperScale(DateTimeScaleFormatter *upper)
Definition kganttdatetimegrid.cpp:309
void setFreeDaysBrush(const QBrush brush)
Definition kganttdatetimegrid.cpp:355
void setFreeDays(const QSet< Qt::DayOfWeek > &fd)
Definition kganttdatetimegrid.cpp:342
virtual QDateTime nextRangeBegin(const QDateTime &datetime) const
Definition kganttdatetimegrid.cpp:142
virtual QDateTime currentRangeBegin(const QDateTime &datetime) const
Definition kganttdatetimegrid.cpp:195
DateTimeScaleFormatter(Range range, const QString &formatString, Qt::Alignment alignment=Qt::AlignCenter)
Definition kganttdatetimegrid.cpp:80
A class representing a start point and a length.
Q_SCRIPTABLE Q_NOREPLY void start()
QDateTime startDateTime(const QVariant &elem)
KTEXTEDITOR_EXPORT QDebug operator<<(QDebug s, const MovingCursor &cursor)
virtual QVariant data(const QModelIndex &index, int role) const const=0
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
QFontMetrics fontMetrics()
QStyle * style()
const char * constData() const const
QDate addDays(qint64 ndays) const const
QDate addMonths(int nmonths) const const
QDate addYears(int nyears) const const
QDate currentDate()
int day() const const
int dayOfWeek() const const
int dayOfYear() const const
int daysInMonth() const const
int daysInYear() const const
qint64 daysTo(QDate d) const const
int month() const const
int weekNumber(int *yearNumber) const const
int year() const const
QDateTime addDays(qint64 ndays) const const
QDateTime addMSecs(qint64 msecs) const const
QDateTime addMonths(int nmonths) const const
QDateTime addSecs(qint64 s) const const
QDateTime currentDateTime()
QDate date() const const
bool isValid() const const
void setDate(QDate date)
void setTime(QTime time)
QTime time() const const
QDateTime toLocalTime() const const
QString toString(QStringView format, QCalendar cal) const const
QRect boundingRect(QChar ch) const const
QPalette palette()
void append(QList< T > &&value)
bool contains(const AT &value) const const
LongFormat
QString monthName(int month, FormatType type) const const
QString toString(QDate date, FormatType format) const const
QVariant data(int role) const const
bool isValid() const const
const QAbstractItemModel * model() const const
Q_EMITQ_EMIT
const QBrush & brush() const const
void drawLine(const QLine &line)
void fillRect(const QRect &rectangle, QGradient::Preset preset)
const QPen & pen() const const
void restore()
void save()
void setBrush(Qt::BrushStyle style)
void setClipPath(const QPainterPath &path, Qt::ClipOperation operation)
void setPen(Qt::PenStyle style)
void addRect(const QRectF &rectangle)
const QBrush & midlight() const const
void setBrush(const QBrush &brush)
void setStyle(Qt::PenStyle style)
int height() const const
int top() const const
int width() const const
QRectF adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const const
qreal bottom() const const
bool contains(const QPointF &point) const const
qreal height() const const
qreal left() const const
qreal right() const const
QRect toAlignedRect() const const
QRect toRect() const const
qreal top() const const
qreal width() const const
qreal x() const const
int height() const const
QString fromLatin1(QByteArrayView str)
bool isEmpty() const const
QString left(qsizetype n) const const
qsizetype length() const const
QString number(double n, char format, int precision)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
QByteArray toLatin1() const const
std::string toStdString() const const
CT_HeaderSection
CE_Header
virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const const=0
virtual QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const const=0
void initFrom(const QWidget *widget)
typedef Alignment
NoBrush
IntersectClip
DayOfWeek
PenStyle
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
int hour() const const
int minute() const const
int msecsTo(QTime t) const const
DateTime
Type type() const const
bool canConvert() const const
QVariant fromValue(T &&value)
bool isValid() const const
QDateTime toDateTime() const const
QString toString() const const
palette
QStyle * style() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:52:09 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:52:09 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.