Results 1 to 6 of 6

Thread: Graphics view question regarding layouts

  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Graphics view question regarding layouts

    Is it possible to apply QGraphicsGridLayout to QGraphicsView, so the items (including embedded widgets) are layouted just like gui elements on normal widget?
    Qt 5.3 Opensource & Creator 3.1.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: Graphics view question regarding layouts

    Yes and no. You can't do that directly but you can place it inside a QGraphicsWidget that takes the whole size of the scene.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Graphics view question regarding layouts

    you think it will be possible to directly assign layout in future?
    Qt 5.3 Opensource & Creator 3.1.2

  4. #4
    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: Graphics view question regarding layouts

    You can't assign a layout to something that doesn't exist. You need some object. Just like you can't assign a layout to the screen - you need a widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Graphics view question regarding layouts

    Well, gr. view and gr. scene ARE OBJECTS! Ok, then, widget it is ...
    Qt 5.3 Opensource & Creator 3.1.2

  6. #6
    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: Graphics view question regarding layouts

    I don't really see what the problem is with current design...

    Qt Code:
    1. QGraphicsScene *scene = new QGraphicsScene(QRectF(0,0,1000,500));
    2. QGraphicsWidget *top = new QGraphicsWidget;
    3. QGraphicsLinearLayout *l = new QGraphicsLinearLayout(top);
    4. QGraphicsProxyWidget *w1 = new QGraphicsProxyWidget;
    5. w1->setWidget(new QPushButton);
    6. QGraphicsProxyWidget *w2 = new QGraphicsProxyWidget;
    7. w2->setWidget(new QPushButton);
    8. l->addItem(w1);
    9. l->addItem(w2):
    10. scene->addItem(top);
    11. top->setGeometry(scene->sceneRect());
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Problem about Graphics View Framework
    By FinderCheng in forum Qt Programming
    Replies: 5
    Last Post: 3rd November 2009, 08:16
  2. Graphics View and the Pixmap
    By spawn9997 in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2009, 22:12
  3. Model / View - Design Question
    By antarctic in forum Qt Programming
    Replies: 8
    Last Post: 8th June 2009, 07:39
  4. Graphics View Panning ,zooming
    By linuxdev in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2008, 07:17
  5. Replies: 4
    Last Post: 5th August 2008, 19:55

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.