Hello,
I want to use QPainter to draw very simple lines and points. I checked the docs and wanted to copy the example, but the following code doesn't work:
int main(int argc, char *argv[])
{
fenster1.resize(400,400);
achsen.
setPen(QPen(Qt
::blue,
2));
achsen.drawPoint(200,100);
achsen.drawLine(100,100,301,301);
fenster1.show();
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget fenster1;
fenster1.resize(400,400);
QPainter achsen(&fenster1);
achsen.setPen(QPen(Qt::blue,2));
achsen.drawPoint(200,100);
achsen.drawLine(100,100,301,301);
fenster1.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
It doesn't return an error, but I can neither see the line nor the point. It just displays an empty window. Where is the mistake?
Thanks.
Bookmarks