Cruz
15th January 2009, 22:32
I have a little style sheet, that I load from a file in the main class and apply it to the QApp like this:
QApplication a(argc, argv);
QFile file("styles.css");
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
a.setStyleSheet(styleSheet);
return a.exec();
It's very convenient, because I can change the looks of my application without even having to recompile the code. Now here is the thing. I have QFrames on my gui, that I want to highlight when the mouse moves them and keep highlighted when they get clicked. So I need to set some kind of attribute in the code that the style sheet reacts to.
I have seen this thing in a style sheet before:
.selected {
border-width: 3px;
}
and I figure it would apply to items that somehow get a "selected" attribute. Does anyone know how to do this?
Thanks
Cruz
QApplication a(argc, argv);
QFile file("styles.css");
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
a.setStyleSheet(styleSheet);
return a.exec();
It's very convenient, because I can change the looks of my application without even having to recompile the code. Now here is the thing. I have QFrames on my gui, that I want to highlight when the mouse moves them and keep highlighted when they get clicked. So I need to set some kind of attribute in the code that the style sheet reacts to.
I have seen this thing in a style sheet before:
.selected {
border-width: 3px;
}
and I figure it would apply to items that somehow get a "selected" attribute. Does anyone know how to do this?
Thanks
Cruz