PDA

View Full Version : QSQLQueryModel + ListView in iconmode



prophet0
23rd December 2011, 19:28
iconmodel = new QSqlQueryModel();
iconmodel->setQuery("SELECT `PictureForButtonMode` FROM `dictionary` WHERE `PictureForButtonMode` LIKE '%.%'");

while(iconmodel->query().next())
{
QString buttonFV = iconmodel->query().value(0).toString();

QString bttnPath = QApplication::applicationDirPath();
bttnPath = "/home/dev/ttm/directory/icon/" + buttonFV;


// HERE IS WHERE I NEED TO TAKE buttonFV and make it into an icon i already
// have it getting the string i just need to set it to a icon maybe how to set it in stylesheet ?

}



}

if(!db.open()){
qDebug() << db.lastError();
}


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

Lykurg
23rd December 2011, 22:34
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.