Results 1 to 15 of 15

Thread: How to get mouse release event from event queue

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: How to get mouse release event from event queue

    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

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to get mouse release event from event queue

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get mouse release event from event queue

    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.
    Attached Files Attached Files
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4

    Default Re: How to get mouse release event from event queue

    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

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to get mouse release event from event queue

    Open the pro file in Qt Creator and click run! or, at a command prompt:
    Qt Code:
    1. cd {source directory}
    2. qmake
    3. mingw32-make (or nmake)
    4. .\imagemasking
    To copy to clipboard, switch view to plain text mode 

  6. #6

    Default Re: How to get mouse release event from event queue

    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

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to get mouse release event from event queue

    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.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get mouse release event from event queue

    Quote Originally Posted by ChrisW67 View Post
    The file is a doubly gzipped tar archive... I assume that wysota did not do that deliberately.
    Again? I'm starting to think this forum does something to the archives I upload.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Getting mouse release event system-wide
    By rittchat in forum Newbie
    Replies: 4
    Last Post: 9th February 2012, 08:08
  2. Replies: 3
    Last Post: 7th January 2012, 08:38
  3. Event queue size
    By naroin in forum Qt Programming
    Replies: 7
    Last Post: 29th November 2010, 13:26
  4. What's the size of Qt event queue?
    By ShaChris23 in forum Qt Programming
    Replies: 3
    Last Post: 6th November 2009, 17:54
  5. Event Queue Question
    By TheGrimace in forum Qt Programming
    Replies: 10
    Last Post: 5th October 2007, 16:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.