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


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

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


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

示例1: drawCrossHair

void drawCrossHair(QPainter& paint, int x, int y){
    paint.setPen(QColor(255,0,0));
    paint.moveTo(x,y-4);
    paint.lineTo(x,y+4);
    paint.moveTo(x-4,y);
    paint.lineTo(x+4,y);
}
开发者ID:phillipstanleymarbell,项目名称:sunflower-simulator,代码行数:7,代码来源:GraphView.C

示例2: drawContent

void WLinePlot::drawContent(QPainter &p, bool completeRedraw) {

    completeRedraw=true;

    QArray<float>::Iterator xIt, yIt;

    p.eraseRect(p.window());

    if (!traces.isEmpty() && xData.count()>0) {

        if (wrapAround) {

            p.setPen(SolidLine);

            // cycle traces and draw them
            for (WGraphTrace *trace=traces.first();
                    trace !=0; trace=traces.next())
                if (trace->isVisible()) {

                    p.setPen(trace->getPen());

                    xIt=xData.begin();
                    yIt=trace->getData().begin();
                    p.moveTo(mapToViewCoords(*xIt,*yIt));
                    for (++xIt, ++yIt; xIt<xData.end(); ++xIt, ++yIt)
                        p.lineTo(mapToViewCoords(*xIt,*yIt));
                }

            // drawing new cursor at newPos+1
            if (cursorPos<traceLength()-1) {
                int x1 = mapToViewCoords(xData[cursorPos],0).x();
                int x2 = mapToViewCoords(xData[cursorPos+1],0).x()+1;
                p.fillRect(x1,p.window().top(),x2-x1,p.window().height(),red);
            }
        } else {

            float *x=xData.data(), *y;

            for (WGraphTrace *trace=traces.first();
                    trace !=0; trace=traces.next())
                if (trace->isVisible()) {

                    y=trace->getData().data();

                    p.setPen(trace->getPen());
                    p.moveTo(mapToViewCoords(x[0],y[(cursorPos+1) %
                                                    traceLength()]));

                    for (int i=1; i<traceLength(); i++)
                        p.lineTo(mapToViewCoords(x[i],y[(i+cursorPos+1) %
                                                        traceLength()]));
                }
        }
    }
}
开发者ID:jeez,项目名称:iqr,代码行数:55,代码来源:wLinePlot.cpp

示例3: draw

