Results 1 to 8 of 8

Thread: QGridLayout place new widgets at top

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    May 2011
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QGridLayout place new widgets at top

    more in detail at the moment i have a list (vector) contains the objects. this list will be grow while the application runs. because i don't want to rearrange all the object in the layout i just add the last one:

    Qt Code:
    1. vector<Object> list = someObjects;
    2.  
    3. for (int i = lastCount; i < list.size(); i++){
    4. QLabel *label= new QLabel();
    5. label->setText(list[i]->toString());
    6. lastCount++;
    7. ((QGridLayout*) ui.view->layout())->addWidget(label, i, 0);
    8. ui.view->repaint();
    9. }
    To copy to clipboard, switch view to plain text mode 

    however i like to arrange them so:

    third object
    second object
    first object

    thx
    Last edited by rouge; 8th June 2011 at 20:21. Reason: updated contents

Similar Threads

  1. Repositioning widgets in QGridLayout
    By Rayven in forum Qt Programming
    Replies: 8
    Last Post: 21st March 2011, 14:30
  2. Replies: 2
    Last Post: 16th December 2010, 11:52
  3. Widgets in QGridLayout placed at top left
    By anarion in forum Newbie
    Replies: 2
    Last Post: 2nd September 2010, 15:06
  4. space between widgets in qgridlayout
    By demol in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2010, 20:07
  5. How correct to place widgets in QMdiSubWindow
    By sawerset in forum Qt Programming
    Replies: 0
    Last Post: 15th April 2009, 23:49

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.