Results 1 to 2 of 2

Thread: QStandardItem as separator to QListView

  1. #1
    Join Date
    Sep 2010
    Location
    Seattle, WA
    Posts
    1
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default QStandardItem as separator to QListView

    Hi all,

    I just started coding Qt, and am struggling with some UI features. Please let me know if I can find some sample code or just API for this issue, thanks!

    I am using a QStandardItemModel to store QStandardItem to display in QListView, I wonder if there's a simple separator type for QStandardItem, so that I can feed into QStandardItemModel then QListView directly? Essentially I want to implement a address book like list with separators in the list.

    Qt Code:
    1. QListview *listview = new QListView()
    2.  
    3. for (int i =0; i<num; i++)
    4. {
    5. model->appendRow(item);
    6. }
    7.  
    8. listview->setModel(model);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QStandardItem as separator to QListView

    Add an item with the text "------------------------" ?

    If that isn't what you mean, you'll need to look into delegates for example.
    You can add an item with a custom role for example and the delegate can react on that role to draw a nice line for example.

Similar Threads

  1. QMenu with a Text separator
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2010, 12:30
  2. Separator in box layout
    By drhex in forum Qt Programming
    Replies: 1
    Last Post: 30th September 2009, 22:36
  3. separator in QComboBox
    By dyams in forum Qt Programming
    Replies: 3
    Last Post: 7th March 2008, 09:56
  4. Is possible to hide a separator in a QToolBar?
    By Dark_Tower in forum Qt Programming
    Replies: 2
    Last Post: 20th April 2006, 10:03
  5. int to QString with thousands separator
    By klaus1111 in forum Newbie
    Replies: 6
    Last Post: 6th January 2006, 22:06

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.