本文整理汇总了C++中Constraint::endIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Constraint::endIndex方法的具体用法?C++ Constraint::endIndex怎么用?C++ Constraint::endIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Constraint
的用法示例。
在下文中一共展示了Constraint::endIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: constraintBoundingRect
/*! \return The bounding rectangle for the graphics used to represent
* a constraint between points \a start and \a end (typically an
* arrow)
*/
QRectF ItemDelegate::constraintBoundingRect( const QPointF& start, const QPointF& end, const Constraint &constraint ) const
{
QPolygonF poly;
QPointF e = end;
switch ( constraint.relationType() ) {
case Constraint::FinishStart:
if ( constraint.endIndex().data( KDGantt::ItemTypeRole ).toInt() == KDGantt::TypeEvent ) {
e.setX( e.x() - TURN );
}
poly = finishStartLine( start, e ) + finishStartArrow( start, e );
break;
case Constraint::FinishFinish:
if ( constraint.endIndex().data( KDGantt::ItemTypeRole ).toInt() == KDGantt::TypeEvent ) {
e.setX( e.x() + TURN );
}
poly = finishFinishLine( start, e ) + finishFinishArrow( start, e );
break;
case Constraint::StartStart:
if ( constraint.endIndex().data( KDGantt::ItemTypeRole ).toInt() == KDGantt::TypeEvent ) {
e.setX( e.x() - TURN );
}
poly = startStartLine( start, e ) + startStartArrow( start, e );
break;
case Constraint::StartFinish:
if ( constraint.endIndex().data( KDGantt::ItemTypeRole ).toInt() == KDGantt::TypeEvent ) {
e.setX( e.x() + TURN );
}
poly = startFinishLine( start, e ) + startFinishArrow( start, e );
break;
default:
break;
}
return poly.boundingRect().adjusted( -PW, -PW, PW, PW );
}
示例2: isSatisfiedConstraint
/*!\returns true if the startpoint is before the endpoint
* of the constraint \a c.
*/
bool AbstractGrid::isSatisfiedConstraint( const Constraint& c ) const
{
// First check if the data is valid,
// TODO: review if true is the right choice
if ( !c.startIndex().isValid() || !c.endIndex().isValid() ) return true;
Span ss = mapToChart( c.startIndex() );
Span es = mapToChart( c.endIndex() );
return ( ss.end() <= es.start() );
}
示例3: paintStartFinishConstraint
void ItemDelegate::paintStartFinishConstraint( QPainter* painter, const QStyleOptionGraphicsItem& opt, const QPointF& start, const QPointF& end, const Constraint &constraint )
{
Q_UNUSED( opt );
QPen pen;
QVariant dataPen;
// default pens
if ( start.x() <= end.x() ) {
pen = QPen( Qt::black );
dataPen = constraint.data( Constraint::ValidConstraintPen );
} else {
pen = QPen( Qt::red );
dataPen = constraint.data( Constraint::InvalidConstraintPen );
}
// data() pen
if( qVariantCanConvert< QPen >( dataPen ) )
pen = qVariantValue< QPen >( dataPen );
painter->setPen( pen );
painter->setBrush( pen.color() );
QPointF e = end;
if ( constraint.endIndex().data( KDGantt::ItemTypeRole ).toInt() == KDGantt::TypeEvent ) {
e.setX( e.x() + TURN );
}
painter->drawPolyline( startFinishLine( start, e ) );
painter->drawPolygon( startFinishArrow( start, e ) );
}