void CanvasKugarTemplate::draw( QPainter &painter ) {
	painter.setPen( QColor( 0, 0, 0 ) );
	QPoint p1( ( int ) ( x() + props[ "LeftMargin" ].first.toInt() ),
	           ( int ) ( y() + props[ "TopMargin" ].first.toInt() ) );
	QPoint p2( ( int ) ( x() + props[ "LeftMargin" ].first.toInt() ),
	           ( int ) y() + height() - props[ "BottomMargin" ].first.toInt() );
	QPoint p3( ( int ) x() + width() - props[ "RightMargin" ].first.toInt(),
	           ( int ) y() + height() - props[ "BottomMargin" ].first.toInt() );
	QPoint p4( ( int ) x() + width() - props[ "RightMargin" ].first.toInt(),
	           ( int ) ( y() + props[ "TopMargin" ].first.toInt() ) );
	painter.moveTo( p1 );
	painter.lineTo( p2 );
	painter.lineTo( p3 );
	painter.lineTo( p4 );
	painter.lineTo( p1 );
	/*    painter.drawRect((int)(x()+props["LeftMargin"].first.toInt()),
			     (int)(y()+props["TopMargin"].first.toInt()),
			     width() - props["LeftMargin"].first.toInt() - props["RightMargin"].first.toInt(),
			     height() - props["TopMargin"].first.toInt() - props["BottomMargin"].first.toInt());*/
	CanvasSection::draw( painter );
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:21,代码来源:canvbox.cpp

示例4: drawOffCap

void RDTransportButton::drawOffCap()
{
  QPainter p;
  QPointArray triangle=QPointArray(3);
  int edge;

  if(height()<width()) {
    edge=height();
  }
  else {
    edge=width();
  }
  drawMask(off_cap);
  p.begin(off_cap);
  p.setPen(QColor(black));
  p.setBrush(QColor(black));
  switch(button_type) {
      case RDTransportButton::Play:
	triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2+(3*edge)/10,height()/2);
	triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10);
	p.drawPolygon(triangle);
	p.setPen(QColor(colorGroup().shadow()));
	p.moveTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10);
	p.lineTo(width()/2-(3*edge)/10,height()/2-(3*edge)/10);
	p.setPen(QColor(colorGroup().dark()));
	p.lineTo(width()/2+(3*edge)/10,height()/2);
	p.setPen(QColor(colorGroup().light()));
	p.lineTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10);
	break;
      case RDTransportButton::Stop:
	p.fillRect(width()/2-edge*3/10,height()/2-edge*3/10,
		   edge*3/5,edge*3/5,QColor(colorGroup().shadow()));
	p.setPen(QColor(colorGroup().shadow()));
	p.moveTo(width()/2-edge*3/10,height()/2+edge*3/10);
	p.lineTo(width()/2-edge*3/10,height()/2-edge*3/10);
	p.lineTo(width()/2+edge*3/10,height()/2-edge*3/10);
	p.setPen(QColor(colorGroup().light()));
	p.lineTo(width()/2+edge*3/10,height()/2+edge*3/10);
	p.lineTo(width()/2-edge*3/10,height()/2+edge*3/10);
	break;
      case RDTransportButton::Record:
	p.setPen(QColor(darkRed));
	p.setBrush(QColor(darkRed));
	p.drawEllipse(width()/2-(3*edge)/10,height()/2-(3*edge)/10,
		      (3*edge)/5,(3*edge)/5);
	break;
      case RDTransportButton::FastForward:
	triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2,height()/2);
	triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10);
	p.drawPolygon(triangle);
	p.setPen(QColor(colorGroup().shadow()));
	p.moveTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10);
	p.lineTo(width()/2-(3*edge)/10,height()/2-(3*edge)/10);
	p.setPen(QColor(colorGroup().dark()));
	p.lineTo(width()/2,height()/2);
	p.setPen(QColor(colorGroup().light()));
	p.lineTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10);
	triangle.setPoint(0,width()/2,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2+(3*edge)/10,height()/2);
	triangle.setPoint(2,width()/2,height()/2+(3*edge)/10);
	p.drawPolygon(triangle);
	p.drawPolygon(triangle);
	p.setPen(QColor(colorGroup().shadow()));
	p.moveTo(width()/2,height()/2+(3*edge)/10);
	p.lineTo(width()/2,height()/2-(3*edge)/10);
	p.setPen(QColor(colorGroup().dark()));
	p.lineTo(width()/2+(3*edge)/10,height()/2);
	p.setPen(QColor(colorGroup().light()));
	p.lineTo(width()/2,height()/2+(3*edge)/10);
	break;
      case RDTransportButton::Rewind:
	triangle.setPoint(0,width()/2+(3*edge)/10,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2,height()/2);
	triangle.setPoint(2,width()/2+(3*edge)/10,height()/2+(3*edge)/10);
	p.drawPolygon(triangle);
	p.setPen(QColor(colorGroup().shadow()));
	p.moveTo(width()/2+(3*edge)/10,height()/2-(3*edge)/10);
	p.lineTo(width()/2,height()/2);
	p.setPen(QColor(colorGroup().dark()));
	p.lineTo(width()/2+(3*edge)/10,height()/2+(3*edge)/10);
	p.setPen(QColor(colorGroup().light()));
	p.lineTo(width()/2+(3*edge)/10,height()/2-(3*edge)/10);
	triangle.setPoint(0,width()/2,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2-(3*edge)/10,height()/2);
	triangle.setPoint(2,width()/2,height()/2+(3*edge)/10);
	p.drawPolygon(triangle);
	p.setPen(QColor(colorGroup().shadow()));
	p.moveTo(width()/2,height()/2-(3*edge)/10);
	p.lineTo(width()/2-(3*edge)/10,height()/2);
	p.setPen(QColor(colorGroup().dark()));
	p.lineTo(width()/2,height()/2+(3*edge)/10);
	p.setPen(QColor(colorGroup().light()));
	p.lineTo(width()/2,height()/2-(3*edge)/10);
	break;
      case RDTransportButton::Eject:
	triangle.setPoint(0,width()/2,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2+(3*edge)/10,height()/2);
	triangle.setPoint(2,width()/2-(3*edge)/10,height()/2);
