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); }
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()])); } } } }
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 ); }
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); p.drawPolygon(triangle); p.fillRect(width()/2-(3*edge)/10,height()/2+edge/10, (3*edge)/5,edge/5,QColor(black)); break; case RDTransportButton::Pause: p.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,QColor(black)); 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.lineTo(width()/2-(3*edge)/10+(3*edge)/15,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(3*edge)/10+(3*edge)/15,height()/2+(3*edge)/10); p.lineTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); p.fillRect(width()/2+(3*edge)/30,height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,QColor(black)); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2+(3*edge)/30,height()/2+(3*edge)/10); p.lineTo(width()/2+(3*edge)/30,height()/2-(3*edge)/10); 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); p.lineTo(width()/2+(3*edge)/30,height()/2+(3*edge)/10); break; case RDTransportButton::PlayFrom: p.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(accent_color)); 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); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); p.lineTo(width()/2-(2*edge)/10+1,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2+(3*edge)/10+1,height()/2); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); break; case RDTransportButton::PlayBetween: p.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(accent_color)); p.fillRect(width()/2+(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(accent_color)); 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); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); p.lineTo(width()/2-(2*edge)/10+1,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2+(2*edge)/10+1,height()/2); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); break; case RDTransportButton::Loop: 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); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(2*edge)/10+1,height()/2+(edge)/4); p.lineTo(width()/2+(edge)/10+1,height()/2-edge/10); p.setPen(QColor(colorGroup().dark())); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(2*edge)/10+1,height()/2+(edge)/4); p.setPen(QColor(colorGroup().shadow())); p.drawArc(width()/6,height()/2-edge/9,2*width()/3, height()/3+edge/10,1440,5760); break; case RDTransportButton::Up: triangle.setPoint(0,width()/2,(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,height()-(3*edge)/10); triangle.setPoint(2,width()/2-(3*edge)/10,height()-(3*edge)/10); p.drawPolygon(triangle); break; case RDTransportButton::Down: triangle.setPoint(0,width()/2,height()-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,(3*edge)/10); triangle.setPoint(2,width()/2-(3*edge)/10,(3*edge)/10); p.drawPolygon(triangle); break; case RDTransportButton::PlayTo: p.fillRect(width()/2+(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(accent_color)); triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(2*edge)/10+1,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+(2*edge)/10+1,height()/2); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); break; } p.end(); }
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); triangle.setPoint(2,width()/2-(3*edge)/10,height()-(3*edge)/10); b.drawPolygon(triangle); break; case RDTransportButton::Down: triangle.setPoint(0,width()/2,height()-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,(3*edge)/10); triangle.setPoint(2,width()/2-(3*edge)/10,(3*edge)/10); b.drawPolygon(triangle); break; case RDTransportButton::PlayTo: b.fillRect(width()/2+(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(color1)); triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(2*edge)/10+1,height()/2); triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10); b.drawPolygon(triangle); break; default: b.fillRect(0,0,width(),height(),QColor(color1)); } b.end(); cap->setMask(*bitmap); delete bitmap; }
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); }
/* *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"); s.sprintf("%8.5g",pow(scaleMax,10)); DC.drawText( 2, plotRect.top(), s); } else if(nsteps > 0) { int dy = plotRect.height() / nsteps; // double sc = 1.0; // QString s; for(int kk = 0; kk < nsteps; kk++) { s.sprintf("%8.5g",sc); DC.drawText( 2, plotRect.bottom() - kk * dy, s); sc *=10; }; // s.sprintf("%8.5g",sc); DC.drawText( 2, plotRect.top(), s); // for(int k = 0 ; k < nsteps; k++) { int y = plotRect.bottom() - k * dy; DC.setPen(Qt::lightGray); DC.moveTo(plotRect.left(), y); DC.lineTo(plotRect.right(), y); // // we are in log mode - maybe we should add some log graph lines too // is there enough space for some sub interval lines ? // if(dy > 40) { static int ltab[] = { //2,3,4,5,6,7,8,9 3010,4771,6021,6990,7782,8451,9031,9542 }; QPen dpen(Qt::lightGray,0,Qt::DotLine); DC.setPen(dpen); for(int j = 0 ; j < 8; j++) { int z = y - dy * ltab[j] / 10000; // get the sub division DC.moveTo(plotRect.left(), z); DC.lineTo(plotRect.right(),z); }; }; }; }; } else { DC.setPen(Qt::black); int nsteps = (plotRect.height() / m.height() / 3) + 1; if((nsteps > 1) && (timeRange > 0)) { // if((scaleMin == 0) && (scaleMax > 2)) { scaleMax = ceil(scaleMax); // if(nsteps > (int)scaleMax) { nsteps = (int)scaleMax; } else { double pt = floor(log10(scaleMax)); // // Power of ten // pt = pow(10.0,pt); int ns = (int)(scaleMax / pt) + 1; if(ns <= nsteps) { nsteps = ns; } else { double r = scaleMax; do { pt *= 2; r = ((double)nsteps) * pt; } while(r < scaleMax); }; scaleMax = ((double)nsteps) * pt; }; }; // double sy = 0.0; int dy = 0; if(nsteps != 0) sy = (scaleMax - scaleMin) / (double)nsteps; if(nsteps != 0) dy = plotRect.height() / nsteps; QString s; // handle the problem of small steps const char *Format = (sy < 1.0)?"%8.5g":"%6.1f"; for(int kk = 0; kk < nsteps; kk++) { s.sprintf(Format,scaleMin + sy * (double)kk); DC.drawText( 2, plotRect.bottom() - kk * dy, s); }; // s.sprintf(Format,scaleMax); // DC.drawText( 2, plotRect.top(), s); // // for(int k = 0 ; k < nsteps; k++) { int y = plotRect.bottom() - k * dy; DC.setPen(Qt::lightGray); DC.moveTo(plotRect.left(), y); DC.lineTo(plotRect.right(), y); // // How many sub lines to we add in // // we want 2, 4 or 10 int nl = dy / 5; if(nl > 1) { if(nl > 9) { nl = 9; } else if(nl < 4) { nl = 1; } else { nl = 3; }; for(int j = 1; j <= nl; j++) { int z = y - dy * j / (nl + 1); QPen dpen(Qt::lightGray,0,Qt::DotLine); DC.setPen(dpen); DC.moveTo(plotRect.left(), z); DC.lineTo(plotRect.right(), z); }; }; }; }; }; }; // if(timeRange > 0) { int nc = 0; for(DATAMAP::iterator i = plotMap.begin(); !(i == plotMap.end()); i++, nc++) { if((*i).second.size() > 0) { double dx = plotRect.width(); double dy = scaleMax - scaleMin; if(dy) { DC.setPen((*i).second.colour); dy = (double)plotRect.height() / dy; for(DataMap::iterator j = (*i).second.begin(); !(j == (*i).second.end());j++) { double x = (double) minTime.secsTo((*j).first) / timeRange * dx; double y = 0.0; // if(logMode) { if((*j).second > 1) { y = log10((*j).second) * dy; }; } else { y = ((*j).second - scaleMin) * dy; }; // if(j == (*i).second.begin()) { DC.moveTo((int)x + plotRect.left(),plotRect.bottom() - (int)y); } else { DC.lineTo((int)x + plotRect.left(),plotRect.bottom() - (int)y); }; }; }; DC.drawText(plotRect.right() + m.width('0'),plotRect.top() + nc * (m.height() + 2),(*i).first); }; }; DC.drawText(plotRect.right() + m.width('0'),plotRect.bottom(), GetNames()); }; };
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()); if (mapIcon.imageUseSpawnColorBrush()) { QBrush brush = mapIcon.imageBrush(); brush.setColor(pickSpawnColor(spawn)); p.setBrush(brush); } else p.setBrush(mapIcon.imageBrush()); mapIcon.paintIconImage(mapIcon.imageStyle(), p, point, *m_mapIconSizes[mapIcon.imageSize()], *m_mapIconSizesWH[mapIcon.imageSize()]); } // Draw the highlight if (mapIcon.highlight() && (!mapIcon.highlightFlash() || m_flash) && (mapIcon.highlightStyle() != tIconStyleNone)) { if (mapIcon.highlightUseSpawnColorPen()) { QPen pen = mapIcon.highlightPen(); pen.setColor(pickSpawnColor(spawn)); p.setPen(pen); } else p.setPen(mapIcon.highlightPen()); if (mapIcon.highlightUseSpawnColorBrush()) { QBrush brush = mapIcon.highlightBrush(); brush.setColor(pickSpawnColor(spawn)); p.setBrush(brush); } else p.setBrush(mapIcon.highlightBrush()); mapIcon.paintIconImage(mapIcon.highlightStyle(), p, point, *m_mapIconSizes[mapIcon.highlightSize()], *m_mapIconSizesWH[mapIcon.highlightSize()]); } }
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; LINETO(width,-width); LINETO(segLen - width - 1,-width); LINETO(segLen - 1,0); DARK; LINETO(0,0); break; case 7 : if ( smallPoint ) // if smallpoint place'.' between other digits pt += QPoint(segLen + width/2 , segLen*2); else pt += QPoint(segLen/2 , segLen*2); p.moveTo(pt); DARK; LINETO(width,0); LINETO(width,-width); LIGHT; LINETO(0,-width); LINETO(0,0); break; case 8 : pt += QPoint(segLen/2 - width/2 + 1 , segLen/2 + width); p.moveTo(pt); DARK; LINETO(width,0); LINETO(width,-width); LIGHT; LINETO(0,-width); LINETO(0,0); break; case 9 : pt += QPoint(segLen/2 - width/2 + 1 , 3*segLen/2 + width); p.moveTo(pt); DARK; LINETO(width,0); LINETO(width,-width); LIGHT; LINETO(0,-width); LINETO(0,0); break; #if defined(CHECK_RANGE) default : qWarning( "QLCDNumber::drawSegment: (%s) Internal error." " Illegal segment id: %d\n", name( "unnamed" ), segmentNo ); #endif } // End exact copy p.setPen( fgColor ); p.setBrush( fgColor ); p.drawPolygon( a ); p.setBrush( NoBrush ); pt = pos; } #undef LINETO #undef LIGHT #undef DARK #define LINETO(X,Y) p.lineTo(QPoint(pt.x() + (X),pt.y() + (Y))) #define LIGHT p.setPen(lightColor) #define DARK p.setPen(darkColor) if ( shadow ) 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; LINETO(width,-width); LINETO(segLen - width - 1,-width); LINETO(segLen - 1,0); DARK; LINETO(0,0); break; case 7 : if ( smallPoint ) // if smallpoint place'.' between other digits pt += QPoint(segLen + width/2 , segLen*2); else pt += QPoint(segLen/2 , segLen*2); p.moveTo(pt); DARK; LINETO(width,0); LINETO(width,-width); LIGHT; LINETO(0,-width); LINETO(0,0); break; case 8 : pt += QPoint(segLen/2 - width/2 + 1 , segLen/2 + width); p.moveTo(pt); DARK; LINETO(width,0); LINETO(width,-width); LIGHT; LINETO(0,-width); LINETO(0,0); break; case 9 : pt += QPoint(segLen/2 - width/2 + 1 , 3*segLen/2 + width); p.moveTo(pt); DARK; LINETO(width,0); LINETO(width,-width); LIGHT; LINETO(0,-width); LINETO(0,0); break; #if defined(CHECK_RANGE) default : qWarning( "QLCDNumber::drawSegment: (%s) Internal error." " Illegal segment id: %d\n", name( "unnamed" ), segmentNo ); #endif } #undef LINETO #undef LIGHT #undef DARK }
void MapCanvas::paintEvent( QPaintEvent * ) { QPainter pcanvas; LocationDialog *ld = (LocationDialog *)topLevelWidget(); KStars *ks = (KStars *)ld->parent(); //prepare the canvas pcanvas.begin( Canvas ); // pcanvas.fillRect( 0, 0, width(), height(), QBrush( QColor( BGColor ) ) ); pcanvas.drawPixmap( 0, 0, *bgImage ); // pcanvas.setBrush( white ); pcanvas.setPen( QPen( QColor( "SlateGrey" ) ) ); //Draw cities QPoint o; for ( GeoLocation *g=ks->data()->geoList.first(); g; g = ks->data()->geoList.next() ) { o.setX( int( g->lng()->Degrees() + origin.x() ) ); o.setY( height() - int( g->lat()->Degrees() + origin.y() ) ); if ( o.x() >= 0 && o.x() <= width() && o.y() >=0 && o.y() <=height() ) { pcanvas.drawPoint( o.x(), o.y() ); } } //redraw the cities that appear in the filtered list, with a white pen //If the list has not been filtered, skip the redraw. if ( ld->filteredList()->count() ) { pcanvas.setPen( white ); for ( GeoLocation *g=ld->filteredList()->first(); g; g = ld->filteredList()->next() ) { o.setX( int( g->lng()->Degrees() + origin.x() ) ); o.setY( height() - int( g->lat()->Degrees() + origin.y() ) ); if ( o.x() >= 0 && o.x() <= width() && o.y() >=0 && o.y() <=height() ) { pcanvas.drawPoint( o.x(), o.y() ); } } } GeoLocation *g = ld->selectedCity(); if ( g ) { o.setX( int( g->lng()->Degrees() + origin.x() ) ); o.setY( height() - int( g->lat()->Degrees() + origin.y() ) ); pcanvas.setPen( red ); pcanvas.setBrush( red ); pcanvas.drawEllipse( o.x()-3, o.y()-3, 6, 6 ); pcanvas.moveTo( o.x()-16, o.y() ); pcanvas.lineTo( o.x()-8, o.y() ); pcanvas.moveTo( o.x()+8, o.y() ); pcanvas.lineTo( o.x()+16, o.y() ); pcanvas.moveTo( o.x(), o.y()-16 ); pcanvas.lineTo( o.x(), o.y()-8 ); pcanvas.moveTo( o.x(), o.y()+8 ); pcanvas.lineTo( o.x(), o.y()+16 ); pcanvas.setPen( white ); pcanvas.setBrush( white ); } pcanvas.end(); bitBlt( this, 0, 0, Canvas ); }
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(); }
void BW_LED_Number::drawSegment( const QPoint &pos, char seg_number, QPainter &p, int Segment_Length, bool erase){ QPoint pt = pos; QColorGroup g = colorGroup(); QColor lightColor,darkColor; if ( erase ){ lightColor = offcolor; darkColor = offcolor; } else { lightColor = g.light(); darkColor = g.dark(); } // int Width = (int) Segment_Length/5 ; // original int Width = (int) Segment_Length/4; QBrush brush(g.light()); QPointArray pts; pt.ry() += (QCOORD)Width/2; if (erase){ p.setBrush(offcolor); brush.setColor(offcolor); } else p.setBrush(g.light()); if(!smallLED){ switch ( seg_number ) { case 0 : if (erase) p.setPen(offcolor); pts.setPoints(3,pt.x(), pt.y() , pt.x(), pt.y()-Width +1, pt.x() + Width-1, pt.y()); p.drawPolygon(pts); pts.setPoints(3,pt.x(), pt.y() + Segment_Length -Width - Width/2 -1 , pt.x() + Width -1 , pt.y() -Width +Segment_Length - Width/2 -1, pt.x() , pt.y() + Segment_Length - 3*Width/4 -1); p.drawPolygon(pts); if (erase) p.setPen(g.light()); p.fillRect(pt.x(),pt.y()+ Width/2 -1, Width , Segment_Length - Width -Width +1 ,brush); break; case 1 : p.fillRect(pt.x()+Width,pt.y()- Width , Segment_Length -2* Width, Width ,brush); if (erase) p.setPen(offcolor); pts.setPoints(3,pt.x()+1, pt.y()-Width , pt.x()+Width, pt.y()-Width , pt.x() + Width, pt.y() -1 ); p.drawPolygon(pts); pts.setPoints(3,pt.x()+ Segment_Length - Width , pt.y() - Width, pt.x()+ Segment_Length -1, pt.y() - Width, pt.x() + Segment_Length - Width , pt.y() -1 ); p.drawPolygon(pts); if (erase) p.setPen(g.light()); break; case 2 : pt.rx() += (QCOORD)(Segment_Length); if (erase) p.setPen(offcolor); pts.setPoints(3,pt.x() , pt.y() , pt.x() , pt.y() - Width + 1, // changes from 1 to 2 pt.x() - Width +1, pt.y() ); p.drawPolygon(pts); pts.setPoints(3,pt.x() , pt.y() + Segment_Length - Width - Width/2 -1, pt.x() , pt.y() + Segment_Length - 3*Width/4 - 1, pt.x() - Width +1, pt.y() + Segment_Length - Width - Width/2 -1); p.drawPolygon(pts); if (erase) p.setPen(g.light()); p.fillRect(pt.x() - Width+1 ,pt.y() + Width/2- 1, Width , Segment_Length - Width - Width + 1 ,brush); break; case 3 : pt.ry() += (QCOORD)Segment_Length; p.setPen(g.background()); pts.setPoints(3,pt.x()-1 , pt.y() - Width/2 -1, pt.x() + Width+2, pt.y()-Width -1 ,// pt.x() + Width+2, pt.y() ); p.drawPolygon(pts); pts.setPoints(3,pt.x() + Segment_Length + 1, pt.y() - Width/2 -1 , pt.x() + Segment_Length - Width - 2 , pt.y() - Width -1, pt.x() + Segment_Length - Width - 2, pt.y() ); p.drawPolygon(pts); p.setPen(g.light()); p.fillRect(pt.x() + Width -1 ,pt.y() - Width, Segment_Length- 2* Width + 3, Width ,brush); break; case 4 : pt.ry() += (QCOORD)(Segment_Length +1); p.fillRect(pt.x(), pt.y(), Width , Segment_Length - Width - Width/2 ,brush); if (erase) p.setPen(offcolor); pts.setPoints(3,pt.x(), pt.y(), pt.x(), pt.y()-Width+1, pt.x() + Width-1, pt.y()); p.drawPolygon(pts); pts.setPoints(3,pt.x(), pt.y() + Segment_Length -Width - Width/2 -1 , pt.x() + Width -1 , pt.y() -Width +Segment_Length - Width/2 -1 , pt.x() , pt.y() + Segment_Length - 3*Width/4 -1); p.drawPolygon(pts); if (erase) p.setPen(g.light()); break; case 5 : pt.rx() += (QCOORD)(Segment_Length ); pt.ry() += (QCOORD)(Segment_Length +1); p.fillRect(pt.x() - Width +1 ,pt.y(), Width , Segment_Length - Width - Width/2 ,brush); if (erase) p.setPen(offcolor); pts.setPoints(3,pt.x() , pt.y(), pt.x() , pt.y() - Width +1, pt.x() - Width +1, pt.y()); p.drawPolygon(pts); pts.setPoints(3,pt.x() , pt.y() + Segment_Length - Width - Width/2 -1, pt.x() , pt.y() + Segment_Length - 3*Width/4 -1, pt.x() - Width +1, pt.y() + Segment_Length - Width - Width/2 -1); p.drawPolygon(pts); if (erase) p.setPen(g.light()); break; case 6 : pt.ry() += (QCOORD)(Segment_Length*2 ); p.fillRect(pt.x() + Width ,pt.y() -Width , Segment_Length -2* Width , Width ,brush); if (erase) p.setPen(offcolor); 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 : p.fillRect(pt.x(),pt.y()+ Width /2, Width , Segment_Length - Width -Width/2 ,brush); break; case 1 : p.fillRect(pt.x()+Width,pt.y()- Width , Segment_Length -2* Width, Width ,brush); break; case 2 : pt.rx() += (QCOORD)(Segment_Length); p.fillRect(pt.x()-Width,pt.y()+ Width/2, Width , Segment_Length - Width -Width/2 ,brush); break; case 3 : pt.ry() += (QCOORD)Segment_Length; p.fillRect(pt.x() + Width ,pt.y() - Width, Segment_Length- 2* Width, Width ,brush); break; case 4 : pt.ry() += (QCOORD)(Segment_Length ); p.fillRect(pt.x(), pt.y(), Width , Segment_Length - Width - Width/2 ,brush); break; case 5 : pt.rx() += (QCOORD)(Segment_Length ); pt.ry() += (QCOORD)(Segment_Length ); p.fillRect(pt.x() - Width ,pt.y(), Width , Segment_Length - Width - Width/2 ,brush); break; case 6 : pt.ry() += (QCOORD)(Segment_Length*2); p.fillRect(pt.x() + Width ,pt.y() -Width , Segment_Length -2* Width , Width ,brush); 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; } } /* end smallLED */ }