Hello all,
i have read some documents but the codes there are mostly invalid.
int main(int argc,char ** argv)
{
palette.
setColor(QPalette::Highlight,Qt
::red);
view->setPalette(palette);
view->setModel(model);
view->setWindowTitle("QListView Selected Item Bg Color");
view->show();
return app.exec();
};
int main(int argc,char ** argv)
{
QApplication app(argc,argv);
QListView* view = new QListView();
QStringListModel* model = new QStringListModel((QString("1;2;3;4;5").split(";")));
QPalette palette;
palette.setColor(QPalette::Highlight,Qt::red);
view->setPalette(palette);
view->setModel(model);
view->setWindowTitle("QListView Selected Item Bg Color");
view->show();
return app.exec();
};
To copy to clipboard, switch view to plain text mode
for example the code above is a sample which peole use it to set the background color. I run this sample and the color remains still the same.
Unbenannt.png
Bookmarks