Files
qt5-legatus-legacy/Lts/Plugins/PresentationManagement/Gui/Script/ScriptTimelineEditor/pre_screen.cpp
T
2026-08-13 18:33:10 +02:00

40 lines
892 B
C++
Executable File

#include "pre_screen.h"
#include <LtsUtilsGui/LtsUtilsGuiDds/dds_vector_to_pixmap.h>
#include <QPainter>
#include <QStyleOption>
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<QWidget *>(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);
}