Results 1 to 3 of 3

Thread: Drawing pre-defined shapes interactively - possible?

  1. #1
    Join Date
    Mar 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question Drawing pre-defined shapes interactively - possible?

    Before I get too deep into learning Qt and purchasing a commercial license, I would appreciate knowing if Qt can do what I want, and perhaps a quick, basic coding example can be provided to show me how it would be done?

    I purchased the C++ coding with Qt book (okay, maybe I'm already in too deep ) but so far haven't seen that what I need can be done. I do have experience with coding, but not with graphics since I dealt with manipulating data when coding. I've also been looking for documentation on programming 2D paint programs but with very little luck, which is why I'm hoping Qt will give me the push I need.

    What I need is for the user to be able to select a pre-defined shape, say, an ellipse, a box, an arrow, a line, or any other predefined shape, then click in the painter window where they want the shape to start, then click where they want the shape to end, and the program draws the object the length and rotation/angle that the user indicated along with increasing the width of the shape proportionately if the shape accommodates the width. And, of course, the user should be able to modify the shape later if needed.

    Sort of like how pre-defined shape tools (line, ellipse, circle, box, star, etc.) are used in Photoshop or Paint Shop Pro. Vector-type objects perhaps?

    So, how would a shape like a star be predefined and how would a user place that shape on the paint window at the size, location, and angle they want it at?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Posts
    128
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Drawing pre-defined shapes interactively - possible?

    To give you a start (I am not a graphics person myself, I have to admit):

    Have a look at QPainterPath. You might be able to do what you want by defining a QPainterPath in the shape you like, and then (once the user has clicked on the canvas) you calculate how the painterpath has to be transformed to get the result you like. (The transformation can be done by QMatrix/QTransform(in Qt 4.3)

    You should also have a look at the Graphics View Framework which seems to be ideal for the task you plan.

    Good luck!

  3. #3
    Join Date
    Mar 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Drawing pre-defined shapes interactively - possible?

    Thanks, I'll look into those.

    Actually, I am a graphics person ...

    I currently work for DAZ Productions as their QA Manager and have a website for my own work ... some good, some bad, some just for fun ..

Similar Threads

  1. Replies: 25
    Last Post: 15th January 2006, 01:53

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.