This is a very very simple question I think for qt developers.
I have a very large code (I didn't write) that uses qt for drawing, and I just created a on_actionSomething_toggled(bool checked)
I want it to draw some geometric stuff.
I will just be happy if you could tell me how to get to draw a line (inside that method), I could later draw whatever I want with those lines.
I already tried:
void
MainWindow::on_actionSomething_toggled(bool checked){
QPainter pa(this);
pa.drawLine(20, 40, 250, 40);
}
But it says:
QPainter::begin: Widget painting can only begin as a result of a paintEvent
So I just want to know how to draw a simple line inside my on_actionSomething_toggled
method, or maybe I am doing it everything wrong, and how could I simply add this drawing line functionality inside that big code I have.