Results 1 to 3 of 3

Thread: QGraphicsView user-resizable images - for children

  1. #1
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Thanks
    43
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Smile QGraphicsView user-resizable images - for children

    I want to make some fun tools for my children.

    Does anybody know of an extension of QGraphicsView that allows user to resize scene items (such as QGraphicsPixmapItem).... or is there an easy way to code it?

    A related question, has anybody tried to created a QGraphicsView where user can insert objects (shapes, lines, images) and then manipulate them (powerpoint-style)?

    Finally, any fun Qt widgets for children? I'd like to organize a collection.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QGraphicsView user-resizable images - for children

    Quote Originally Posted by magland View Post
    I want to make some fun tools for my children.

    Does anybody know of an extension of QGraphicsView that allows user to resize scene items (such as QGraphicsPixmapItem).... or is there an easy way to code it?
    you can scale the item using item->scale() or resize the item by changing its boudingRect, and painting the new image with the new size inside the item. If you are working with a QPixmaps you can derive from QGraphicsItem, keep a copy of the pixmap and resize it for display using different geometries by using QPixmap::scaled().

    Quote Originally Posted by magland View Post
    A related question, has anybody tried to created a QGraphicsView where user can insert objects (shapes, lines, images) and then manipulate them (powerpoint-style)?

    Finally, any fun Qt widgets for children? I'd like to organize a collection.
    Yes. I did that and it worked pretty fine. I had used plugins that returned a QGraphicsItem. So you can later add whatever shapes you like without touching the applications code.

  3. #3
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Thanks
    43
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsView user-resizable images - for children

    Quote Originally Posted by momesana View Post
    you can scale the item using item->scale() or resize the item by changing its boudingRect, and painting the new image with the new size inside the item. If you are working with a QPixmaps you can derive from QGraphicsItem, keep a copy of the pixmap and resize it for display using different geometries by using QPixmap::scaled().
    But to me the difficult part would be implementing the user-drag resizing part...... I know, not too hard, but just wondering if somebody has already taken care of this.

    Quote Originally Posted by momesana View Post
    Yes. I did that and it worked pretty fine. I had used plugins that returned a QGraphicsItem. So you can later add whatever shapes you like without touching the applications code.
    Sounds very useful. Would you be willing to share your code with me?

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.