Search code examples
qt4qtstylesheets

QSS stylesheet applied not completly on QListWidget


I'm trying to apply styles to some of my widgets via qss file, font and font size works correctly, but QListWidget::item:selected background color gets ignored.
Here's my qss code:

QListWidget, QLabel {
    font: Sans Serif;
    font-size: 14px;
}

QListWidget::item:selected {
    backgorund: #FE8080;
}

also tried it like this:

QListWidget {
    selection-background-color: rgb(254,128,128);
}

and here's how i'm connecting it

QApplication a(argc, argv);
server w;
QFile* styles = new QFile(QCoreApplication::applicationDirPath() + "/qss/default.qss");
styles->open(QFile::ReadOnly);
QString appliedStyles = styles->readAll();
a.setStyleSheet(appliedStyles);

trying to run this on windows, qt 4.8.6. Tried to use "background" and "background-color" no changes. I guess i'm doing something wrong, maybe someone can point me in the right direction and explain to me how to get this working?


Solution

  • Not sure if that was the source of my problem, but setting up Application style helped, all styles applied as they should.

    QApplication a(argc, argv);
    a.setStyle("windowsxp");