#include "pre_screen.h" #include #include #include Screen::Screen() { setBgColor(QColor("black")); setContentsMargins(0, 0, 0, 0); setWindowIcon(LtsUtils::iconFromSvg(QStringLiteral(":/style/execute_presentation.svg"))); setWindowTitle(tr("Presentation Screen")); } Screen::~Screen() { const auto p1Widgets = findChildren(QString(), Qt::FindDirectChildrenOnly); for (QWidget *w : p1Widgets) w->setParent(nullptr); } void Screen::setBgColor(const QColor &color) { setStyleSheet(QStringLiteral("Screen { background: %1; background-color: %1; }").arg(color.name())); } void Screen::paintEvent(QPaintEvent *) // needed to apply the style sheet........... { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); }