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


C++ QPolygonF::clear方法代码示例

本文整理汇总了C++中QPolygonF::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QPolygonF::clear方法的具体用法?C++ QPolygonF::clear怎么用?C++ QPolygonF::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPolygonF的用法示例。


在下文中一共展示了QPolygonF::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testSplines

void testSplines()
{
    QPolygonF points;

    // 3 points

    points << QPointF( 10, 50 ) << QPointF( 60, 30 ) << QPointF( 82, 50 );

    testSplines( points );

    // 4 points

    points.clear();
    points << QPointF( 10, 50 ) << QPointF( 60, 30 )
        << QPointF( 70, 5 ) << QPointF( 82, 50 );

    testSplines( points );

    // 5 points
    points.clear();
    points << QPointF( 10, 50 ) << QPointF( 20, 20 ) << QPointF( 60, 30 )
        << QPointF( 70, 5 ) << QPointF( 82, 50 );

    testSplines( points );

    // 12 points

    points.clear();
    points << QPointF( 10, 50 ) << QPointF( 20, 90 ) << QPointF( 25, 60 )
        << QPointF( 35, 38 ) << QPointF( 42, 40 ) << QPointF( 55, 60 )
        << QPointF( 60, 50 ) << QPointF( 65, 80 ) << QPointF( 73, 30 )
        << QPointF( 82, 30 ) << QPointF( 87, 40 ) << QPointF( 95, 50 );

    testSplines( points );

    // many points
    points.clear();

    const double x1 = 10.0;
    const double x2 = 1000.0;
    const double y1 = -10000.0;
    const double y2 = 10000.0;

    points += QPointF( x1, y1 );

    const int n = 100;
    const double dx = ( x2 - x1 ) / n;
    const int mod = y2 - y1;
    for ( int i = 1; i < n - 1; i++ )
    {
        const double r = qrand() % mod;
        points += QPointF( x1 + i * dx, y1 + r );
    }
    points += QPointF( x2, y1 );

    testSplines( points );
}
开发者ID:Au-Zone,项目名称:qwt,代码行数:57,代码来源:splinetest.cpp

示例2: colorMapPainter

void
SplineTransferFunction::updateColorMapImage()
{
  m_colorMapImage.fill(0);

  QPainter colorMapPainter(&m_colorMapImage);
  colorMapPainter.setCompositionMode(QPainter::CompositionMode_Source);

  QPolygonF pointsLeft;
  pointsLeft.clear();
  for (int i=0; i<m_points.size(); i++)
    {
      QPointF pt = m_leftNormals[i];
      pointsLeft << QPointF(pt.x()*255, pt.y()*255);
    }
  
	  
  QPolygonF pointsRight;
  pointsRight.clear();
  for (int i=0; i<m_points.size(); i++)
    {
      QPointF pt = m_rightNormals[i];
      pointsRight << QPointF(pt.x()*255, pt.y()*255);
    }

  QGradientStops gstops = StaticFunctions::resampleGradientStops(m_gradientStops);
  for (int i=1; i<m_points.size(); i++)
    {
      QPainterPath pathRight, pathLeft;
      getPainterPathSegment(&pathRight, pointsRight, i);
      getPainterPathSegment(&pathLeft, pointsLeft, i);
      
      float pathLen = 1.5*qMax(pathRight.length(), pathLeft.length());
      for (int l=0; l<pathLen+1; l++)
	{
	  QPointF vLeft, vRight;
	  float frc = (float)l/(float)pathLen;
	  
	  vLeft = pathLeft.pointAtPercent(frc);
	  vRight = pathRight.pointAtPercent(frc);
	  
	  QLinearGradient lg(vRight.x(), vRight.y(),
			     vLeft.x(), vLeft.y());
	  lg.setStops(gstops);
	  
	  QPen pen;
	  pen.setBrush(QBrush(lg));
	  pen.setWidth(2);
	  
	  colorMapPainter.setPen(pen);
	  colorMapPainter.drawLine(vRight, vLeft);
	}
    }
}
开发者ID:Elavina6,项目名称:drishti,代码行数:54,代码来源:splinetransferfunction.cpp

示例3: paint

