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


C++ QPainter::drawArc方法代码示例

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


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

示例1: PaintComp

void NOR_component::PaintComp(QPainter &p){
    if(!ref.isNull())
    {
        QPoint lStart(ref.x()+20,ref.y());
        QPoint lEnd(ref.x()+20,ref.y()+80);
        QPoint centar(ref.x()+75,ref.y()+40);
        //unutrasnji luk
        p.drawArc(lStart.x()-20,lStart.y(),40,80,-90*16, 180*16);

        //produzeci zbog estetike
        p.drawLine(lStart.x(),lStart.y(),lStart.x()+20,lStart.y());
        p.drawLine(lStart.x(),lStart.y()+80,lStart.x()+20,lStart.y()+80);

        //spoljasnji krug
        p.drawArc(lStart.x()-10,lStart.y(),60,80,-90*16, 180*16);

        //pinovi
        p.drawLine(ref.x(),ref.y()+30,ref.x()+38,ref.y()+30);
        p.drawLine(ref.x(),ref.y()+50,ref.x()+38,ref.y()+50);
        p.drawLine(ref.x()+80,ref.y()+40,ref.x()+90,ref.y()+40);

        //kruzic za not
        p.drawEllipse(centar,5,5);
    }
}
开发者ID:CisimEjirtimid,项目名称:Schemtastic,代码行数:25,代码来源:nor_component.cpp

示例2: paintEvent

void SLErrorWidget::paintEvent(QPaintEvent *) {
  QPainter paint (this);
  double ww = QWidget::width();
  double wh = QWidget::height()-30;
  double scale_x = ww/static_cast<double>(width);
  double scale_y = wh/static_cast<double>(height);
  scale = (scale_x<scale_y ? scale_x : scale_y);
  offset_x = 0.5*(ww-scale*width);
  offset_y = 0.5*(wh-scale*height);
  if (own_half>0)
    paint.setWorldMatrix (QMatrix (scale, 0, 0, scale, offset_x, offset_y));
  else
    paint.setWorldMatrix (QMatrix (-scale, 0, 0, -scale, ww-offset_x, wh-offset_y));


  for (unsigned int i=0; i<width; i++)
    for (unsigned int j=0; j<height; j++) {
      unsigned int g=error_array[i][j];
      paint.setPen (QColor (g,g,g));
      paint.fillRect (i,j,2,2, QBrush (QColor (g,g,g), Qt::SolidPattern));
    }
  paint.setPen (QPen(Qt::blue,2));
  paint.drawArc (best_i-1, best_j-1, 3, 3, 0, 5760);  // beste Position einzeichnen
  if (ci) {
    paint.setPen (QPen(Qt::cyan,2));
    if (ci->rloc_vis.size()>0) {
      Tribots::Vec cur = field2widget (ci->rloc_vis[0].pos);
      paint.drawArc (static_cast<int>(cur.x)-1, static_cast<int>(cur.y)-1, 3, 3, 0, 5760);  // aktuelle Position zeichnen

      paint.setPen (QPen(Qt::magenta,2));
      cur = field2widget (optimising_pos);
      paint.drawArc (static_cast<int>(cur.x)-1, static_cast<int>(cur.y)-1, 3, 3, 0, 5760);  // optimierte Position zeichnen
    }
  }
}
开发者ID:Sean3Don,项目名称:opentribot,代码行数:35,代码来源:SLErrorWidget.cpp

示例3: draw_pointer

void draw_pointer(int x, int y, QPainter & painter)
{
    painter.setPen(Qt::black);
    painter.drawArc(x - POINTER_SIZE / 2, y - POINTER_SIZE / 2, 
                    POINTER_SIZE, POINTER_SIZE, 0, 16 * 360);
    painter.setPen(Qt::white);
    painter.drawArc(x - POINTER_SIZE2 / 2, y - POINTER_SIZE2 / 2, 
                    POINTER_SIZE2, POINTER_SIZE2, 0, 16 * 360);
}
开发者ID:Dakror,项目名称:voxie,代码行数:9,代码来源:palette.cpp

