Custom primitive elements in QStyle
I'm willing to create custom widgets, and thought that using QProxyStyle would be the best way. All I want is to draw custom primitive / control elements. What's the best way for that?
I'm inheriting from QProxyStyle and overriding drawPrimitve, this way:
class COMMONSHARED_EXPORT Style : public QProxyStyle
PE_TimeMarker = QStyle::PE_CustomBase + 1,
Style(); void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
The implementation is just a switch that handles my custom types, and calls baseStyle() to draw the know Qt types.
I think I don't know what you mean by "custom widget". Do you maybe want to just subclass QWidget and provide a paintEvent() handler and user interaction handlers: mouse events and such. (What's "custom" about the custom widgets you want to create?)
Yes, I mean that. I'm implementing a dopesheet like the one in Blender.
Actually, I'm using the graphics framework, but I want to be able to further customize my look and feel with different styles, so I thought that delegating the rendering to a QStyle was be the best wayto achieve that.