Hello everyone,
I want to create my own Style, so I created a class which inherits QStyle. This class does till now nothing
//MyStyleClass.h
{
Q_OBJECT
public:
MyStyle();
}
//MyStyleClass.h
class MyStyle : public QStyle
{
Q_OBJECT
public:
MyStyle();
void polish(QPalette &palette);
}
To copy to clipboard, switch view to plain text mode
//MyStyleClass.cpp
MyStyle::MyStyle()
{
}
{
}
//MyStyleClass.cpp
MyStyle::MyStyle()
{
}
void MyStyle::polish(QPalette &palette)
{
}
To copy to clipboard, switch view to plain text mode
My test programm is just a dialog box with a button assigned. But how can I assign the new Style to my programm?
I tried it out in the main() function via:
QApplication::setStyle(new MyStyle);
To copy to clipboard, switch view to plain text mode
but I just get an error from the compiler which says:
cannot allocate an object of abstract type 'MyStyle'
because the following virtual functions are pure within 'MyStyle':
virtual void QStyle::drawPrimitive(QStyle::PrimitiveElements, const QStyleOption*, QPainter*, const Qwidget*) const;
and a lot more functions
Bookmarks