kdgantt2
kdganttdatetimegrid.cpp
Go to the documentation of this file.
45 case KDGantt::DateTimeScaleFormatter::Second: dbg << "KDGantt::DateTimeScaleFormatter::Second"; break;
46 case KDGantt::DateTimeScaleFormatter::Minute: dbg << "KDGantt::DateTimeScaleFormatter::Minute"; break;
47 case KDGantt::DateTimeScaleFormatter::Hour: dbg << "KDGantt::DateTimeScaleFormatter::Hour"; break;
49 case KDGantt::DateTimeScaleFormatter::Week: dbg << "KDGantt::DateTimeScaleFormatter::Week"; break;
50 case KDGantt::DateTimeScaleFormatter::Month: dbg << "KDGantt::DateTimeScaleFormatter::Month"; break;
51 case KDGantt::DateTimeScaleFormatter::Year: dbg << "KDGantt::DateTimeScaleFormatter::Year"; break;
124 DateTimeScaleFormatter::DateTimeScaleFormatter( Range range, const QString& format, Qt::Alignment alignment )
139 DateTimeScaleFormatter& DateTimeScaleFormatter::operator=( const DateTimeScaleFormatter& other )
160 const QString longWeekNumber = ( shortWeekNumber.length() == 1 ? QString::fromLatin1( "0" ) : QString() ) + shortWeekNumber;
501 if( qVariantCanConvert<QDateTime>(sv) && !(sv.type() == QVariant::String && qVariantValue<QString>(sv).isEmpty()) ) {
585 painter->fillRect( QRectF( x, exposedRect.top(), dayWidth, exposedRect.height() ), painter->brush() );
613 painter->fillRect( QRectF( x, exposedRect.top(), dayWidth, exposedRect.height() ), painter->brush() );
700 painter->fillRect( QRectF( exposedRect.left(), s.start(), exposedRect.width(), s.length() ), d->noInformationBrush );
703 //if ( idx.row()%2 ) painter->fillRect( QRectF( exposedRect.x(), s.start(), exposedRect.width(), s.length() ), QApplication::palette().alternateBase() );
721 void DateTimeGrid::Private::getAutomaticFormatters( DateTimeScaleFormatter** lower, DateTimeScaleFormatter** upper)
747 void DateTimeGrid::paintHeader( QPainter* painter, const QRectF& headerRect, const QRectF& exposedRect,
770 const QRectF upperHeaderRect( headerRect.x(), headerRect.top(), headerRect.width()-1, headerRect.height() * upperRatio );
771 const QRectF lowerHeaderRect( headerRect.x(), upperHeaderRect.bottom()+1, headerRect.width()-1, headerRect.height()-upperHeaderRect.height()-1 );
785 const QRectF upperHeaderRect( headerRect.x(), headerRect.top(), headerRect.width()-1, headerRect.height() * upperRatio );
786 const QRectF lowerHeaderRect( headerRect.x(), upperHeaderRect.bottom()+1, headerRect.width()-1, headerRect.height()-upperHeaderRect.height()-1 );
800 const QRectF upperHeaderRect( headerRect.x(), headerRect.top(), headerRect.width()-1, headerRect.height() * upperRatio );
801 const QRectF lowerHeaderRect( headerRect.x(), upperHeaderRect.bottom()+1, headerRect.width()-1, headerRect.height()-upperHeaderRect.height()-1 );
813 const QRectF upperHeaderRect( headerRect.x(), headerRect.top(), headerRect.width()-1, headerRect.height() * upperRatio );
814 const QRectF lowerHeaderRect( headerRect.x(), upperHeaderRect.bottom()+1, headerRect.width()-1, headerRect.height()-upperHeaderRect.height()-1 );
831 QDateTime dt = formatter->currentRangeBegin( d->chartXtoDateTime( offset + exposedRect.left() ) ).toUTC();
841 opt.rect = QRectF( x - offset+1, headerRect.top(), qMax<qreal>( 1., nextx-x-1 ), headerRect.height() ).toAlignedRect();
867 opt.rect = QRectF( x-offset+1, headerRect.top()+headerRect.height()/2., dayWidth()/24., headerRect.height()/2. ).toAlignedRect();
890 void DateTimeGrid::paintDayScaleHeader( QPainter* painter, const QRectF& headerRect, const QRectF& exposedRect,
903 opt.rect = QRectF( x-offset+1, headerRect.top()+headerRect.height()/2., dayWidth(), headerRect.height()/2. ).toAlignedRect();
918 opt.rect = QRectF( x2-offset, headerRect.top(), dayWidth()*7., headerRect.height()/2. ).toRect();
981 assertTrue( grid.isSatisfiedConstraint( Constraint( model.index( 0, 0 ), model.index( 2, 0 ) ) ) );
982 assertFalse( grid.isSatisfiedConstraint( Constraint( model.index( 2, 0 ), model.index( 0, 0 ) ) ) );
1006 QDateTime result2 = dt2.addDays( days ).addSecs( static_cast<int>(secs-(days*24.*60.*60.) ) ).addMSecs( qRound( ( secs-static_cast<int>( secs ) )*1000. ) );
QAbstractItemModel * model() const
Definition: kdganttabstractgrid.cpp:64
std::string toStdString() const
int daysTo(const QDate &d) const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
QString toString(Qt::DateFormat format) const
int minute() const
KDAB_SCOPED_UNITTEST_SIMPLE(KDGantt, DateTimeGrid,"test")
Definition: kdganttdatetimegrid.cpp:944
virtual void setModel(QAbstractItemModel *model)
Definition: kdganttabstractgrid.cpp:58
void setStyle(Qt::PenStyle style)
palette
QDateTime toUTC() const
DateTimeScaleFormatter * userDefinedUpperScale() const
Definition: kdganttdatetimegrid.cpp:408
QString format() const
Definition: kdganttdatetimegrid.cpp:148
void setClipPath(const QPainterPath &path, Qt::ClipOperation operation)
void fillRect(const QRectF &rectangle, const QBrush &brush)
void setWeekStart(Qt::DayOfWeek)
Definition: kdganttdatetimegrid.cpp:418
virtual QDateTime nextRangeBegin(const QDateTime &datetime) const
Definition: kdganttdatetimegrid.cpp:187
virtual ~DateTimeScaleFormatter()
Definition: kdganttdatetimegrid.cpp:134
virtual QVariant data(const QModelIndex &index, int role) const
QString toString(Qt::DateFormat format) const
QString toString(Qt::DateFormat format) const
qreal x() const
int tabHeight(const QString &txt, QWidget *widget=0) const
Definition: kdganttdatetimegrid.cpp:709
QDateTime chartXtoDateTime(qreal x) const
Definition: kdganttdatetimegrid.cpp:77
const QBrush & midlight() const
QDateTime toDateTime() const
void paintVerticalUserDefinedLines(QPainter *painter, const QRectF &sceneRect, const QRectF &exposedRect, const DateTimeScaleFormatter *formatter, QWidget *widget)
Definition: kdganttdatetimegrid.cpp:620
QStyle * style() const
void setTime(const QTime &time)
void paintVerticalDayLines(QPainter *painter, const QRectF &sceneRect, const QRectF &exposedRect, QWidget *widget)
Definition: kdganttdatetimegrid.cpp:564
void save()
void paintHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=0)
Definition: kdganttdatetimegrid.cpp:747
Definition: kdganttglobal.h:204
QTime time() const
int msecsTo(const QTime &t) const
void gridChanged()
qreal top() const
qreal dateTimeToChartX(const QDateTime &dt) const
Definition: kdganttdatetimegrid.cpp:67
DateTimeScaleFormatter(Range range, const QString &formatString, Qt::Alignment alignment=Qt::AlignCenter)
Definition: kdganttdatetimegrid.cpp:124
DateTimeScaleFormatter & operator=(const DateTimeScaleFormatter &other)
Definition: kdganttdatetimegrid.cpp:139
void drawLine(const QLineF &line)
int month() const
void setBrush(const QBrush &brush)
typedef Alignment
QDebug operator<<(QDebug dbg, KDGantt::DateTimeScaleFormatter::Range range)
Definition: kdganttdatetimegrid.cpp:42
int weekNumber(int *yearNumber) const
qreal left() const
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
Qt::DayOfWeek weekStart() const
Definition: kdganttdatetimegrid.cpp:425
void setNoInformationBrush(const QBrush &brush)
Definition: kdganttdatetimegrid.cpp:463
void initFrom(const QWidget *widget)
int dayOfWeek() const
qreal bottom() const
bool isValid() const
QString number(int n, int base)
virtual QModelIndex indexAbove(const QModelIndex &idx) const =0
Definition: kdganttglobal.h:207
Abstract baseclass for grids. A grid is used to convert between QModelIndex'es and gantt chart values...
Definition: kdganttabstractgrid.h:40
QDateTime startDateTime
Definition: kdganttdatetimegrid_p.h:108
void setPen(const QColor &color)
bool rowSeparators() const
Definition: kdganttdatetimegrid.cpp:449
bool mapFromChart(const Span &span, const QModelIndex &idx, const QList< Constraint > &constraints=QList< Constraint >()) const
Definition: kdganttdatetimegrid.cpp:538
void addRect(const QRectF &rectangle)
const char * constData() const
virtual QModelIndex indexBelow(const QModelIndex &idx) const =0
void setDate(const QDate &date)
void setBrush(const QBrush &brush)
virtual QDateTime currentRangeBegin(const QDateTime &datetime) const
Definition: kdganttdatetimegrid.cpp:242
virtual QVariant data(const QModelIndex &index, int role) const =0
int year() const
void setFreeDays(const QSet< Qt::DayOfWeek > &fd)
Definition: kdganttdatetimegrid.cpp:436
QDateTime mapToDateTime(qreal x) const
Definition: kdganttdatetimegrid.cpp:333
QPalette palette()
virtual QString text(const QDateTime &datetime) const
Definition: kdganttdatetimegrid.cpp:167
Definition: kdganttglobal.h:205
void paintGrid(QPainter *painter, const QRectF &sceneRect, const QRectF &exposedRect, AbstractRowController *rowController=0, QWidget *widget=0)
Definition: kdganttdatetimegrid.cpp:641
int hour() const
qreal right() const
const QBrush & brush() const
bool isSatisfiedConstraint(const Constraint &c) const
Definition: kdganttabstractgrid.cpp:86
int width(const QString &text, int len) const
virtual void paintUserDefinedHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, const DateTimeScaleFormatter *formatter, QWidget *widget=0)
Definition: kdganttdatetimegrid.cpp:824
bool contains(const T &value) const
bool isValid() const
void restore()
QBrush noInformationBrush() const
Definition: kdganttdatetimegrid.cpp:471
QString & replace(int position, int n, QChar after)
void getAutomaticFormatters(DateTimeScaleFormatter **lower, DateTimeScaleFormatter **upper)
Definition: kdganttdatetimegrid.cpp:721
QDateTime currentDateTime()
QByteArray toLatin1() const
qreal width() const
const QAbstractItemModel * model() const
QDate date() const
QVariant data(int role) const
QStyle * style()
void setUserDefinedUpperScale(DateTimeScaleFormatter *upper)
Definition: kdganttdatetimegrid.cpp:392
QSet< Qt::DayOfWeek > freeDays() const
Definition: kdganttdatetimegrid.cpp:443
DateTimeScaleFormatter * userDefinedLowerScale() const
Definition: kdganttdatetimegrid.cpp:401
virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
QDate currentDate()
int height() const
virtual Span rowGeometry(const QModelIndex &idx) const =0
int length() const
QFontMetrics fontMetrics()
void init(const QWidget *widget)
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
QString left(int n) const
qreal mapFromDateTime(const QDateTime &dt) const
Definition: kdganttdatetimegrid.cpp:326
void paintVerticalHourLines(QPainter *painter, const QRectF &sceneRect, const QRectF &exposedRect, QWidget *widget)
Definition: kdganttdatetimegrid.cpp:592
virtual QModelIndex indexAt(int height) const =0
QString fromLatin1(const char *str, int size)
bool isValid() const
qreal height() const
Qt::Alignment alignment() const
Definition: kdganttdatetimegrid.cpp:179
QSet< Qt::DayOfWeek > freeDays
Definition: kdganttdatetimegrid_p.h:113
QDateTime startDateTime() const
Definition: kdganttdatetimegrid.cpp:299
QDateTime toLocalTime() const
QDate addDays(int ndays) const
void setUserDefinedLowerScale(DateTimeScaleFormatter *lower)
Definition: kdganttdatetimegrid.cpp:378
QDateTime addSecs(int s) const
Type type() const
virtual void paintHourScaleHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=0)
Definition: kdganttdatetimegrid.cpp:854
virtual void paintDayScaleHeader(QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=0)
Definition: kdganttdatetimegrid.cpp:890
Qt::DayOfWeek weekStart
Definition: kdganttdatetimegrid_p.h:112
QDateTime addDays(int ndays) const
Abstract baseclass for row controllers. A row controller is used by the GraphicsView to nagivate the ...
Definition: kdganttabstractrowcontroller.h:34
const QPen & pen() const
virtual QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const =0
Definition: kdganttdatetimegrid.h:69
void setStartDateTime(const QDateTime &dt)
Definition: kdganttdatetimegrid.cpp:309
Span mapToChart(const QModelIndex &idx) const
Definition: kdganttdatetimegrid.cpp:479
void setRowSeparators(bool enable)
Definition: kdganttdatetimegrid.cpp:454
QDateTime addMSecs(qint64 msecs) const
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
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.