Bugfix: NWidget can now be painted using qstylesheet

This commit is contained in:
Atul R 2019-06-28 23:19:50 +02:00
parent fcb2bdccee
commit b47b2144a0

View File

@ -1,6 +1,8 @@
#pragma once
#include <QWidget>
#include <QWidget>
#include <QStyleOption>
#include <QPainter>
#include <QStyle>
#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
};