So what's wrong with this code?
Hi wysota,
Thank you for the reply.
When I move the mouse fast the drawing is not smooth (not painting with the speed of the mouse). The brush drawing (painting) is not fast as much as mouse movement. Painting with jerks i.e mouse is at one place but drawing is appearing after a bit of time. I want to show the painting with the speed of the mouse.
How can I catch "mouseRelease" event from the event queue?
You please excuse me if I am doing repeated replies.
Can you please help me how to do painting as fast as moue move.
If I am doing wrong can you please help me what to do?
Thanks in advance
anki.n
Try to collect the points during mouse events, for example in a QList. Then during paintEvent, present the current state of the object - use the QPainter's methods (drawLine, drawPoint, or others) to draw the collected points. It should be faster than accessing image pixels during each mouse move event - quote from the documentation of setPixel:
This function is expensive due to the call of the internal detach() function called within; if performance is a concern, we recommend the use of scanLine() to access pixel data directly.
Here is my fairy complete implementation of an image masking app. It has some glitches related to how subtracting painter paths works but apart from that it's quite functional.
Hello wysota,
Than you very much for the example.
As I am very much beginner I am not able to understand how to run this. Can you please guide me how to run this?
Qt don't have any call to get event directly from event queue?
Thanks and regards
anki.n
Open the pro file in Qt Creator and click run! or, at a command prompt:
Qt Code:
cd {source directory} qmake mingw32-make (or nmake) .\imagemaskingTo copy to clipboard, switch view to plain text mode
Hello Chirs,
The attached "imagemasking.tar.gz‎" doesn't not have any .pro file. It has only one file and it includes some xml data also. I don't have any idea how to deal with this xml file.
can you please help me how to runt this?
Qt don't have any call to get event directly from event queue?
Thanks & Regards
anki.n
The file is a doubly gzipped tar archive... I assume that wysota did not do that deliberately. I have attached a zip version of the same for the Windows-challenged.
imagemasking.zip
Repeatedly asking the same question will not change the answer. You do not "get" events from the queue they are delivered to your event handlers.
Bookmarks