Results 1 to 4 of 4

Thread: How Coulld I create a Grid Layout on a QGraphicsScene

  1. #1
    Join Date
    Dec 2008
    Posts
    52
    Thanks
    3
    Qt products
    Qt4

    Smile How Coulld I create a Grid Layout on a QGraphicsScene

    Hi,
    I am Planning to develop an application, where i want to place custom QGraphicsItems on that scene and save it, till here i am succeeded. Now I want to Place those items on a matrix like veiw like rows and columns and retrive those items on scene using their row and column number, for this what class i need to use. or can i place a grid layout kind of thing on a scene.
    thank u,
    with regards,
    srikanth

  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: How Coulld I create a Grid Layout on a QGraphicsScene

    If these are regular items, you have to position them yourself by reacting on changes in scene/view dimensions. If they are graphics widgets items then there is a layout class for them available.

  3. #3
    Join Date
    Dec 2008
    Posts
    52
    Thanks
    3
    Qt products
    Qt4

    Default Re: How Coulld I create a Grid Layout on a QGraphicsScene

    hi,
    First of all thanks for replying, ya they r normal QGraphicItems, I am finding difficulties to create a row&column like structure on a scene so that when a user bring his pointer in a particular cell i should able to highlight that cell so that the user can place his item in that particular cell.
    Plz suggest me the method to follow.
    with regards,
    srikanth

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How Coulld I create a Grid Layout on a QGraphicsScene

    How about changing the base class as QGraphicsWidget? If they are custom graphics items in the sense that you're not using various built-in types like QGraphicsRectItem, QGraphicsPixmapItem etc. but they're direct subclasses of QGraphicsItem, it's only a matter of changing the base class type. Then you could easily start using QGraphicsGridLayout.
    J-P Nurmi

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.