本文整理汇总了C++中QPainter::drawConvexPolygon方法的典型用法代码示例。如果您正苦于以下问题:C++ QPainter::drawConvexPolygon方法的具体用法?C++ QPainter::drawConvexPolygon怎么用?C++ QPainter::drawConvexPolygon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPainter
的用法示例。
在下文中一共展示了QPainter::drawConvexPolygon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCard
void TurnAndBank::createCard(void){
QImage _cardImage = QImage(QSize(500,150), QImage::Format_ARGB32);
_cardImage.fill(0x00ff0000);
uint midx, midy, width, height;
width = _cardImage.width();
midx = width/2;
height = _cardImage.height();
midy = height/2;
QPainter p;
p.setRenderHint(QPainter::Antialiasing, true);
p.begin(&_cardImage);
p.setPen(QPen(Qt::white, 7, Qt::SolidLine,
Qt::FlatCap, Qt::MiterJoin));
p.setBrush(Qt::SolidPattern);
p.setBrush(Qt::white);
p.drawChord(midx-30, midy-30, 60, 60, 0, 360*16);
p.drawLine(midx-60, midy-30, midx+60, midy-30);
p.drawLine(midx, midy-30, midx, midy-80);
p.drawLine(midx-240, midy, midx+240, midy);
p.setPen(QPen(Qt::white, 2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
static const QPointF rightWing[] = {
QPointF(midx, midy-2),
QPointF(midx+245, midy-3),
QPointF(midx+244, midy+3),
QPointF(midx, midy+15)
};
p.drawConvexPolygon(rightWing, 4);
static const QPointF leftWing[] = {
QPointF(midx, midy-2),
QPointF(midx-245, midy-3),
QPointF(midx-244, midy+3),
QPointF(midx, midy+15)
};
p.drawConvexPolygon(leftWing, 4);
p.end();
_card = QPixmap::fromImage(_cardImage, Qt::AutoColor);
}
示例2: draw_range
void DecodeTrace::draw_range(const pv::data::decode::Annotation &a, QPainter &p,
int h, double start, double end, int y, const ViewItemPaintParams &pp,
int row_title_width) const
{
const double top = y + .5 - h / 2;
const double bottom = y + .5 + h / 2;
const vector<QString> annotations = a.annotations();
// If the two ends are within 1 pixel, draw a vertical line
if (start + 1.0 > end) {
p.drawLine(QPointF(start, top), QPointF(start, bottom));
return;
}
const double cap_width = min((end - start) / 4, EndCapWidth);
QPointF pts[] = {
QPointF(start, y + .5f),
QPointF(start + cap_width, top),
QPointF(end - cap_width, top),
QPointF(end, y + .5f),
QPointF(end - cap_width, bottom),
QPointF(start + cap_width, bottom)
};
p.drawConvexPolygon(pts, countof(pts));
if (annotations.empty())
return;
const int ann_start = start + cap_width;
const int ann_end = end - cap_width;
const int real_start = std::max(ann_start, pp.left() + row_title_width);
const int real_end = std::min(ann_end, pp.right());
const int real_width = real_end - real_start;
QRectF rect(real_start, y - h / 2, real_width, h);
if (rect.width() <= 4)
return;
p.setPen(Qt::black);
// Try to find an annotation that will fit
QString best_annotation;
int best_width = 0;
for (const QString &a : annotations) {
const int w = p.boundingRect(QRectF(), 0, a).width();
if (w <= rect.width() && w > best_width)
best_annotation = a, best_width = w;
}
if (best_annotation.isEmpty())
best_annotation = annotations.back();
// If not ellide the last in the list
p.drawText(rect, Qt::AlignCenter, p.fontMetrics().elidedText(
best_annotation, Qt::ElideRight, rect.width()));
}
示例3: paintGraph
void HistoryGraph::paintGraph(QPainter & a_Painter)
{
// Draw the graph:
const auto & snapshots = m_Project->getSnapshots();
if (snapshots.empty() || (m_Model == nullptr))
{
return;
}
int prevX = projectionX(snapshots.front()->getTimestamp());
std::vector<int> prevY;
std::vector<int> y;
int prevYH = projectionY(snapshots.front()->getHeapSize());
int prevYT = projectionY(snapshots.front()->getTotalSize());
const auto & graphedItems = m_Model->getGraphedAllocationPaths();
auto numGraphedItems = graphedItems.size();
prevY.resize(numGraphedItems);
y.resize(numGraphedItems);
projectCodeLocationsY(snapshots.front().get(), prevY);
std::vector<bool> isSelected;
isSelected.resize(numGraphedItems);
for (const auto & s: m_Selection->selectedIndexes())
{
isSelected[s.row()] = true;
}
for (const auto & s: snapshots)
{
int x = projectionX(s->getTimestamp());
projectCodeLocationsY(s.get(), y);
assert(y.size() == numGraphedItems);
int yH = projectionY(s->getHeapSize());
int yT = projectionY(s->getTotalSize());
a_Painter.drawLine(prevX, prevYH, x, yH);
a_Painter.drawLine(prevX, prevYT, x, yT);
int top = m_Height - 1;
int prevTop = m_Height - 1;
QPoint points[4] =
{
QPoint(prevX, 0),
QPoint(prevX, 0),
QPoint(x, 0),
QPoint(x, 0),
};
for (size_t i = 0; i < numGraphedItems; i++)
{
points[0].setY(prevTop);
points[1].setY(prevY[i]);
points[2].setY(y[i]);
points[3].setY(top);
a_Painter.setBrush(QBrush(graphedItems[i]->m_Color, isSelected[i] ? Qt::DiagCrossPattern : Qt::SolidPattern));
a_Painter.drawConvexPolygon(points, 4);
top = y[i];
prevTop = prevY[i];
}
prevX = x;
prevYH = yH;
prevYT = yT;
std::swap(prevY, y);
}
}
示例4: draw
static void draw(unsigned icam, unsigned ncam,
QPainter& painter, bool draw_fast)
{ static const QPointF hex[6] = { QPointF(0.0,1.0),
QPointF(M_SQRT3/2.0, 0.5),
QPointF(M_SQRT3/2.0, -0.5),
QPointF(0.0,-1.0),
QPointF(-M_SQRT3/2.0, -0.5),
QPointF(-M_SQRT3/2.0, 0.5) };
painter.drawConvexPolygon(hex,sizeof(hex)/sizeof(*hex)); }
示例5:
void
TransitionWidget::drawTriPoint(QPainter& painter, double x, double y)
{
QPointF points[3] = {
QPointF(x, y - 1.35 * 1.15 * MARKER_SIZE),
QPointF(x + 1.35 * MARKER_SIZE, y + 1.35 * 0.577 * MARKER_SIZE),
QPointF(x - 1.35 * MARKER_SIZE, y + 1.35 * 0.577 * MARKER_SIZE)
};
painter.drawConvexPolygon(points, 3);
}
示例6: paintEvent
void QgsPanningWidget::paintEvent( QPaintEvent* pe )
{
Q_UNUSED( pe );
QPainter p;
p.begin( this );
p.setPen( Qt::red );
QPolygonF t = mPoly.translated( -mPoly.boundingRect().left(), -mPoly.boundingRect().top() );
p.drawConvexPolygon( t );
p.end();
}
示例7: drawClockHand
void AnalogClock::drawClockHand(QPainter &painter,
float rotateDegree,
const QPoint * points,
unsigned short pointCount,
QColor &color)
{
painter.setPen(Qt::NoPen);
painter.setBrush(color);
painter.save();
painter.rotate(rotateDegree);
painter.drawConvexPolygon(points, pointCount);
painter.restore();
}
示例8: drawConvexPolygon
void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points, bool shouldAntialias)
{
if (paintingDisabled())
return;
if (npoints <= 1)
return;
QPolygonF polygon(npoints);
for (size_t i = 0; i < npoints; i++)
polygon[i] = points[i];
QPainter *p = m_data->p();
p->save();
p->setRenderHint(QPainter::Antialiasing, shouldAntialias);
p->drawConvexPolygon(polygon);
p->restore();
}
示例9: profiler
void
Panner::paintEvent(QPaintEvent *e)
{
Profiler profiler("Panner::paintEvent");
QPaintEvent *e2 = new QPaintEvent(e->region().boundingRect());
QGraphicsView::paintEvent(e2);
QPainter paint;
paint.begin(viewport());
paint.setClipRegion(e->region());
QPainterPath path;
path.addRect(rect());
path.addPolygon(mapFromScene(m_pannedRect));
QColor c(GUIPalette::getColour(GUIPalette::PannerOverlay));
c.setAlpha(80);
paint.setPen(Qt::NoPen);
paint.setBrush(c);
paint.drawPath(path);
paint.setBrush(Qt::NoBrush);
paint.setPen(QPen(GUIPalette::getColour(GUIPalette::PannerOverlay), 0));
paint.drawConvexPolygon(mapFromScene(m_pannedRect));
if (m_pointerVisible && scene()) {
QPoint top = mapFromScene(m_pointerTop);
float height = m_pointerHeight;
if (height == 0.f) height = scene()->height();
QPoint bottom = mapFromScene
(QPointF(m_pointerTop.x(), m_pointerTop.y() + height));
paint.setPen(QPen(GUIPalette::getColour(GUIPalette::Pointer), 2));
paint.drawLine(top, bottom);
}
RG_DEBUG << "draw polygon: " << mapFromScene(m_pannedRect);
paint.end();
emit pannerChanged(m_pannedRect);
}
示例10: draw_cut
void Cut_widget::draw_cut()
{
if(cut!=NULL){
delete cut;
}
if(image!=NULL){
delete image;
}
int i;
if(this->object->height==0){
this->object->height=1;
}
if(this->object->width==0){
this->object->width=1;
}
if(ui->x_rButton->isChecked()){
image = new QPixmap(object->map->sizeY,500);
ui->pos_Box->setMaximum(object->width);
cut = new QPolygon(this->object->map->sizeY);
cut->append(QPoint(0,500));
/* int x = ( this->object->map->sizeX / this->object->width ) * ui->pos_Box->value();
for(i=1; i < this->object->map->sizeY; i++){
QPoint p;
p.setY(image->height()-Map::get_point(this->object->map,x,i-1));
p.setX(i);
cut->append(p);
}*/
}else{
image = new QPixmap(object->map->sizeX,500);
ui->pos_Box->setMaximum(object->height);
cut = new QPolygon(this->object->map->sizeX);
cut->append(QPoint(0,500));
int x = ( this->object->map->sizeY / this->object->height) * ui->pos_Box->value();
for(i=1; i < this->object->map->sizeX; i++){
QPoint p;
p.setY(image->height()-Map::get_point(this->object->map,x,i-1));
p.setX(i);
cut->append(p);
}
}
// cut->append(QPoint(image->width(),image->height()));
cut->append(QPoint(25,450));
cut->append(QPoint(50,400));
cut->append(QPoint(100,300));
cut->append(QPoint(200,250));
cut->append(QPoint(300,0));
QPainter painter;
QPen pen;
pen.setColor(Qt::black);
pen.setStyle(Qt::SolidLine);
pen.setWidth(1);
painter.begin(image);
painter.setPen(pen);
painter.fillRect(0,0,image->width(),image->height(),QBrush(Qt::white));
painter.setBrush(QBrush(Qt::gray));
painter.drawConvexPolygon(*cut);
painter.end();
ui->display_Label->setPixmap(image->scaled(ui->display_Label->size(),Qt::KeepAspectRatio));
// if(ui->x_rButton->isChecked()){
// emit draw_cut_GL(1,ui->pos_Box->value());
// }else{
// emit draw_cut_GL(0,ui->pos_Box->value());
// }
}
示例11: paintEvent
void GraphicsWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
//set up painting with antialiasing etc
QPainter painter;
painter.begin(&elements);
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::HighQualityAntialiasing);
painter.setRenderHint(QPainter::SmoothPixmapTransform);
//transform coordinates to fit everything neatly on the screen
painter.save();
painter.setWorldTransform(getCurrentTransform());
if (grid != nullptr)
{
//loop through and draw each entry
for (const auto& cell: grid->getCells())
{
GridEntry &entry = grid->getEntry(cell);
if (entry.modified) {
entry.modified = false;
painter.save();
painter.translate(cell.x(), cell.y());
QPen pen(Qt::black);
pen.setWidthF(0);
painter.setPen(pen);
if (entry.type == GridEntry::Wall)
painter.setBrush(Qt::darkBlue);
else if (entry.type == GridEntry::Start)
painter.setBrush(Qt::yellow);
else if (entry.type == GridEntry::End)
painter.setBrush(Qt::red);
else if (entry.path)
painter.setBrush(Qt::white);
else if (entry.searched)
painter.setBrush(Qt::cyan);
else
painter.setBrush(Qt::darkGreen);
painter.drawConvexPolygon(DISPLAY_HEXAGON);
painter.restore();
}
}
}
painter.restore();
painter.setPen(Qt::white);
QPainter screenPainter(this);
screenPainter.fillRect(rect(), QBrush(Qt::black));
screenPainter.drawImage(0, 0, elements);
}
示例12: paintBackground
void ManoMeter::paintBackground(QPainter & painter)
{
static const int scaleTriangle[6] = { -6,141,6,141,0,129 };
initCoordinateSystem(painter);
// Painting Malowanie obwiedni tarczy. Bia³a tarcza z czarn± skal±
QPen Pen(QColor(0,0,0)); Pen.setWidth(4);
painter.setPen(Pen);
QRadialGradient back1(QPointF(0.0,0.0),180.0,QPointF(-35.0,145.0));
back1.setColorAt(0.0,QColor(250,250,250));
back1.setColorAt(1.0,QColor(20,20,20));
QRadialGradient back2(QPointF(0.0,0.0),225.0,QPointF(76.5,135.0));
back2.setColorAt(0.0,QColor(10,10,10));
back2.setColorAt(1.0,QColor(250,250,250));
painter.setBrush(QBrush(back1));
painter.drawEllipse(-162,-162,324,324);
painter.setPen(Qt::NoPen);
painter.setBrush(QBrush(back2));
painter.drawEllipse(-152,-152,304,304);
QRadialGradient shield(QPointF(0,0),182,QPointF(-12.0,-15.0));
shield.setColorAt(0.0,Qt::white);
shield.setColorAt(0.5,QColor(240,240,240));
shield.setColorAt(1.0,QColor(215,215,215));
// internal scale circle
painter.setBrush(QBrush(shield));
painter.setPen(Pen);
painter.drawEllipse(-142,-142,284,284);
painter.setPen(Qt::NoPen);
// nominal
painter.setBrush(QColor(0,200,0));
assert(m_max-m_min != 0);
int angle = static_cast<int>( (3840 * ( m_nominal - m_min ))/(m_max-m_min) );
if (m_min <= m_nominal && m_nominal < m_max )
painter.drawPie(QRect(-141,-141,282,282),-480,3840 - angle % 5760 );
// Critical
painter.setBrush(QBrush(Qt::red));
angle = static_cast<int>( (3840 * ( m_critical - m_min ))/(m_max-m_min) );
if ( m_min <= m_critical && m_critical < m_max )
painter.drawPie(QRect(-141,-141,282,282),-480, 3840 - angle % 5760 ); //-480, 3840*( m_max-m_min - critical()-abs(m_min) )/static_cast<double>(m_max-m_min));
// bia³a obwiednia
painter.setBrush(QBrush(shield));
painter.drawEllipse(-129,-129,258,258);
// Ustawienie siê na pocz±tku skali
painter.rotate(60.0);
// Rysowanie skali kreski
painter.save();
painter.setBrush(QBrush(Qt::black));
int line_length=10;
for (int i=0;i<33;i++)
{
painter.setPen(Pen);
if (i % 4) painter.drawLine(0,140,0,140-line_length);
else {
painter.setPen(Qt::NoPen);
painter.drawConvexPolygon(QPolygon(3, scaleTriangle));
}
painter.rotate(7.5);
Pen.setWidth(3);
if (i % 2) line_length=10;
else line_length=5;
}
painter.restore();
// Rysowanie skali liczby .
if (true || digitOffset())
{
painter.setPen(Qt::black);
painter.rotate(-60.0);
painter.setFont(digitFont());
for (int i=0;i<9;i++)
{
double v = m_min + i*(m_max - m_min)/8.0;
if (fabs(v) < 0.000001 ) v = 0.0;
QString val = QString("%1").arg(v);
QSize Size = painter.fontMetrics().size(Qt::TextSingleLine, val);
painter.save();
painter.translate( digitOffset() * cos((5+i)*PI/6.0), digitOffset() * sin((5+i)*PI/6.0));
painter.drawText( QPointF( Size.width()/ -2.0, Size.height() / 4.0), val);
painter.restore();
}
}
//.........这里部分代码省略.........
示例13: drawForeground
void QHA::drawForeground(QPainter& painter )
{
painter.save();
qfiBackground(painter, m_radius[QHE], 100) ;
painter.restore();
QColor black1(230,230,230) ;
QColor black2(160,160,160) ;
QColor yellow(250,250,0) ; //couleur triangle
QColor white (250,250,250);
QFont fo1("Arial", 100 ) ;
QFont fo2("Arial", 50 ) ;
QColor bleuexterieur (83,123,216);
QColor marronexterieur (76,36,11);
QColor bleuinterieur (83,123,216);
QColor marroninterieur (76,36,11);
// fond
QConicalGradient cg(QPointF(0.0, 0.0), 360 ) ;
cg.setColorAt(0.0, Qt::white ) ;
cg.setColorAt(1.0, QColor (139,69,19) ) ;
//pies bague
painter.save();
painter.rotate(0+value(QHE));
painter.setBrush(bleuexterieur);
//largeur hauteur élargie largeur elargie hauteur
painter.drawPie (-0.831*QFI_RADIUS, -0.83*QFI_RADIUS, 2.075*0.8*QFI_RADIUS, 2.07*0.8*QFI_RADIUS, 16*0,16*180);
painter.restore();
painter.save();
painter.rotate(0+value(QHE));
painter.setBrush(marronexterieur);
painter.drawPie (-0.831*QFI_RADIUS,-0.83*QFI_RADIUS, 2.075*0.8* QFI_RADIUS, 2.08*0.8 * QFI_RADIUS, 16*180,16*180);
painter.restore();
//pies rond central
painter.save();
painter.rotate(0+value(QHE));
painter.setBrush(bleuinterieur);
//largeur hauteur élargie largeur elargie hauteur
painter.drawPie (-0.635*QFI_RADIUS, -0.64*QFI_RADIUS, 1.59*0.8*QFI_RADIUS, 1.61*0.8*QFI_RADIUS, 16*0,16*180);
painter.restore();
painter.save();
painter.rotate(0+value(QHE));
//painter.translate(60, 60);
painter.setBrush(marroninterieur);
painter.drawPie (-0.635*QFI_RADIUS,-0.63*QFI_RADIUS, 1.59*0.8* QFI_RADIUS, 1.58*0.8 * QFI_RADIUS, 16*180,16*180);
painter.restore();
painter.save();
painter.rotate(0+value(QHE));
//triangles
float w = 0;
float h = 30;
float r = 0.64*QFI_RADIUS;
float hbis = h + 5 ;
QPolygon triangle, triangle2, triangle3;
triangle << QPoint ( r, 0) << QPoint (r + 1.5 * hbis, - 0.75 * hbis) << QPoint(r + 1.5 * hbis, 0.75* hbis) ;
triangle2 << QPoint ( r, 0) << QPoint (0.82*QFI_RADIUS, - hbis) << QPoint(0.82*QFI_RADIUS, hbis) ;
triangle3 << QPoint ( r, 0) << QPoint (0.45*QFI_RADIUS, - hbis) << QPoint(0.45*QFI_RADIUS, hbis );
painter.save();
// traingle graduation
painter.rotate(-90);
for ( int i = 0 ; i < 360 ; ++i) {
painter.save();
painter.setBrush(white);
if (i == 0) painter.drawConvexPolygon(triangle2);
painter.restore();
painter.save();
painter.setBrush(yellow);
if (i == 0) painter.drawConvexPolygon(triangle3);
painter.restore();
painter.save();
painter.setBrush(white);
if (i == 45)painter.drawConvexPolygon(triangle);
if (i == 315)painter.drawConvexPolygon(triangle);// BY AXEL
//.........这里部分代码省略.........
示例14: drawData
void SpeechAudiometryWidget::drawData()
{
int xx = -1;
int yy = -1;
QPainter paint;
paint.begin(&m_data);
// Draw RE data
paint.setPen(Qt::red);
xx = -1;
yy = -1;
for (int i = 0; i < 23; ++i)
{
int x = BORDER_LEFT + i*gridWidth()/22;
if (m_reData[i] >= 0)
{
int y = BORDER_TOP + static_cast<int> (((100 - m_reData[i])/100.0)*gridHeight() + 0.5);
switch (m_kind)
{
case WITHOUT:
paint.drawEllipse(x-4, y-4, 8, 8);
break;
case WITH:
paint.setBrush(QBrush(paint.pen().color(), Qt::SolidPattern));
paint.drawEllipse(x-4, y-4, 8, 8);
paint.setBrush(Qt::NoBrush);
break;
default:
Q_ASSERT(false);
}
if (xx > 0 && yy > 0) paint.drawLine(xx, yy, x, y);
xx = x;
yy = y;
}
}
// Draw LE data
paint.setPen(Qt::blue);
xx = -1;
yy = -1;
for (int i = 0; i < 23; ++i)
{
int x = BORDER_LEFT + i*gridWidth()/22;
if (m_leData[i] >= 0)
{
int y = BORDER_TOP + static_cast<int> (((100 - m_leData[i])/100.0)*gridHeight() + 0.5);
switch (m_kind)
{
case WITHOUT:
paint.drawLine(x-4, y-4, x+4, y+4);
paint.drawLine(x-4, y+4, x+4, y-4);
break;
case WITH:
paint.fillRect(x-4, y-4, 8, 8, paint.pen().color());
break;
default:
Q_ASSERT(false);
}
if (xx > 0 && yy > 0) paint.drawLine(xx, yy, x, y);
xx = x;
yy = y;
}
}
// Draw RELE data
paint.setPen(Qt::darkGreen);
xx = -1;
yy = -1;
for (int i = 0; i < 23; ++i)
{
int x = BORDER_LEFT + i*gridWidth()/22;
if (m_releData[i] >= 0)
{
int y = BORDER_TOP + static_cast<int> (((100 - m_releData[i])/100.0)*gridHeight() + 0.5);
switch (m_kind)
{
case WITHOUT:
paint.drawLine(x-4, y+4, x+4, y+4);
paint.drawLine(x-4, y+4, x, y-4);
paint.drawLine(x, y-4, x+4, y+4);
break;
case WITH:
{
paint.setBrush(QBrush(paint.pen().color(), Qt::SolidPattern));
QPoint points[] = { QPoint(x-4, y+4), QPoint(x+4, y+4), QPoint(x, y-4) };
paint.drawConvexPolygon(points, 3);
paint.setBrush(Qt::NoBrush);
}
break;
default:
Q_ASSERT(false);
}
if (xx > 0 && yy > 0) paint.drawLine(xx, yy, x, y);
xx = x;
yy = y;
}
}
}
示例15: createGlass
void TurnAndBank::createGlass(void){
QImage _glassImage = QImage(QSize(500,500), QImage::Format_ARGB32);
_glassImage.fill(0x00ffffff);
QPainter p;
p.setRenderHint(QPainter::Antialiasing, true);
p.begin(&_glassImage);
//p.scale(1./2.5, 1./2.5);
// Cosmetics on glass: yellow arrows:
p.setPen(QPen(QColor(79, 106, 25), 0, Qt::SolidLine,
Qt::FlatCap, Qt::MiterJoin));
p.setBrush(Qt::SolidPattern);
p.setBrush(Qt::yellow);
static const QPointF bigArrow[] = {
QPointF(250, 250),
QPointF(362.5, 287.5),
QPointF(137.5, 287.5)
};
int bigArrowNPts = sizeof(bigArrow)/sizeof(bigArrow[0]);
p.drawConvexPolygon(bigArrow, bigArrowNPts);
static const QPointF leftArrow[] = {
QPointF(125, 375-10),
QPointF(237.5, 320-10),
QPointF(240, 322.5-10),
QPointF(137.5, 387.5-10),
QPointF(125,387.5-10)
};
int leftArrowNPts = sizeof(leftArrow)/sizeof(leftArrow[0]);
p.drawConvexPolygon(leftArrow, leftArrowNPts);
static const QPointF rightArrow[] = {
QPointF(375, 375-10),
QPointF(262.5, 320-10),
QPointF(260, 322.5-10),
QPointF(362.5,387.5-10),
QPointF(375,387.5-10)
};
p.drawConvexPolygon(rightArrow, leftArrowNPts);
// Upwards facing orange arrow at vertical up:
static const QPointF orangeArrow[] = {
QPointF(250, 50),
QPointF(233, 88),
QPointF(267, 88)
};
p.setBrush(QColor(255,116,0));
p.drawConvexPolygon(orangeArrow, 3);
// Little black pyramid and chord at bottom:
p.setBrush(QColor(25,25,25));
static const QPointF pyramid[] = {
QPointF(250-19-60, 417+20),
QPointF(250+19+60, 417+20),
QPointF(250+25, 250+63+20),
QPointF(250-25, 250+63+20)
};
p.drawConvexPolygon(pyramid, 4);
p.setPen(QPen(Qt::black, 0, Qt::SolidLine,
Qt::FlatCap, Qt::MiterJoin));
p.setBrush(QColor(76,76,76));
p.drawChord(_glassImage.rect(), -40*16, -100*16);
p.setBrush(QColor(25,25,25));
p.drawChord(_glassImage.rect(), -42*16, -96*16);
// Little vacuum text line
p.setPen(QColor(200,200,200));
p.setFont(QFont(QString("Helvetica"), 24, QFont::Bold, false));
int width = p.fontMetrics().width(QString("VACUUM"));
int height =p.fontMetrics().height();
p.drawText(250-width/2,385,width, height, Qt::AlignCenter, "VACUUM");
p.end();
_glass = QPixmap::fromImage(_glassImage, Qt::AutoColor);
}