Results 1 to 8 of 8

Thread: QGraphicsItem geometry change implementation

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2016
    Posts
    16
    Thanks
    3
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default QGraphicsItem geometry change implementation

    I am trying to figure out how objects in a QGraphics Scene/View can be manipulated and redrawn.

    From what I have learnt so far, when a QGraphicsItem needs to be added to the scene,

    1. The object is derived from QGraphicsItem.
    2. boundingRect(), and paint() needs to be reimplemented.
    3. If some of the sizes need to be changed, use prepareGeometry(), and update().

    So, I am working with two actions. One to add a box to the scene, and the other to increase the size when selected.

    I tried to get it to work in one application and it did not work.(diagram.zip). The sizes of the item seem to reset before painting. I can see this if I keep increasing the size and trap the code. However, under certain paths it seem to work. For example, if I add a child to a box and select the parent, the size of the parent can be changed programmatically.

    However, I created the minimum code required and it worked.
    The code is in GrScene.zip

    Why is there a difference in behavior?

    Thanks in advance.
    Attached Files Attached Files

Similar Threads

  1. the minimized dialog can not change the geometry?
    By wearilybird in forum Qt Programming
    Replies: 0
    Last Post: 23rd September 2014, 07:36
  2. Change implementation according to different platform
    By stereoMatching in forum Qt Quick
    Replies: 1
    Last Post: 27th December 2013, 15:28
  3. Replies: 0
    Last Post: 8th July 2013, 13:44
  4. Can't change QHBoxLayout geometry
    By gutiory in forum Newbie
    Replies: 6
    Last Post: 17th June 2010, 08:37
  5. GraphicsView: Notifying geometry change to parent group
    By Gopala Krishna in forum Qt Programming
    Replies: 8
    Last Post: 12th August 2007, 12:04

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.