Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QPAINTER LINE IN QWIDGET PRESENTS IN PLUS FILE .CPP
Salvatello last edited by
Hi, I would like to draw a line in a QWidget present in my QmainWindows . Explain.
I have a project done by mainwindows.he main windows.cpp , prova2.he prova2.cpp and of course main.cpp .
in mainwindows.cpp I inserted a QWidget ( disegnalinea ) .
in prova2.cpp I inserted a QWidget ( disegnalinea2 ) .
I would like to create a function in a file .h . this function should receive as input the QWidget ( or disegnalinea disegnalinea2 ) and I must draw the line or disegnalinea or disegnalinea2 .
It's not done like that, widget paint themselves when paintEvent is called. You can't just paint on them like that. You can find several example in Qt's sources for custom painting.
On a side note, please stop writing all uppercased titles, in written language it's considered shouting and thus rude.