示例4: qRound

/*!

 */
void
FieldPainter::drawPenaltyAreaLines( QPainter & painter ) const
{
    const Options & opt = Options::instance();

    // set gdi objects
    painter.setPen( M_line_pen );
    painter.setBrush( Qt::NoBrush );

    // set screen coordinates of field
    int left_x   = opt.screenX( - Options::PITCH_HALF_LENGTH );
    int right_x  = opt.screenX( + Options::PITCH_HALF_LENGTH );

    // set penalty area params
    int pen_top_y    = opt.screenY( - Options::PENALTY_AREA_WIDTH*0.5 );
    int pen_bottom_y = opt.screenY( + Options::PENALTY_AREA_WIDTH*0.5 );
    double pen_circle_y_degree_abs
        = std::acos( ( Options::PENALTY_AREA_LENGTH - Options::PENALTY_SPOT_DIST )
                     / Options::PENALTY_CIRCLE_R )
        * ( 180.0 / M_PI );
    int span_angle = qRound( pen_circle_y_degree_abs * 2.0 * 16 );
    int pen_circle_r = opt.scale( Options::PENALTY_CIRCLE_R );
    int pen_circle_size = opt.scale( Options::PENALTY_CIRCLE_R * 2.0 );

    // left penalty area X
    int pen_x = opt.screenX( -( Options::PITCH_HALF_LENGTH - Options::PENALTY_AREA_LENGTH ) );
    // left arc
    int pen_spot_x = opt.screenX( -( Options::PITCH_HALF_LENGTH - Options::PENALTY_SPOT_DIST ) );
    painter.drawArc( pen_spot_x - pen_circle_r + 1,
                     opt.fieldCenter().y() - pen_circle_r,
                     pen_circle_size,
                     pen_circle_size,
                     qRound( -pen_circle_y_degree_abs * 16 ),
                     span_angle );
    // left rectangle
    painter.drawLine( left_x, pen_top_y, pen_x, pen_top_y );
    painter.drawLine( pen_x, pen_top_y, pen_x, pen_bottom_y );
    painter.drawLine( pen_x, pen_bottom_y, left_x, pen_bottom_y );
    // left spot
    painter.drawPoint( pen_spot_x, opt.fieldCenter().y() );

    // right penalty area X
    pen_x = opt.screenX( +( Options::PITCH_HALF_LENGTH - Options::PENALTY_AREA_LENGTH ) );
    // right arc
    pen_spot_x = opt.screenX( +( Options::PITCH_HALF_LENGTH - Options::PENALTY_SPOT_DIST ) );
    painter.drawArc( pen_spot_x - pen_circle_r,
                     opt.fieldCenter().y() - pen_circle_r,
                     pen_circle_size, pen_circle_size,
                     qRound( ( 180.0 - pen_circle_y_degree_abs + 0.5 ) * 16 ),
                     span_angle );
    // right rectangle
    painter.drawLine( right_x, pen_top_y, pen_x, pen_top_y );
    painter.drawLine( pen_x, pen_top_y, pen_x, pen_bottom_y );
    painter.drawLine( pen_x, pen_bottom_y, right_x, pen_bottom_y );
    // right spot
    painter.drawPoint( pen_spot_x, opt.fieldCenter().y() );
}
开发者ID:edymanoloiu,项目名称:FotbalRobotic,代码行数:60,代码来源:field_painter.cpp

示例5: draw

