Below are the codes. so can any1 check them n tel tht is it the right way to paint(draw line n a point) on the central widget on a menu click event?[i think its not the right way, though its working]
Attachment 824
Attachment 825
Attachment 826
Printable View
Below are the codes. so can any1 check them n tel tht is it the right way to paint(draw line n a point) on the central widget on a menu click event?[i think its not the right way, though its working]
Attachment 824
Attachment 825
Attachment 826
You should set an external central widget and paint on that widget and not on the main window itself.
By the way, how is this question related to Qt Designer?
The central widget can be anything inheriting from QWidget, but I think Qt Designer restricts it to be a QWidget. Just create any custom widget, reimplement the paintEvent(), add corresponding widget in the Designer and promote it.
As I have said previously:
So, in another words.
WRONG: "void MyMainWindow::paintEvent(QPaintEvent* event)"
CORRECT: "void MyCentralWidget::paintEvent(QPaintEvent* event)"