Changeset View
Changeset View
Standalone View
Standalone View
tests/Gantt/customconstraints/main.cpp
Show All 37 Lines | 37 | class MyGraphicsView : public KGantt::GraphicsView { | |||
---|---|---|---|---|---|
38 | Q_OBJECT | 38 | Q_OBJECT | ||
39 | public: | 39 | public: | ||
40 | MyGraphicsView( QWidget* parent = nullptr ) : KGantt::GraphicsView( parent ) | 40 | MyGraphicsView( QWidget* parent = nullptr ) : KGantt::GraphicsView( parent ) | ||
41 | { | 41 | { | ||
42 | } | 42 | } | ||
43 | 43 | | |||
44 | /*reimp*/void addConstraint( const QModelIndex& from, | 44 | /*reimp*/void addConstraint( const QModelIndex& from, | ||
45 | const QModelIndex& to, | 45 | const QModelIndex& to, | ||
46 | Qt::KeyboardModifiers modifiers ) Q_DECL_OVERRIDE | 46 | Qt::KeyboardModifiers modifiers ) override | ||
47 | { | 47 | { | ||
48 | qDebug() << "MyGraphicsView::addConstraint()"; | 48 | qDebug() << "MyGraphicsView::addConstraint()"; | ||
49 | if ( isReadOnly() ) return; | 49 | if ( isReadOnly() ) return; | ||
50 | KGantt::ConstraintModel* cmodel = constraintModel(); | 50 | KGantt::ConstraintModel* cmodel = constraintModel(); | ||
51 | KGantt::Constraint c( from, to, ( modifiers&Qt::ShiftModifier )?KGantt::Constraint::TypeHard:KGantt::Constraint::TypeSoft ); | 51 | KGantt::Constraint c( from, to, ( modifiers&Qt::ShiftModifier )?KGantt::Constraint::TypeHard:KGantt::Constraint::TypeSoft ); | ||
52 | c.setData( KGantt::Constraint::ValidConstraintPen, QPen( QColor( Qt::green ), 3, Qt::DashLine ) ); | 52 | c.setData( KGantt::Constraint::ValidConstraintPen, QPen( QColor( Qt::green ), 3, Qt::DashLine ) ); | ||
53 | c.setData( KGantt::Constraint::InvalidConstraintPen, QPen( QColor( Qt::blue ), 3, Qt::DashLine ) ); | 53 | c.setData( KGantt::Constraint::InvalidConstraintPen, QPen( QColor( Qt::blue ), 3, Qt::DashLine ) ); | ||
54 | if ( cmodel->hasConstraint( c ) ) cmodel->removeConstraint( c ); | 54 | if ( cmodel->hasConstraint( c ) ) cmodel->removeConstraint( c ); | ||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |