Results 1 to 16 of 16

Thread: I want to create a form with QListView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jul 2009
    Posts
    139
    Thanks
    13
    Thanked 59 Times in 52 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: I want to create a form with QListView

    Qt Code:
    1. #include <QtGui>
    2. int main(int argc, char * argv[])
    3. {
    4. QApplication a(argc, argv);
    5.  
    6. QListView * lv = new QListView(0);
    7.  
    8. model->setData(model->index(0, 0), lv->style()->standardIcon(QStyle::SP_BrowserReload), Qt::DecorationRole);
    9. model->setData(model->index(0, 0), "Hello World!", Qt::DisplayRole);
    10.  
    11. model->setData(model->index(1, 0), lv->style()->standardIcon(QStyle::SP_FileIcon), Qt::DecorationRole);
    12. model->setData(model->index(1, 0), "Goodbye World!", Qt::DisplayRole);
    13.  
    14. lv->setViewMode(QListView::IconMode);
    15. lv->setModel(model);
    16. lv->show();
    17.  
    18. return a.exec();
    19. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to numbat for this useful post:

    xiongxiongchuan (3rd June 2010)

Similar Threads

  1. Replies: 5
    Last Post: 12th March 2010, 21:43
  2. Help me to load one form over another form PushButton
    By wagmare in forum Qt Programming
    Replies: 7
    Last Post: 26th November 2008, 16:11
  3. Hiding a form and opening another form
    By anafor2004 in forum Newbie
    Replies: 1
    Last Post: 20th February 2008, 15:04
  4. Help! Trying to create a ui form and use it
    By pmabie in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2007, 19:43
  5. How to create an Insert/Submit button for a form.
    By fnmblot in forum Qt Programming
    Replies: 5
    Last Post: 4th August 2006, 16:18

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.