I am trying to make a heavy rethinking of standard widgets using Qt style sheets. Therefore, having done most of this manually for different widgets using selectors #objectName, I decided to somehow group similar widgets.
For example, I have several QFramesthat act as headers in internal forms. And I want them all to have the same stylesheet. One way to do this is to use a naming convention (this is my fallback), i.e. QFrame[objectName|="prefix_"]. But I wanted to group my widgets into classes. So I created a simple placeholder class:
class HeaderFrame: public QFrame
{
public:
HeaderFrame(QWidget *parent = NULL): QFrame(parent) {}
};
This allowed me to push all of these QFramesup HeaderFrames. After that I tried to install
HeaderFrame { background-color: red; }
stylesheet MainWindow ( HeaderFrames), . QtCreator , . , .
, Qt- (, QLabel, QFrame ..)? ?