No effect of Qt::NoPen in QPainter
Solved
General and Desktop
-
Hi,
i want to disable the pen in my paintEvent function.void PaintWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); painter.translate(width() / 2.0, height() / 2.0); painter.setPen(Qt::NoPen); for (auto poly : m_poliygons) { painter.setBrush(QBrush(poly .color())); painter.drawPolygon(poly.polygon()); } }
But the outlines of the polygons are still painted.
Can someone help?
-
Hi
Works in Qt 5.7 on win 10.
image url)void MainWindow::on_pushButton_2_released() { int h = ui->label->height(); int w = ui->label->width(); QPixmap pix(w, h); QPainter painter(&pix); pix.fill( Qt::white ); QPolygon poly; poly << QPoint(0, 85) << QPoint(75, 75) << QPoint(100, 10) << QPoint(125, 75) << QPoint(200, 85) << QPoint(150, 125) << QPoint(160, 190) << QPoint(100, 150) << QPoint(40, 190) << QPoint(50, 125)\ << QPoint(0, 85); //QPen pen(Qt::red, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin); painter.setPen(Qt::NoPen); painter.setBrush(QBrush(Qt::HorPattern)); painter.drawPolygon(poly); ui->label->setPixmap(pix); }
with pen..
-
well try my code and see.
If still Pen it might be bug :) -
ahahah :)
so it was not a real pen at all.
Good catch.Please flag as Solved if possible.