PDA

View Full Version : Setting CSS style through web pages and QWidgets



alex.magalhaes
25th March 2013, 18:53
Hi everyone,

I'm creating a Qt application with some web pages loaded on QWebViews and also some plain QWidgets, all inside a QMainWindow. Both the webpages and widgets are going to have some checkboxes here and there, and I'd like them to look the same. Well, at first they DO look the same, because they inherit their style from the native theme engine, but I'd like to define a new CSS style for both.

I tried some things like
QCheckBox::indicator:unchecked {
image: url(:/image/checkbox_unchecked.png);
} but that only works for checkboxes inside my QWidgets.

I also tried some plain CSS style, but then they only apply to webpage checkboxes.

So, is there a way I could design a single CSS style for checkboxes and apply it to all sorts of checkboxes inside my application?

For the record, I could achieve that when it comes to text selection. I set the main window stylesheet to
selection-color: #363636; selection-background-color: #bfebeb; and both web page and qwidget selections followed this style.