Need a little help with Qt's drawing classes.

I am trying to write a paint program (paint where the mouse click / hold has ever been detected), but I am having problems using Qt QPainter . I read the documentation on my website and I'm still lost. A link to a tutorial that is not located on their website would be nice or maybe explain to me how I can do this in Qt. The only thing I managed to do was draw dots on the widgets.

+3
source share
3 answers

Check out the Scribble example that comes with Qt, it does exactly what you want.

We override the mouse event handlers to implement the drawing, the handler of the drawing event to update the application, and the resize event handler to optimize the appearance of the application. In addition, we redefine the close event handler to intercept the closing events until the application terminates.

This example also shows how to use QPainter to draw a live image, as well as to redraw widgets.

+8
source

Use QtAssistant and go to the entry in QPainter. From there, you will see links to sample programs using various QPainter functions, such as: http://doc.trolltech.com/4.5/painting-basicdrawing.html

QtAssistant . . , , QtCentre. .

+1

, , , , paintEvent . QPixmap QImage . // . , ( , ). paintEvent, (QPaintEvent:: rect()) .

+1

Source: https://habr.com/ru/post/1722069/


All Articles