void Cota::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
	Q_UNUSED(widget);

	const qreal lod = option->levelOfDetailFromTransform(painter->worldTransform());
	if ( lod > 0.125 ) {
		painter->setPen(QPen(Qt::darkGray, 0.2));
		painter->setBrush(QBrush(Qt::darkGray));
		// Dibujamos la línea de la cota
		qreal yLine = HEIGHT_TOTAL - 3;
		painter->drawLine(QPointF(0, yLine), QPointF(d->m_width, yLine));
		painter->drawLine(QPointF(0, yLine-HEIGHT_COTA), QPointF(0, yLine+HEIGHT_COTA));
		painter->drawLine(QPointF(d->m_width, yLine-HEIGHT_COTA), QPointF(d->m_width, yLine+HEIGHT_COTA));
		// Ahora dibujamos los triángulos
		QPolygonF polygon;
		// Si el tamaño es menor que el ancho de las puntas de flecha, se dibujan al revés
		if ( d->m_width < HEIGHT_COTA ) {
			polygon << QPointF(0, yLine)
					<< QPointF(-1*(HEIGHT_COTA/2), (HEIGHT_COTA/2)+yLine)
					<< QPointF(-1*(HEIGHT_COTA/2), -1 * (HEIGHT_COTA/2)+yLine);
			painter->drawPolygon(polygon);
			polygon.clear();
			polygon << QPointF(d->m_width, yLine)
					<< QPointF(d->m_width + (HEIGHT_COTA/2), -1 * (HEIGHT_COTA/2)+yLine)
					<< QPointF(d->m_width + (HEIGHT_COTA/2), (HEIGHT_COTA/2)+yLine);
			painter->drawPolygon(polygon);
		} else {
			polygon << QPointF(0, yLine)
					<< QPointF((HEIGHT_COTA/2), (HEIGHT_COTA/2)+yLine)
					<< QPointF((HEIGHT_COTA/2), -1 * (HEIGHT_COTA/2)+yLine);
			painter->drawPolygon(polygon);
			polygon.clear();
			polygon << QPointF(d->m_width, HEIGHT_TOTAL - 3)
					<< QPointF(d->m_width - (HEIGHT_COTA/2), -1 * (HEIGHT_COTA/2)+yLine)
					<< QPointF(d->m_width - (HEIGHT_COTA/2), (HEIGHT_COTA/2)+yLine);
			painter->drawPolygon(polygon);
		}

		QFont font("Arial", 8);
		font.setStyleStrategy(QFont::ForceOutline);
		double fontScale = 0.5;
		QString text = QString("%1 %2").arg(d->m_width).arg(d->m_unit);
		QRectF rect;
		painter->setPen(QPen(Qt::black, 1));
		painter->setFont(font);
		painter->scale(fontScale, fontScale);
		d->m_textWidth = painter->fontMetrics().width(text);
		rect = QRectF((d->m_width < d->m_textWidth ? -d->m_textWidth/(2*fontScale) : 0), 0,
					  (d->m_width < d->m_textWidth ? d->m_textWidth/fontScale : d->m_width/fontScale),
						HEIGHT_TOTAL/fontScale);
		painter->drawText(rect, Qt::AlignCenter, text);
	}
}
开发者ID:BaconGo,项目名称:alepherp,代码行数:53,代码来源:cota.cpp

示例4: shape

QPainterPath UBGraphicsTriangle::shape() const
{
    QPainterPath tShape;
    QPolygonF tPolygon;

    tPolygon << A1 << B1 << C1;
    tShape.addPolygon(tPolygon);
    tPolygon.clear();

    tPolygon << A2 << B2 << C2;
    tShape.addPolygon(tPolygon);
    tPolygon.clear();

    return tShape;
}
开发者ID:Tonicminds,项目名称:Sankore-3.1,代码行数:15,代码来源:UBGraphicsTriangle.cpp

示例5: drawLineHead

/**
 * Paint arrow
 */