//.........这里部分代码省略.........
开发者ID:stgabmp,项目名称:Rivendell,代码行数:101,代码来源:rdtransportbutton.cpp

示例5: drawMask

void RDTransportButton::drawMask(QPixmap *cap)
{
  QPointArray triangle=QPointArray(3);
  QPainter b;
  QBitmap *bitmap=new QBitmap(size());
  int edge;

  if(height()<width()) {
    edge=height();
  }
  else {
    edge=width();
  }
  cap->resize(size());
  b.begin(bitmap);
  b.fillRect(0,0,size().width(),size().height(),QColor(color0));
  b.setPen(QColor(color1));
  b.setBrush(QColor(color1));

  switch(button_type) {
      case RDTransportButton::Play:
	triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2+(3*edge)/10,height()/2);
	triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10);
	b.drawPolygon(triangle);
	break;
      case RDTransportButton::Stop:
	b.fillRect(width()/2-edge*3/10,height()/2-edge*3/10,
		   edge*3/5,edge*3/5,QColor(color1));
	break;
      case RDTransportButton::Record:
	b.drawEllipse(width()/2-(3*edge)/10,height()/2-(3*edge)/10,
		      (3*edge)/5,(3*edge)/5);
	break;
      case RDTransportButton::FastForward:
	triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2,height()/2);
	triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10);
	b.drawPolygon(triangle);
	triangle.setPoint(0,width()/2,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2+(3*edge)/10,height()/2);
	triangle.setPoint(2,width()/2,height()/2+(3*edge)/10);
	b.drawPolygon(triangle);
	break;
      case RDTransportButton::Rewind:
	triangle.setPoint(0,width()/2+(3*edge)/10,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2,height()/2);
	triangle.setPoint(2,width()/2+(3*edge)/10,height()/2+(3*edge)/10);
	b.drawPolygon(triangle);
	triangle.setPoint(0,width()/2,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2-(3*edge)/10,height()/2);
	triangle.setPoint(2,width()/2,height()/2+(3*edge)/10);
	b.drawPolygon(triangle);
	break;
      case RDTransportButton::Eject:
	triangle.setPoint(0,width()/2,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2+(3*edge)/10,height()/2);
	triangle.setPoint(2,width()/2-(3*edge)/10,height()/2);
	b.drawPolygon(triangle);
	b.fillRect(width()/2-(3*edge)/10,height()/2+edge/10,
		   (3*edge)/5,edge/5,QColor(color1));
	break;
      case RDTransportButton::Pause:
	b.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10,
		   (3*edge)/15,(3*edge)/5,QColor(color1));
	b.fillRect(width()/2+(3*edge)/30,height()/2-(3*edge)/10,
		   (3*edge)/15,(3*edge)/5,QColor(color1));
	break;
      case RDTransportButton::PlayFrom:
	b.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10,
		   3,(3*edge)/5,QBrush(color1));
	triangle.setPoint(0,width()/2-(2*edge)/10+1,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2+(3*edge)/10+1,height()/2);
	triangle.setPoint(2,width()/2-(2*edge)/10+1,height()/2+(3*edge)/10);
	b.drawPolygon(triangle);
	break;
      case RDTransportButton::PlayBetween:
	b.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10,
		   3,(3*edge)/5,QBrush(color1));
	b.fillRect(width()/2+(3*edge)/10,height()/2-(3*edge)/10,
		   3,(3*edge)/5,QBrush(color1));
	triangle.setPoint(0,width()/2-(2*edge)/10+1,height()/2-(3*edge)/10);
	triangle.setPoint(1,width()/2+(2*edge)/10+1,height()/2);
	triangle.setPoint(2,width()/2-(2*edge)/10+1,height()/2+(3*edge)/10);
	b.drawPolygon(triangle);
	break;
      case RDTransportButton::Loop:
	b.moveTo(width()/2-(2*edge)/10+1,height()/2+(edge)/4);
	b.moveTo(width()/2+(edge)/10+1,height()/2-edge/10);
	b.moveTo(width()/2-(2*edge)/10+1,height()/2+(edge)/4);
	b.drawArc(width()/6,height()/2-edge/9,2*width()/3,
		  height()/3+edge/10,1440,5760);
	triangle.setPoint(0,width()/2-(2*edge)/10+1,height()/2-(edge)/4);
	triangle.setPoint(1,width()/2+(edge)/10+1,height()/2-edge/10);
	triangle.setPoint(2,width()/2-(2*edge)/10+1,height()/2+edge/20);
	b.drawPolygon(triangle);
	break;
      case RDTransportButton::Up:
	triangle.setPoint(0,width()/2,(3*edge)/10);
	triangle.setPoint(1,width()/2+(3*edge)/10,height()-(3*edge)/10);
