Results 1 to 2 of 2

Thread: QSQLQueryModel + ListView in iconmode

  1. #1
    Join Date
    Oct 2011
    Location
    Toronto Canada
    Posts
    97
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QSQLQueryModel + ListView in iconmode

    Qt Code:
    1. iconmodel = new QSqlQueryModel();
    2. iconmodel->setQuery("SELECT `PictureForButtonMode` FROM `dictionary` WHERE `PictureForButtonMode` LIKE '%.%'");
    3.  
    4. while(iconmodel->query().next())
    5. {
    6. QString buttonFV = iconmodel->query().value(0).toString();
    7.  
    8. QString bttnPath = QApplication::applicationDirPath();
    9. bttnPath = "/home/dev/ttm/directory/icon/" + buttonFV;
    10.  
    11.  
    12. // HERE IS WHERE I NEED TO TAKE buttonFV and make it into an icon i already
    13. // have it getting the string i just need to set it to a icon maybe how to set it in stylesheet ?
    14.  
    15. }
    16.  
    17.  
    18.  
    19. }
    20.  
    21. if(!db.open()){
    22. qDebug() << db.lastError();
    23. }
    To copy to clipboard, switch view to plain text mode 

    I need to set the icon from my query if i could use my dir location + my string in a stylesheet that would be awesome or if theres another work around please let me know

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QSQLQueryModel + ListView in iconmode

    If you want to display icons depending on the data of your model, then write a custom delegate. There you can define which icon should be used.

Similar Threads

  1. Replies: 4
    Last Post: 2nd December 2011, 01:39
  2. Caching icons in QListView::IconMode
    By slash_blog in forum Qt Programming
    Replies: 2
    Last Post: 1st September 2011, 14:13
  3. QListWidget vertical align in iconmode
    By pvdk in forum Qt Programming
    Replies: 0
    Last Post: 6th April 2011, 15:02
  4. QListWidget in iconMode with only 1 row
    By ChiliPalmer in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2009, 08:18
  5. Set default Selected item in ListView (QSqlQueryModel)
    By jeffpogo in forum Qt Programming
    Replies: 0
    Last Post: 26th May 2009, 22:12

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.