Results 1 to 7 of 7

Thread: Readonly Model implementation requirements for QComboBox

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Readonly Model implementation requirements for QComboBox

    I was always returning the cell data.
    Something like:

    Qt Code:
    1. if (!index.isValid())
    2. return QVariant();
    3. if (role == Qt::DecorationRole)
    4. return QIcon(/* */);
    5. switch(index.column())
    6. {
    7. case 0: return "col0";
    8. case 1: return "col1";
    9. case 2: return "col2";
    10. ...
    11. }
    12. return QVariant();
    To copy to clipboard, switch view to plain text mode 

    What does that mean?

    I return a string for the role Qt::SizeHintRole - which causes each item to have a size of 0.
    That's why the list view has a total height of 0 as well.



    Again THX a lot!

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

    jpn (8th November 2007)

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.