Results 1 to 11 of 11

Thread: QListView with image and text!

  1. #1
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QListView with image and text!

    I would like to create a custom widget in a QListView with an icon and a text like in the picture. Anybody could help me?? Thanks!
    Attached Images Attached Images
    Last edited by Faster; 27th June 2009 at 22:05. Reason: spelling error

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QListView with image and text!

    So? What's the problem? What did you already try?
    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
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QListView with image and text!

    I would to create something like the widget in the picture but I'm new with Qt4 and I don't know how I can do it! Any help?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QListView with image and text!

    It would be better if you posted in the newbie section if you consider yourself one...

    Take a look at QStandardItemModel, QStandardItem::setText and QStandardItem::setIcon.
    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
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QListView with image and text!

    ok thanks!

  6. #6
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QListView with image and text!

    I would to create something like the listWidget in the picture but I'm new with Qt4 and I don't know how I can do it! Any help?
    Attached Images Attached Images
    Last edited by Faster; 27th June 2009 at 23:38. Reason: reformatted to look better

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QListView with image and text!

    Please don't start multiple threads on the same subject. Threads merged.
    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.


  8. #8
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QListView with image and text!

    How I could use QStandardItemModel to create this listView? Anybody could post an example please?
    Last edited by Faster; 28th June 2009 at 10:29. Reason: spelling error

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QListView with image and text!

    Did you follow the links I gave you?
    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.


  10. #10
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QListView with image and text!

    Yes! But I would to create a thing more complex using QItemDelegate like this http://www.qtcentre.org/forum/f-qt-p...thod-8660.html. I would display a custom resized image (jpg, png, bmp) and html text instead of plain text in a listView but I don't know how to use QItemDelegate. (sorry for my poor English).

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QListView with image and text!

    Learn the basics first. If you don't know how to use models then you won't be able to implement a delegate. The image you posted uses a standard delegate and the two roles I mentioned.
    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. QPushButton with image - text alignment
    By vladeck in forum Newbie
    Replies: 3
    Last Post: 1st July 2009, 19:20
  2. How to stretch background image used in brush-palette
    By Hookem in forum Qt Programming
    Replies: 5
    Last Post: 24th December 2008, 17:03
  3. label with image and text
    By mattia in forum Newbie
    Replies: 1
    Last Post: 7th March 2008, 11:28
  4. How to mirror-image text?
    By WinchellChung in forum Newbie
    Replies: 11
    Last Post: 31st July 2007, 17:13
  5. Requirement for versatile image viewer
    By deekayt in forum General Discussion
    Replies: 1
    Last Post: 27th October 2006, 14:28

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.