Results 1 to 3 of 3

Thread: Moving multiple QGraphicItems

  1. #1
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Moving multiple QGraphicItems

    Hi.
    I want to move multiple QGraphicsItems, but with some boundary conditions.

    1.) I need to preserve the z-values of all items.
    2.) I need to preserve the boundary of all items.
    -> I can't use QGraphicsItemGroup, because as a shape of the group item I get a box around all items, but I need something like the union of all items shapes. Secondly I get a z-value of the group.
    So I tried to use "selectable", and then selected all items to move together. That works quite nice, the z-values of the items are preserved and clicking on translucent areas of the items don't select the item. But every selected item gets a black border... I'm also not sure how to implement, that all items of one group are selected when I click on one item of the group.

    I forgot, I use Qt4.2...

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Moving multiple QGraphicItems

    You can always subclass the group and reimplement the methods you wish to behave differently - that shouldn't be too hard.

  3. The following user says thank you to wysota for this useful post:

    StefanHirche (6th September 2007)

  4. #3
    Join Date
    Jan 2007
    Posts
    5
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Moving multiple QGraphicItems

    But what methods I have to rewrite. As QGraphicsItemGroup is a QGraphicsItem, there is a single z-Value. So basically I have to rewrite the painting stuff?
    The shape thing may be a simple one, that's right.

Similar Threads

  1. Object and multiple inheritance for interfaces
    By brcain in forum Qt Programming
    Replies: 8
    Last Post: 29th June 2021, 15:29
  2. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 05:23
  3. Multiple shortuts for the action
    By Lemming in forum Qt Programming
    Replies: 6
    Last Post: 6th April 2006, 22:29
  4. Replies: 25
    Last Post: 15th January 2006, 00: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.