QPAINTER LINE IN QWIDGET PRESENTS IN PLUS FILE .CPP



  • 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 .


  • Lifetime Qt Champion

    Hi,

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.