void GEVor::draw(QPainter& painter)
{
    painter.save();

    painter.setPen(QPen(m_active_color));
    
    QPointF center_xy;
    MYASSERT(m_projection->convertLatLonToXY(m_vor->getLatLon(), center_xy));
    painter.translate(center_xy.x(), center_xy.y());

    // outer circle
    QRectF rect(-VOR_OUTER_RADIUS, -VOR_OUTER_RADIUS, 2*VOR_OUTER_RADIUS, 2*VOR_OUTER_RADIUS);
    painter.drawArc(rect, 0, FULL_ARC);

    // middle circle
    rect = QRectF(-VOR_MIDDLE_RADIUS, -VOR_MIDDLE_RADIUS, 2*VOR_MIDDLE_RADIUS, 2*VOR_MIDDLE_RADIUS);
    painter.drawArc(rect, 0, FULL_ARC);

    // inner circle
    rect = QRectF(-VOR_INNER_RADIUS, -VOR_INNER_RADIUS, 2*VOR_INNER_RADIUS, 2*VOR_INNER_RADIUS);
    painter.drawArc(rect, 0, FULL_ARC);

    // crown lines
    painter.save();
    QLineF line(0, VOR_MIDDLE_RADIUS, 0, VOR_OUTER_RADIUS);
    int max_rotation = 12;
    for(int rotation = 0; rotation<max_rotation; ++rotation)
    {
        painter.rotate(360/(double)max_rotation);
        painter.drawLine(line);
    }
    painter.restore();

    // text


//     double text_dist = 30;
//     double text_angle = -135.0;

//     painter.rotate(text_angle);
//     painter.translate(0, -text_dist);
//     line = QLineF(0,0, 0, text_dist-VOR_OUTER_RADIUS);
//     painter.drawLine(line);
//     painter.rotate(-text_angle);

//     QRect text_bounding_rect = 
//         painter.boundingRect(QRect(0, 0, 500, 500), Qt::AlignLeft | Qt::AlignTop, text);

//     QRectF text_rect = QRectF(-text_bounding_rect.width(), 0,
//                               text_bounding_rect.width(), text_bounding_rect.height());

//     painter.drawRect(text_rect);
//     painter.drawText(text_rect, text);

    painter.restore();
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:56,代码来源:ge_vor.cpp

示例6: paint

void dslDial::paint(QPainter &p, QRectF dialRect, QColor dialColor, bool hover, bool inc)
{
    p.setRenderHint(QPainter::Antialiasing, true);
    p.setPen(dialColor);
    p.setBrush(dialColor);

    int dialStartAngle = 225 * 16;
    int dialSpanAngle = -270 * 16;

    // draw dial arc
    p.drawArc(dialRect, dialStartAngle, dialSpanAngle);
    // draw ticks
    p.save();
    p.translate(dialRect.center());
    p.rotate(45);
    for (uint64_t i = 0; i < _div; i++) {
        // draw major ticks
        p.drawLine(0, dialRect.width()/2+3, 0, dialRect.width()/2+8);
        // draw minor ticks
        for (uint64_t j = 0; (j < 5) && (i < _div - 1); j++) {
            p.drawLine(0, dialRect.width()/2+3, 0, dialRect.width()/2+5);
            p.rotate(54.0/(_div-1));
        }
    }
    // draw pointer
    p.rotate(90+270.0/(_div-1)*_sel);
    p.drawEllipse(-3, -3, 6, 6);
    p.drawLine(3, 0, 0, dialRect.width()/2-3);
    p.drawLine(-3, 0, 0, dialRect.width()/2-3);
    p.restore();
    // draw value
    uint64_t displayValue = _value[_sel]*_factor;
    uint64_t displayIndex = 0;
    while(displayValue / _step >= 1) {
        displayValue = displayValue / _step;
        displayIndex++;
    }
    QString pText = QString::number(displayValue) + _unit[displayIndex] + "/div";
    QFontMetrics fm(p.font());
    const QRectF valueRect = QRectF(dialRect.left(), dialRect.bottom()-dialRect.width()*0.3+fm.height()*0.5, dialRect.width(), fm.height());
    p.drawText(valueRect, Qt::AlignCenter, pText);

    // draw +/-
    if (hover) {
        const int arcInc = 15;
        const QRectF hoverRect = QRectF(dialRect.left()-arcInc, dialRect.top()-arcInc, dialRect.width()+arcInc*2, dialRect.height()+arcInc*2);
        const double arcSpan = hoverRect.width()/(2*sqrt(2));
        p.drawArc(hoverRect, 135 * 16, -90 * 16);
        if (inc)
            p.drawLine(hoverRect.center().x()+arcSpan, hoverRect.center().y()-arcSpan,
                       hoverRect.center().x()+arcSpan-4, hoverRect.center().y()-arcSpan-10);
        else
            p.drawLine(hoverRect.center().x()-arcSpan, hoverRect.center().y()-arcSpan,
                       hoverRect.center().x()-arcSpan+4, hoverRect.center().y()-arcSpan-10);
    }
}
开发者ID:contandreev,项目名称:DSView,代码行数:56,代码来源:dsldial.cpp

示例7: ThaiCucQuyen

void graphics::ThaiCucQuyen(QPainter& painter)
{
    int w=width();
    int h=height();
    QPoint a(w/2,h/2);
    painter.drawEllipse(a,200,200);
// 2 Hinh Tron Nho
    painter.drawEllipse(w/2-120,h/2,30,30);
    painter.drawEllipse(w/2+100,h/2,30,30);
// 2 Can Moc
    painter.drawArc(w/2-200,h/2-100,200,200,0,16*-180);
    painter.drawArc(w/2,h/2-100,200,200,0,16*180);
}
开发者ID:xdien,项目名称:my_qtprojects,代码行数:13,代码来源:graphics.cpp

示例8: drawValue

void QRoundProgressBar::drawValue(QPainter &p, const QRectF &baseRect, double value, double arcLength)
{
    // nothing to draw
    if (value == m_min)
        return;

    // for Line style
    if (m_barStyle == StyleLine)
    {
        p.setPen(QPen(palette().highlight().color(), m_dataPenWidth));
        p.setBrush(Qt::NoBrush);
        p.drawArc(baseRect.adjusted(m_outlinePenWidth/2, m_outlinePenWidth/2, -m_outlinePenWidth/2, -m_outlinePenWidth/2),
                  m_nullPosition * 16,
                  -arcLength * 16);
        return;
    }

    // for Pie and Donut styles
    QPainterPath dataPath;
    dataPath.setFillRule(Qt::WindingFill);

    // pie segment outer
    dataPath.moveTo(baseRect.center());
    dataPath.arcTo(baseRect, m_nullPosition, -arcLength);
    dataPath.lineTo(baseRect.center());

    p.setBrush(palette().highlight());
    p.setPen(QPen(palette().shadow().color(), m_dataPenWidth));
    p.drawPath(dataPath);
}
开发者ID:Jinxiaohai,项目名称:QT,代码行数:30,代码来源:QRoundProgressBar.cpp

示例9: drawShape

void PicItem::drawShape( QPainter & p )
{
	int _x = int(x());
	int _y = int(y());
	
	p.setBrush( QColor( 0xef, 0xff, 0xef ) );
	p.setFont( font() );
	
	p.drawRoundRect( _x, _y, width(), height(), 2000/width(), 2000/height() );
	
	p.drawText( _x+TopPadding-2, _y, width()-TopPadding+2, TopPadding, Qt::AlignVCenter, i18n("PIC Settings") );
	
	if ( !m_bExpanded )
		return;
	
	// Draw rectangle to cut off pins
	p.setBrush( QColor( 239, 255, 255 ) );
	QRect r( _x+SidePadding, _y+TopPadding, InnerWidth, m_innerHeight );
	p.drawRect(r);
	
	// Draw dimple thingy at end of pic
	p.drawArc( r.x()+(r.width()-ArcWidth)/2, r.y()+1-ArcWidth/2, ArcWidth, ArcWidth, 180*16, 180*16 );
	
	// Draw vertical text centered in PIC
	p.translate( r.width()/2 + r.x(), r.height()/2 + r.y() );
	p.rotate(90);
	QRect textRect( r.width()/-2, r.height()/-2, r.width(), r.height() );
	p.drawText( textRect, Qt::AlignCenter, microSettings->microInfo()->id() );
	
	p.rotate(-90);
	p.translate( r.width()/-2 - r.x(), r.height()/-2 - r.y() );
}
开发者ID:ktechlab,项目名称:ktechlab-0.3,代码行数:32,代码来源:picitem.cpp

示例10: renderDataTransferProgress

	void FileSharingWidget::renderDataTransferProgress(QPainter &p)
	{
		assert(Metainfo_.FileSize_ >= 0);
		assert(BytesTransferred_ >= 0);
		assert(BytesTransferred_ <= Metainfo_.FileSize_);
		assert(DownloadingBarBaseAngle_ >= DOWNLOADING_BAR_BASE_ANGLE_MIN);
		assert(DownloadingBarBaseAngle_ <= DOWNLOADING_BAR_BASE_ANGLE_MAX);

		p.save();

		auto percents = 1.0;
		if (Metainfo_.FileSize_ > 0)
		{
			percents = std::max(0.05, (double)BytesTransferred_ / (double)Metainfo_.FileSize_);
		}
		assert(percents <= (1.0 + std::numeric_limits<double>::epsilon()));

		const auto angle = (int)std::ceil(percents * 360 * 16);
		assert(angle <= (361 * 16));

		const auto penWidth = Utils::scale_value(PROGRESS_PEN_WIDTH);
		QPen pen(QBrush(Qt::black), penWidth);
		p.setPen(pen);

		const auto baseAngle = (DownloadingBarBaseAngle_ * 16);
		p.drawArc(getControlButtonRect(), -baseAngle, -angle);

		p.restore();
	}
开发者ID:ICoderXI,项目名称:icqdesktop,代码行数:29,代码来源:FileSharingWidget.cpp

示例11: PaintComp

void NAND_component::PaintComp(QPainter &p)
{
    if(!ref.isNull())
    {
        if(selektovan==true){
              p.setPen(Qt::red);
        }
        else
        {
           p.setPen(Qt::black);
        }
        QPoint lStart(ref.x()+20,ref.y());
        QPoint lEnd(ref.x()+20,ref.y()+80);
        QPoint centar(ref.x()+65,ref.y()+40);

        //komponenta
        p.drawLine(lStart.x(),lStart.y(),lEnd.x(),lEnd.y());
        p.drawArc(lStart.x()-40,lStart.y(),80,80,-90*16, 180*16);
        p.drawEllipse(centar,5,5);

        //pinovi
        p.drawLine(ref.x(),ref.y()+30,ref.x()+20,ref.y()+30);
        p.drawLine(ref.x(),ref.y()+50,ref.x()+20,ref.y()+50);
        p.drawLine(ref.x()+70,ref.y()+40,ref.x()+90,ref.y()+40);
    }
}
开发者ID:obllivion,项目名称:Schemtastic3_0_alpha,代码行数:26,代码来源:nand_component.cpp

示例12: draw

void GEAirport::draw(QPainter& painter)
{
    painter.save();

    QPointF center_xy;
    MYASSERT(m_projection->convertLatLonToXY(m_airport->getLatLon(), center_xy));
    painter.translate(center_xy.x(), center_xy.y());

    QPen pen(m_active_color);
    pen.setWidthF(APT_CIRCLE_WIDTH);
    painter.setPen(pen);

    // circle
    QRectF rect(-APT_CIRCLE_RADIUS, -APT_CIRCLE_RADIUS, 2*APT_CIRCLE_RADIUS, 2*APT_CIRCLE_RADIUS);
    painter.drawArc(rect, 0, FULL_ARC);

    // crown

    pen.setWidthF(APT_CIRCLE_CROWN_WIDTH);
    painter.setPen(pen);
    
    QLineF line(0, APT_CIRCLE_RADIUS, 0, APT_CIRCLE_RADIUS + APT_CIRCLE_CROWN_HEIGHT);
    int max_rotation = 6;
    for(int rotation=1; rotation<=max_rotation; ++rotation)
    {
        painter.rotate(360/(double)max_rotation);
        painter.drawLine(line);
    }

    painter.restore();
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:31,代码来源:ge_airport.cpp

示例13: paintArc

void t_libraryEditor::paintArc(QPainter &painter, const t_ArcObject &ob)
{
    QPen dotPen;
    dotPen.setWidth(ob.thickness);
    dotPen.setStyle(Qt::SolidLine);
    dotPen.setColor(g_color);
    painter.setPen(dotPen);
    painter.drawArc(ob.posx - ob.radius, ob.posy - ob.radius, ob.radius*2, ob.radius*2 , ob.start_angle, ob.end_angle);
}
开发者ID:Coolbeer,项目名称:CoolCAD,代码行数:9,代码来源:t_libraryeditor.cpp

示例14: _drawArc

void GoalRenderer::_drawArc(QPainter &painter, GoalElement* ele)
{
    // arc
    painter.setPen(QPen(QColor(255, 255, 240), 3));
    QRectF rect(mRectX, mRectY, mRectW, mRectH);
    painter.drawRect(rect); // debug
    painter.setPen(QPen(QColor(255, 0, 0), 3));
    painter.drawArc(rect, 16 * ele->getStartAngle(), 16 * ele->getEndAngle());
}
开发者ID:atomy,项目名称:qt,代码行数:9,代码来源:GoalRenderer.cpp

示例15: init

void GfxCanvasRoundedRect::init()
{
    if(!_vdirty)
        return;
    dirty();
    _vdirty = false;

    if(_cornerCurve) {
        ul = QImage(_cornerCurve, _cornerCurve, 
                    QImage::Format_ARGB32_Premultiplied); 
        ul.fill(0);
        QPainter p;
        p.begin(&ul);
        p.setPen(QPen(_color, _lineWidth));
        p.setBrush(_color);
        p.setRenderHint(QPainter::Antialiasing);

        if(_filled) {
            p.drawEllipse(QRectF(qreal(_lineWidth) / 2, qreal(_lineWidth) / 2, 
                             _cornerCurve * 2, _cornerCurve * 2));
        } else {
            p.drawArc(QRectF(qreal(_lineWidth) / 2, qreal(_lineWidth) / 2, 
                             _cornerCurve * 2, _cornerCurve * 2), 
                      90 * 16, 90 * 16);
        }
        p.end();
        ur = ul.mirrored(true, false);
        ll = ul.mirrored(false, true);
        lr = ul.mirrored(true, true);
    } else {
        ul = QImage();
        ur = ul;
        ll = ul;
        lr = ul;
    }

    upper = QImage(15, _lineWidth, QImage::Format_ARGB32_Premultiplied);
    left = QImage(_lineWidth, 15, QImage::Format_ARGB32_Premultiplied);
  
    upper.fill(0); 
    left.fill(0);

    QPainter p;
    p.begin(&upper);
    p.setPen(QPen(_color, _lineWidth));
    p.setRenderHint(QPainter::Antialiasing);
    p.drawLine(QPointF(0, qreal(_lineWidth) / 2), QPointF(15, qreal(_lineWidth) / 2));
    p.end();
    p.begin(&left);
    p.setPen(QPen(_color, _lineWidth));
    p.setRenderHint(QPainter::Antialiasing);
    p.drawLine(QPointF((qreal)(_lineWidth) / 2, 0), QPointF(qreal(_lineWidth) / 2, 15));
    p.end();
    lower = upper.mirrored(false, true);
    right = left.mirrored(true, false);
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:56,代码来源:gfxcanvas.cpp


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