Results 1 to 4 of 4

Thread: Cancelling last point displayed QPainter

  1. #1
    Join Date
    Jun 2013
    Posts
    58
    Thanks
    26
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Question Cancelling last point displayed QPainter

    point is shown where user clicks(left/right click) ->stored in array, point displayed via the same array

    Created a pop up menu on right click
    which includes a Cancel option
    which needs to clear the last action the painter function done
    (for instance the last action was drawing a point at x,y -> that point needs to be cleared, but only that point)

    How do I go about doing that

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Cancelling last point displayed QPainter

    You can't. You have to repaint all points or use e.g. a QGraphicsScene/View.

  3. #3
    Join Date
    Jun 2013
    Posts
    58
    Thanks
    26
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Cancelling last point displayed QPainter

    How do I call repaint again.
    I created an if statement in my paint function within label-class
    Qt Code:
    1. if (cancel ==true)
    2. //cancel last point
    3. //delete point from array
    To copy to clipboard, switch view to plain text mode 
    How do I recall paint in the if statement with the updated array
    so only the points now in array will be displayed?

    Or do I create another paint function & call it from the original paint function.

    //Getting to grips with the paint function!

    Thanks
    Kind Regards

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Cancelling last point displayed QPainter

    Well you have a array, where you store the points. Then simply add/remove points of that array (e.g. QList<QPoint>) and afterwards call update(). Inside the paint method I wouldn't do any logic. simply paint all points of the array.

Similar Threads

  1. Replies: 1
    Last Post: 19th March 2010, 14:59
  2. Cancelling an Object Creation
    By bbad68 in forum Newbie
    Replies: 1
    Last Post: 4th March 2010, 21:22
  3. Replies: 1
    Last Post: 3rd December 2009, 15:23
  4. Cancelling a pending database insert
    By innerhippy in forum Qt Programming
    Replies: 3
    Last Post: 30th October 2008, 09:53
  5. QPainter clipping with precision behind the decimal point
    By Pieter from Belgium in forum Qt Programming
    Replies: 0
    Last Post: 14th March 2007, 14:30

Tags for this Thread

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.