From b47b2144a0b87b2251dc2b91639648c1c2a78d8e Mon Sep 17 00:00:00 2001 From: Atul R Date: Fri, 28 Jun 2019 23:19:50 +0200 Subject: [PATCH] Bugfix: NWidget can now be painted using qstylesheet --- src/cpp/QtGui/QWidget/nwidget.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cpp/QtGui/QWidget/nwidget.h b/src/cpp/QtGui/QWidget/nwidget.h index 774326592..7afedc4a2 100644 --- a/src/cpp/QtGui/QWidget/nwidget.h +++ b/src/cpp/QtGui/QWidget/nwidget.h @@ -1,6 +1,8 @@ #pragma once #include -#include +#include +#include +#include #include "src/cpp/core/YogaWidget/yogawidget.h" #include "src/cpp/core/Events/eventwidget.h" @@ -10,6 +12,14 @@ class NWidget: public QWidget, public YogaWidget, public EventWidget public: SET_YOGA_WIDGET_Q_PROPERTIES using QWidget::QWidget; //inherit all constructors of QWidget + // https://doc.qt.io/qt-5/stylesheet-reference.html + void paintEvent(QPaintEvent *) + { + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + } Q_OBJECT };