void drawLineHead (QPainter * painter, QPointF end, double angle, double size, bool figure)
{
    QPointF lineP1 = end + QPointF( sin( angle + Pi / 3) * size, cos( angle + Pi / 3) * size);
    QPointF lineP2 = end + QPointF( sin( angle + Pi - Pi / 3) * size, cos( angle + Pi - Pi / 3) * size);
	QPointF centre = (lineP1 + lineP2 + end)/3;

	if (figure)
	{
		QPainterPath arrow;
		arrow.moveTo (end);
		arrow.quadTo (centre, lineP1);
		arrow.lineTo (lineP2);
		arrow.quadTo (centre, end);

		painter->drawPath (arrow);
	}
	else
	{
		QPolygonF lineHead;
		lineHead.clear();
		lineHead << end << lineP1 << lineP2;
	
		painter->drawPolygon (lineHead);
	}
}
开发者ID:MIPT-ILab,项目名称:MIPT-Vis,代码行数:28,代码来源:gui_edge.cpp

示例6: clippedLineWKB

QgsConstWkbPtr QgsClipper::clippedLineWKB( QgsConstWkbPtr wkbPtr, const QgsRectangle& clipExtent, QPolygonF& line )
{
  QgsWKBTypes::Type wkbType = wkbPtr.readHeader();

  int nPoints;
  wkbPtr >> nPoints;

  int skipZM = ( QgsWKBTypes::coordDimensions( wkbType ) - 2 ) * sizeof( double );

  if ( static_cast<int>( nPoints * ( 2 * sizeof( double ) + skipZM ) ) > wkbPtr.remaining() )
  {
    QgsDebugMsg( QString( "%1 points exceed wkb length (%2>%3)" ).arg( nPoints ).arg( nPoints * ( 2 * sizeof( double ) + skipZM ) ).arg( wkbPtr.remaining() ) );
    return QgsConstWkbPtr( nullptr, 0 );
  }

  double p0x, p0y, p1x = 0.0, p1y = 0.0; //original coordinates
  double p1x_c, p1y_c; //clipped end coordinates
  double lastClipX = 0.0, lastClipY = 0.0; //last successfully clipped coords

  line.clear();
  line.reserve( nPoints + 1 );

  for ( int i = 0; i < nPoints; ++i )
  {
    if ( i == 0 )
    {
      wkbPtr >> p1x >> p1y;
      wkbPtr += skipZM;
      continue;
    }
    else
    {
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:32,代码来源:qgsclipper.cpp

示例7: drawDots

void Plot::drawDots(QVector< QVector<struct numCluster> > data, double n, double k, int index, int size, int number)
{
    int j, l;
    QPolygonF points;
    QwtPlotCurve *curve;

    QwtSymbol *symbol;

    points.clear();
    curve = new QwtPlotCurve();//QString("y = norm%1(x)").arg(index));
    curve->setItemAttribute(QwtPlotItem::Legend, false);
    curve->setStyle( QwtPlotCurve::Dots );
    for (l = 0; l < data.size(); l++){
        if (data[l][number].cluster == index){
            // ПЕРЕДЕЛАТЬ если возможно!!! Нужно, чтобы он печатал сразу для всех кластеров одной л.п.
            if (index == 0 && data[l][number].number < n){
                points << QPointF(data[l][number].number, 1);
            }else if (index == size - 1 && data[l][number].number > n){
                points << QPointF(data[l][number].number, 1);
            }else{
                points << QPointF(data[l][number].number, func_normal(data[l][number].number,n,k));
            }

            //std::cout << index << "data = " << data[l][i].number << std::endl;
        }
    }
    curve->setSamples(points);
    switch (index % 5){
    case 0:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::yellow ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    case 1:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::green ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    case 2:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::cyan ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    case 3:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::magenta ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    case 4:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::gray ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    default:
        break;
    }
    curve->attach(this);
    this->replot();
}
开发者ID:kmi9work,项目名称:Fires,代码行数:59,代码来源:plot.cpp

示例8: getTransformedPoints

void HgTransformedQuad::getTransformedPoints(QPolygonF& poly) const
{
    poly.clear();
    poly.append(mTransformedPoints[0].toPointF());
    poly.append(mTransformedPoints[1].toPointF());
    poly.append(mTransformedPoints[2].toPointF());
    poly.append(mTransformedPoints[3].toPointF());
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:8,代码来源:hgtransformedquad.cpp

示例9: transformerEnPolygone

void Triangle::transformerEnPolygone(QPolygonF &polygone , QVector<QPointF>& points)
{
    polygone.clear();
    polygone.push_back(points[this->sommets[0]]);
    polygone.push_back(points[this->sommets[1]]);
    polygone.push_back(points[this->sommets[2]]);

}
开发者ID:khalilBF,项目名称:Incremental-Delaunay,代码行数:8,代码来源:triangle.cpp

示例10: makeCirclePolygon

void DataConverter::makeCirclePolygon(QPolygonF &points, qreal radius)
{
	points.clear();

	for (int i = 0; i < 1440; i++)
	{
		points.append( QPointF( radius * qSin( 2 *3.14145 * i / 1440.0), radius * qCos( 2 * 3.14159 * i / 1440.0 )) );
	}
}
开发者ID:new5244,项目名称:qt,代码行数:9,代码来源:dataconverter.cpp

示例11: paintElements

void paintElements( AbstractDiagram::Private *diagramPrivate, PaintContext* ctx,
                    const LabelPaintCache& lpc, const LineAttributesInfoList& lineList )
{
    AbstractDiagram* diagram = diagramPrivate->diagram;
    // paint all lines and their attributes
    const PainterSaver painterSaver( ctx->painter() );
    ctx->painter()->setRenderHint( QPainter::Antialiasing, diagram->antiAliasing() );

    QBrush curBrush;
    QPen curPen;
    QPolygonF points;
    KDAB_FOREACH ( const LineAttributesInfo& lineInfo, lineList ) {
        const QModelIndex& index = lineInfo.index;
        const ThreeDLineAttributes td = threeDLineAttributes( diagram, index );

        if ( td.isEnabled() ) {
            PaintingHelpers::paintThreeDLines( ctx, diagram, index, lineInfo.value,
                                               lineInfo.nextValue, td, &diagramPrivate->reverseMapper );
        } else {
            const QBrush brush( diagram->brush( index ) );
            const QPen pen( diagram->pen( index ) );

            // line goes from lineInfo.value to lineInfo.nextValue
            diagramPrivate->reverseMapper.addLine( lineInfo.index.row(), lineInfo.index.column(),
                                                   lineInfo.value, lineInfo.nextValue );

            if ( points.count() && points.last() == lineInfo.value && curBrush == brush && curPen == pen ) {
                // continue the current run of lines
            } else {
                // different painter settings or discontinuous line: start a new run of lines
                if ( points.count() ) {
                    PaintingHelpers::paintPolyline( ctx, curBrush, curPen, points );
                }
                curBrush = brush;
                curPen = pen;
                points.clear();
                points << lineInfo.value;
            }
            points << lineInfo.nextValue;
        }
    }
    if ( points.count() ) {
        // the last run of lines is yet to be painted - do it now
        PaintingHelpers::paintPolyline( ctx, curBrush, curPen, points );
    }

    KDAB_FOREACH ( const LineAttributesInfo& lineInfo, lineList ) {
        const ValueTrackerAttributes vt = valueTrackerAttributes( diagram, lineInfo.index );
        if ( vt.isEnabled() ) {
            PaintingHelpers::paintValueTracker( ctx, vt, lineInfo.nextValue );
        }
    }

    // paint all data value texts and the point markers
    diagramPrivate->paintDataValueTextsAndMarkers( ctx, lpc, true );
}
开发者ID:Wushaowei001,项目名称:mksPlanner,代码行数:56,代码来源:PaintingHelpers_p.cpp

示例12: painterSaver

// this method is factored out from LineDiagram::paint, and contains
// the common parts of the method that  previously implemented all
// chart types in one
void LineDiagram::LineDiagramType::paintElements(
    PaintContext* ctx,
    DataValueTextInfoList& list,
    LineAttributesInfoList& lineList,
    LineAttributes::MissingValuesPolicy policy )
{
    Q_UNUSED( policy );
    // paint all lines and their attributes
    const PainterSaver painterSaver( ctx->painter() );
    if ( diagram()->antiAliasing() )
        ctx->painter()->setRenderHint ( QPainter::Antialiasing );
    LineAttributesInfoListIterator itline ( lineList );

    QBrush curBrush;
    QPen curPen;
    QPolygonF points;
    while ( itline.hasNext() ) {
        const LineAttributesInfo& lineInfo = itline.next();
        const QModelIndex& index = lineInfo.index;
        const ThreeDLineAttributes td = diagram()->threeDLineAttributes( index );
        const ValueTrackerAttributes vt = diagram()->valueTrackerAttributes( index );

        if( td.isEnabled() ){
            paintThreeDLines( ctx, index, lineInfo.value, lineInfo.nextValue, td.depth() );
        } else {
            const QBrush br( diagram()->brush( index ) );
            const QPen pn( diagram()->pen( index ) );
            if( points.count() && points.last() == lineInfo.value && curBrush == br && curPen == pn ) {
                // line goes from last value in points to lineInfo.nextValue
                reverseMapper().addLine( lineInfo.index.row(), lineInfo.index.column(), points.last(), lineInfo.nextValue );
                points << lineInfo.nextValue;
            } else {
                if( points.count() )
                    paintPolyline( ctx, curBrush, curPen, points );
                curBrush = br;
                curPen   = pn;
                points.clear();
                // line goes from lineInfo.value to lineInfo,nextValue
                reverseMapper().addLine( lineInfo.index.row(), lineInfo.index.column(), lineInfo.value, lineInfo.nextValue );
                points << lineInfo.value << lineInfo.nextValue;
            }
        }

        if( vt.isEnabled() )
            paintValueTracker( ctx, vt, lineInfo.value );
    }
    if( points.count() )
        paintPolyline( ctx, curBrush, curPen, points );
    // paint all data value texts and the point markers
    paintDataValueTextsAndMarkers( diagram(), ctx, list, true );
}
开发者ID:czchen,项目名称:debian-massif-visualizer,代码行数:54,代码来源:KDChartLineDiagram_p.cpp

示例13: drawTabs

void HorizontalPaintingStrategy::drawTabs(const KoRulerPrivate *d, QPainter &painter)
{
    if (! d->showTabs)
        return;
    QPolygonF polygon;

    painter.setBrush(d->ruler->palette().color(QPalette::Text));
    painter.setRenderHint( QPainter::Antialiasing );

    foreach (const KoRuler::Tab & t, d->tabs) {
        qreal x;
        if (d->rightToLeft)
            x = d->viewConverter->documentToViewX(d->activeRangeEnd - t.position)
                    + d->offset;
        else
            x = d->viewConverter->documentToViewX(d->activeRangeStart + t.position)
                    + d->offset;

        polygon.clear();
        switch (t.type) {
        case QTextOption::LeftTab:
            polygon << QPointF(x+0.5, d->ruler->height() - 8.5)
                << QPointF(x-5.5, d->ruler->height() - 2.5)
                << QPointF(x+0.5, d->ruler->height() - 2.5);
            painter.drawPolygon(polygon);
            break;
        case QTextOption::RightTab:
            polygon << QPointF(x+0.5, d->ruler->height() - 8.5)
                << QPointF(x+6.5, d->ruler->height() - 2.5)
                << QPointF(x+0.5, d->ruler->height() - 2.5);
            painter.drawPolygon(polygon);
            break;
        case QTextOption::CenterTab:
            polygon << QPointF(x+0.5, d->ruler->height() - 8.5)
                << QPointF(x-5.5, d->ruler->height() - 2.5)
                << QPointF(x+6.5, d->ruler->height() - 2.5);
            painter.drawPolygon(polygon);
            break;
        case QTextOption::DelimiterTab:
            polygon << QPointF(x-5.5, d->ruler->height() - 2.5)
                << QPointF(x+0.5, d->ruler->height() - 8.5)
                << QPointF(x+6.5, d->ruler->height() - 2.5);
            painter.drawPolyline(polygon);
            break;
        default:
            break;
        }
    }
    //painter.setRenderHint( QPainter::Antialiasing, false );
}
开发者ID:KDE,项目名称:koffice,代码行数:50,代码来源:KoRuler.cpp

示例14: drawDistanceLine

void HorizontalDistancesPaintingStrategy::drawDistanceLine(const KoRulerPrivate *d, QPainter &painter, const qreal start, const qreal end)
{

    // Don't draw too short lines
    if (qMax(start, end) - qMin(start, end) < 1)
        return;

    painter.save();
    painter.translate(d->offset, d->ruler->height() / 2);
    painter.setPen(d->ruler->palette().color(QPalette::Text));
    painter.setBrush(d->ruler->palette().color(QPalette::Text));

    QLineF line(QPointF(d->viewConverter->documentToViewX(start), 0),
            QPointF(d->viewConverter->documentToViewX(end), 0));
    QPointF midPoint = line.pointAt(0.5);

    // Draw the label text
    QFont font = KGlobalSettings::smallestReadableFont();
    font.setPointSize(6);
    QFontMetrics fontMetrics(font);
    QString label = d->unit.toUserStringValue(
            d->viewConverter->viewToDocumentX(line.length())) + ' ' + KUnit::unitName(d->unit);
    QPointF labelPosition = QPointF(midPoint.x() - fontMetrics.width(label)/2,
            midPoint.y() + fontMetrics.ascent()/2);
    painter.setFont(font);
    painter.drawText(labelPosition, label);

    // Draw the arrow lines
    qreal arrowLength = (line.length() - fontMetrics.width(label)) / 2 - 2;
    arrowLength = qMax(qreal(0.0), arrowLength);
    QLineF startArrow(line.p1(), line.pointAt(arrowLength / line.length()));
    QLineF endArrow(line.p2(), line.pointAt(1.0 - arrowLength / line.length()));
    painter.drawLine(startArrow);
    painter.drawLine(endArrow);

    // Draw the arrow heads
    QPolygonF arrowHead;
    arrowHead << line.p1() << QPointF(line.x1()+3, line.y1()-3)
        << QPointF(line.x1()+3, line.y1()+3);
    painter.drawPolygon(arrowHead);
    arrowHead.clear();
    arrowHead << line.p2() << QPointF(line.x2()-3, line.y2()-3)
        << QPointF(line.x2()-3, line.y2()+3);
    painter.drawPolygon(arrowHead);

    painter.restore();
}
开发者ID:KDE,项目名称:koffice,代码行数:47,代码来源:KoRuler.cpp

示例15: drawIndents

void HorizontalPaintingStrategy::drawIndents(const KoRulerPrivate *d, QPainter &painter)
{
    QPolygonF polygon;

    painter.setBrush(d->ruler->palette().brush(QPalette::Base));
    painter.setRenderHint( QPainter::Antialiasing );

    qreal x;
    // Draw first line start indent
    if (d->rightToLeft)
        x = d->effectiveActiveRangeEnd() - d->firstLineIndent - d->paragraphIndent;
    else
        x = d->effectiveActiveRangeStart() + d->firstLineIndent + d->paragraphIndent;
    // convert and use the +0.5 to go to nearest integer so that the 0.5 added below ensures sharp lines
    x = int(d->viewConverter->documentToViewX(x) + d->offset + 0.5);
    polygon << QPointF(x+6.5, 0.5)
        << QPointF(x+0.5, 8.5)
        << QPointF(x-5.5, 0.5)
        << QPointF(x+5.5, 0.5);
    painter.drawPolygon(polygon);

    // draw the hanging indent.
    if (d->rightToLeft)
        x = d->effectiveActiveRangeStart() + d->endIndent;
    else
        x = d->effectiveActiveRangeStart() + d->paragraphIndent;
    // convert and use the +0.5 to go to nearest integer so that the 0.5 added below ensures sharp lines
    x = int(d->viewConverter->documentToViewX(x) + d->offset + 0.5);
    const int bottom = d->ruler->height();
    polygon.clear();
    polygon << QPointF(x+6.5, bottom - 0.5)
        << QPointF(x+0.5, bottom - 8.5)
        << QPointF(x-5.5, bottom - 0.5)
        << QPointF(x+5.5, bottom - 0.5);
    painter.drawPolygon(polygon);

    // Draw end-indent or paragraph indent if mode is rightToLeft
    qreal diff;
    if (d->rightToLeft)
        diff = d->viewConverter->documentToViewX(d->effectiveActiveRangeEnd()
                     - d->paragraphIndent) + d->offset - x;
    else
        diff = d->viewConverter->documentToViewX(d->effectiveActiveRangeEnd() - d->endIndent)
                + d->offset - x;
    polygon.translate(diff, 0);
    painter.drawPolygon(polygon);
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:47,代码来源:KoRuler.cpp


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