Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DiagnosticStyle : public QWindowsVistaStyle
- {
- Q_OBJECT
- public:
- typedef QWindowsVistaStyle BaseStyle;
- void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const;
- };
- void DiagnosticStyle::drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const
- {
- BaseStyle::drawControl(element, option, painter, widget);
- if (widget && painter) {
- // draw a border around the widget
- painter->setPen(QColor("red"));
- painter->drawRect(widget->rect());
- // show the classname of the widget
- QBrush translucentBrush(QColor(255,246,240, 100));
- painter->fillRect(widget->rect(), translucentBrush);
- painter->setPen(QColor("darkblue"));
- painter->drawText(widget->rect(), Qt::AlignLeft | Qt::AlignVCenter, widget->metaObject()->className());
- }
- }
- qApp->setStyle(new DiagnosticStyle());
- improve this question
Advertisement
Add Comment
Please, Sign In to add comment