//.........这里部分代码省略.........
开发者ID:stgabmp,项目名称:Rivendell,代码行数:101,代码来源:rdtransportbutton.cpp

示例6: drawEdge

void drawEdge(QPainter& paint, int x1, int y1, int x2, int y2){
    paint.setPen(QColor(0,0,255));
    paint.moveTo(x1,y1);
    paint.lineTo(x2,y2);
}
开发者ID:phillipstanleymarbell,项目名称:sunflower-simulator,代码行数:5,代码来源:GraphView.C

示例7: Plot

/*
*Function:Plot
*draws the graph to the DC
*Inputs:none
*Outputs:none
*Returns:none
*/
void Graph::Plot(QPainter &DC, const QRect &rect,  QColor bkg) 
{
	IT_IT("Graph::Plot");
	
	QFont fnt("times",10); 
	DC.setFont(fnt);
	//
	int lr_border, tb_border, dtwidth; 
	QFontMetrics m(fnt);
	//
	// Workout the legend space needed on the right
	lr_border = N_Y_CHAR * m.width('0'); // left border size
	int rborder = lr_border; // right border size
	tb_border = N_X_CHAR * m.height(); 
	for(DATAMAP::iterator i = plotMap.begin(); !(i == plotMap.end()); i++)
	{
		int w = m.width((*i).first);
		if(w > rborder) rborder = w;
	};
	//
	rborder += m.width('0') * 2;
	dtwidth = m.width("WWW 01 WWW 2000  "); // width of the date string
	//
	//
	bool fTimeLegend = false;
	bool fYLegend = false;
	//
	if(rect.width() > (lr_border * 2 + rborder))
	{
		fYLegend = true;
	}
	//
	if(rect.height() > tb_border * 3)
	{
		if(rect.width() > dtwidth)
		{
			fTimeLegend = true;
		}
	};
	//
	int dx = 0;
	if(fYLegend)
	{	
		dx = lr_border;
	};
	//
	int dy = 0;
	if(fTimeLegend)
	{
		dy = tb_border;
	};
	//
	plotRect = QRect(rect.left() + dx,rect.top() + dy, rect.right() - (dx + rborder), rect.bottom() - 2*dy); // get space
	DC.fillRect(plotRect,QBrush(bkg));
	DC.setPen(Qt::red);
	DC.drawRect(plotRect);
	if(fTimeLegend)
	{
		if(plotRect.width() > lr_border) 
		{
			DC.setPen(Qt::black);
			if(rect.width() > dtwidth *3)
			{
				PlotTimeLegend(DC, minTime,plotRect.left(),plotRect.bottom(),dtwidth/2,m.height());
			};
			PlotTimeLegend(DC, halfTime,(plotRect.left() + plotRect.right())/2,plotRect.bottom(),dtwidth/2,m.height());
			if(rect.width() > dtwidth * 3)
			{
				PlotTimeLegend(DC, maxTime,plotRect.right(),plotRect.bottom(),dtwidth/2,m.height());
			};
			DC.setPen(Qt::lightGray);
			for(int i = 1; i < 4; i++)
			{
				int x = plotRect.left() + (plotRect.width() * i) / 4;
				DC.moveTo(x ,plotRect.bottom());
				DC.lineTo(x ,plotRect.top());
			};
		};
	};
	if(fYLegend)
	{
		scaleMax = scaleSave; 
		if(logMode)
		{
			DC.setPen(Qt::black);
			int nsteps = (int)scaleMax;                        // this is required number of steps
			int maxsteps = plotRect.height() / m.height() / 2; // this is the max number of steps we can have
			//
			if(nsteps > maxsteps)
			{
				// not enough room so put only the top and bottom values
				QString s;
				DC.drawText(	2, plotRect.bottom(),		"1");
//.........这里部分代码省略.........
开发者ID:jiajw0426,项目名称:easyscada,代码行数:101,代码来源:graph.cpp

示例8: paintSpawnIcon

void MapIcons::paintSpawnIcon(MapParameters& param, 
			      QPainter& p, 
			      const MapIcon& mapIcon,
			      const Spawn* spawn, 
			      const EQPoint& location,
			      const QPoint& point)
{
  // ------------------------
  // Draw Walk Path
  if (mapIcon.showWalkPath() ||
      (m_showNPCWalkPaths && spawn->isNPC()))
  {
    SpawnTrackListIterator trackIt(spawn->trackList());
    
    const SpawnTrackPoint* trackPoint = trackIt.current();
    if (trackPoint)
    {
      if (!mapIcon.useWalkPathPen())
	p.setPen(blue);
      else
	p.setPen(mapIcon.walkPathPen());

      p.moveTo (param.calcXOffsetI(trackPoint->x()), 
		param.calcYOffsetI(trackPoint->y()));
      
      while ((trackPoint = ++trackIt) != NULL)
	p.lineTo (param.calcXOffsetI (trackPoint->x()), 
		  param.calcYOffsetI (trackPoint->y()));
      
      p.lineTo (point.x(), point.y());
    }
  }

  // Draw Line
  if (mapIcon.showLine0())
  {
    p.setPen(mapIcon.line0Pen());
    p.drawLine(param.playerXOffset(), 
	       param.playerYOffset(),
	       point.x(), point.y());
  }

  // calculate distance and draw distance related lines
  uint32_t distance = UINT32_MAX;
  if (mapIcon.line1Distance() || mapIcon.line2Distance() || 
      m_showSpawnNames)
  {
    if (!showeq_params->fast_machine)
      distance = location.calcDist2DInt(param.player());
    else
      distance = (int)location.calcDist(param.player());
    
    if (mapIcon.line1Distance() > distance)
    {
      p.setPen(mapIcon.line1Pen());
      p.drawLine(param.playerXOffset(), 
		 param.playerYOffset(),
		 point.x(), point.y());
    }

    if (mapIcon.line2Distance() > distance)
    {
      p.setPen(mapIcon.line2Pen());
      p.drawLine(param.playerXOffset(), 
		 param.playerYOffset(),
		 point.x(), point.y());
    }
  }

  // Draw Spawn Names
  if (mapIcon.showName() || 
      (m_showSpawnNames && (distance < m_fovDistance)))
  {
    QString spawnNameText;
    
    spawnNameText.sprintf("%2d: %s",
			  spawn->level(),
			  (const char*)spawn->name());
    
    QFontMetrics fm(param.font());
    int width = fm.width(spawnNameText);
    p.setPen(gray);
    p.drawText(point.x() - (width / 2),
	       point.y() + fm.height() + 1, spawnNameText);
  }
  
  // Draw the Icon
  if (mapIcon.image() && 
      (!mapIcon.imageFlash() || m_flash) &&
      (mapIcon.imageStyle() != tIconStyleNone))
  {
    if (mapIcon.imageUseSpawnColorPen())
    {
      QPen pen = mapIcon.imagePen();
      pen.setColor(pickSpawnColor(spawn));
      p.setPen(pen);
    }
    else
      p.setPen(mapIcon.imagePen());

//.........这里部分代码省略.........
开发者ID:xbackupx,项目名称:showeqx,代码行数:101,代码来源:mapicon.cpp

示例9: drawSegment

void QLCDNumber::drawSegment( const QPoint &pos, char segmentNo, QPainter &p,
			      int segLen, bool erase )
{
    QPoint pt = pos;
    int width = segLen/5;

    const QColorGroup & g = colorGroup();
    QColor lightColor,darkColor,fgColor;
    if ( erase ){
	lightColor = backgroundColor();
	darkColor  = lightColor;
	fgColor    = lightColor;
    } else {
	lightColor = g.light();
	darkColor  = g.dark();
	fgColor    = g.foreground();
    }

#define LINETO(X,Y) addPoint( a, QPoint(pt.x() + (X),pt.y() + (Y)))
#define LIGHT
#define DARK

    if ( fill ) {
	QPointArray a(0);

	//The following is an exact copy of the switch below.
	//don't make any changes here
	switch ( segmentNo ) {
	case 0 :
	    p.moveTo(pt);
	    LIGHT;
	    LINETO(segLen - 1,0);
	    DARK;
	    LINETO(segLen - width - 1,width);
	    LINETO(width,width);
	    LINETO(0,0);
	    break;
	case 1 :
	    pt += QPoint(0 , 1);
	    p.moveTo(pt);
	    LIGHT;
	    LINETO(width,width);
	    DARK;
	    LINETO(width,segLen - width/2 - 2);
	    LINETO(0,segLen - 2);
	    LIGHT;
	    LINETO(0,0);
	    break;
	case 2 :
	    pt += QPoint(segLen - 1 , 1);
	    p.moveTo(pt);
	    DARK;
	    LINETO(0,segLen - 2);
	    LINETO(-width,segLen - width/2 - 2);
	    LIGHT;
	    LINETO(-width,width);
	    LINETO(0,0);
	    break;
	case 3 :
	    pt += QPoint(0 , segLen);
	    p.moveTo(pt);
	    LIGHT;
	    LINETO(width,-width/2);
	    LINETO(segLen - width - 1,-width/2);
	    LINETO(segLen - 1,0);
	    DARK;
	    if (width & 1) {		// adjust for integer division error
		LINETO(segLen - width - 3,width/2 + 1);
		LINETO(width + 2,width/2 + 1);
	    } else {
		LINETO(segLen - width - 1,width/2);
		LINETO(width,width/2);
	    }
	    LINETO(0,0);
	    break;
	case 4 :
	    pt += QPoint(0 , segLen + 1);
	    p.moveTo(pt);
	    LIGHT;
	    LINETO(width,width/2);
	    DARK;
	    LINETO(width,segLen - width - 2);
	    LINETO(0,segLen - 2);
	    LIGHT;
	    LINETO(0,0);
	    break;
	case 5 :
	    pt += QPoint(segLen - 1 , segLen + 1);
	    p.moveTo(pt);
	    DARK;
	    LINETO(0,segLen - 2);
	    LINETO(-width,segLen - width - 2);
	    LIGHT;
	    LINETO(-width,width/2);
	    LINETO(0,0);
	    break;
	case 6 :
	    pt += QPoint(0 , segLen*2);
	    p.moveTo(pt);
	    LIGHT;
//.........这里部分代码省略.........
开发者ID:opieproject,项目名称:qte-opie,代码行数:101,代码来源:qlcdnumber.cpp

示例10: DrawWaveform

void CPreview::DrawWaveform(QPainter &DC)
	{

	int nActiveScreen=pDisplay->nActiveScreen;

	if(nActiveScreen==-1) return;


	double amin=-3000., amax=3000.;
	double ttt=-1.;
    QPen YellowPen(QColor(255,255,0));
	CDataBlock *xfd;
	CMWindow *wfi;
	DC.setPen(YellowPen);

	pDisplay->Critical.lock();

	wfi = pDisplay->WaveformInfo.at(nActiveScreen);

// find max and min
	BOOL bfirstcount=TRUE;

	for(xfd = wfi->xferData.first();xfd;xfd = wfi->xferData.next())
		{
		double t1packet=xfd->beg;
		double t2packet=xfd->end;
		int nsamp=xfd->nsamp;
		for(int k=0; k<nsamp; ++k)
			{
			long a=xfd->data[k];
			double tt=t1packet+xfd->sint*k;

			if(tt<pDisplay->tB1) continue;
			if(tt>pDisplay->tB2) break;
			if(!bfirstcount)
				{
				if(a>amax) amax=a;
				if(a<amin) amin=a;
				}
			else
				{
				bfirstcount=FALSE;
				amax=a;
				amin=a;
				}

			}
		}


//*************************************
	for(xfd = wfi->xferData.first();xfd;xfd = wfi->xferData.next())
		{
		double t1packet=xfd->beg;
		double t2packet=xfd->end;
		int nsamp=xfd->nsamp;
		for(int k=0; k<nsamp; ++k)
			{
			long a=xfd->data[k];
			double tt=t1packet+xfd->sint*k;
			int x,y;

			if(tt<pDisplay->tB1) continue;
			if(tt>pDisplay->tB2) break;

			x=(int)((tt-pDisplay->tB1)*(x2-x1)/(pDisplay->tB2-pDisplay->tB1)+x1+0.5);
			y=(int)((a-amin)*(y2-y1)/(amax-amin)+y1+0.5);
			y=MaxY-y;
			if(tt-ttt>1.1*xfd->sint)
				{
				DC.moveTo(x,y);		
				}
			else
				{
				DC.lineTo(x,y);		
				}
			ttt=tt;
			}
		}
	pDisplay->Critical.unlock();
	}
开发者ID:jandog8990,项目名称:asl-station-processor,代码行数:81,代码来源:Preview.cpp

示例11: drawSegment


//.........这里部分代码省略.........
      
      pts.setPoints(3,pt.x()+1, pt.y()-1,
		    pt.x() + Width, pt.y() - Width,
		    pt.x() + Width, pt.y() - 1 );
      p.drawPolygon(pts);
      
      pts.setPoints(3, pt.x() + Segment_Length - 1, pt.y()-1,
		    pt.x() + Segment_Length - Width , pt.y() - Width, 
		    pt.x() + Segment_Length - Width , pt.y() - 1 );
             
      p.drawPolygon(pts);
      
      if (erase) 
	p.setPen(g.light());
      
      
      
      break;
    case 7 :
      pt.rx() += (QCOORD)(Segment_Length/2);
      pt.ry() += (QCOORD)(Segment_Length*2);
      p.fillRect(pt.x()  ,pt.y() - Width , Width , Width  ,brush);
      break;
    case 8 :
      pt.ry() += (QCOORD)(Segment_Length/2 + Width/2);
      pt.rx() += (QCOORD)(Segment_Length/2 - Width/2 + 1);
      
      if (!show_off_colon && erase) {
	p.setBrush(bgcolor);
        brush.setColor(bgcolor);
      }

      p.fillRect(pt.x()  ,pt.y() - Width  , Width , Width  ,brush);
      p.moveTo(pt);
      
      if (!show_off_colon && erase) {
	p.setBrush(fgcolor);
        brush.setColor(fgcolor);
      }

      break;
    case 9 :
      pt.ry() += (QCOORD)(3*Segment_Length/2 + Width/2);
      pt.rx() += (QCOORD)(Segment_Length/2 - Width/2 + 1);

      if (!show_off_colon && erase) {
	p.setBrush(bgcolor);
        brush.setColor(bgcolor);
      }
      p.fillRect(pt.x() ,pt.y() - Width  , Width , Width  ,brush);

      if (!show_off_colon && erase) {
	p.setBrush(fgcolor);
        brush.setColor(fgcolor);
      }
      break;
    }
    
  } /*  if (!smallLED) */
  
  else{
    
    pt.ry() += (QCOORD)Width/2;
    
    switch ( seg_number ) {
    case 0 :
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:67,代码来源:bwlednum.cpp


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