Results 1 to 4 of 4

Thread: How to implement a graphical curve drawing/editing tool

  1. #1
    Join Date
    Jul 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default How to implement a graphical curve drawing/editing tool

    Hi all, I need to implement a graphical curve editing tool.
    The interface would be similar to the Curve tool of Gimp or PaintDotNet, aiming at image adjustment.
    The user can edit any point on the initial curve(y=x line) by clicking and then dragging the point via mouse move.
    The curve then should instantly be updated based on the new position of its edited point, taking the proper shape via mathematical equations.
    I have basic knowledge about QGraphicsView and QGraphicsScene, but this task seems a bit harder for my level of experience.
    Any ideas or any directions to similar available applications/source codes are highly appreciated.

  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: How to implement a graphical curve drawing/editing tool

    There comes only one off line resource in my mind: have a look at Johan's book "Foundations of Qt Development". There he has an example on how to manipulate circles and rects by using "handler" items.

  3. #3
    Join Date
    Jul 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to implement a graphical curve drawing/editing tool

    Thanks for the suggestion,
    Any more ideas?
    It would be great to place an anchor point on the curve after the current dragging is finished, so that the updated curve is forced to include that point in further manipulations..

  4. #4
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to implement a graphical curve drawing/editing tool

    Hi,

    See the Elastic nodes sample.

    When you detect a mouse press on your original curve, you can immediately insert an anchor point (like the yellow circles in the sample) and drag this around. While dragging the anchor point, you can continuously recalculate the curve. This way, modifying the curve is just dragging around GraphicsView items, which is easy. And inserting a new point or rearranging an old point is the same piece of code.

    Regards,
    Marc
    Last edited by Lykurg; 21st December 2010 at 23:36. Reason: removed doubled content

Similar Threads

  1. Replies: 4
    Last Post: 29th April 2010, 06:11
  2. Drawing curve legend
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 03:42
  3. Replies: 1
    Last Post: 22nd January 2010, 14:34
  4. Replies: 8
    Last Post: 8th October 2009, 16:59
  5. Replies: 1
    Last Post: 30th April 2009, 07:16

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.