当前位置: 首页>>代码示例>>C++>>正文


C++ Constraint::endIndex方法代码示例

本文整理汇总了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 );
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:38,代码来源:kdganttitemdelegate.cpp

示例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() );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:13,代码来源:kdganttabstractgrid.cpp

示例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 ) );
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:30,代码来源:kdganttitemdelegate.cpp


注:本文中的Constraint::endIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。