Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsWidgets/tests/window.cpp
T
torsten 418443c841 LtsWidgets: Qt6 API fixes complete
- QComboBox::activated signal: QString→int parameter (lts_text_editor)
- qAsConst→std::as_const (5 files)
- localPos()→position() (lts_height_plot_widget)
- setMargin→setContentsMargins (tests/window.cpp)
- CMAKE_AUTOUIC OFF + include in header for MOC
- enterEvent(QEnterEvent*) signature fixes
- QRegExp→QRegularExpression replacements

All LtsWidgets module files now Qt6-compatible.
2026-08-21 11:08:24 +02:00

60 lines
1.4 KiB
C++

#include "window.h"
#include <LtsWidgets/lts_notification_box.h>
#include <QApplication>
#include <QHBoxLayout>
namespace LtsWidgets
{
Window::Window(QWidget *parent)
: QWidget(parent)
{
//Q_INIT_RESOURCE(lts_resources);
setGeometry(x(), y(), 300, 300);
QHBoxLayout *lay = new QHBoxLayout;
lay->setContentsMargins(0, 0, 0, 0);
//lay->setSizeConstraint(QLayout::SetMinimumSize);
auto x1 = new LtsWidgets::LtsNotificationBox;
lay->addWidget(x1);
if (qApp->arguments().count() < 2)
abort();
LtsNotificationBox::MessageType type;
if (qApp->arguments().at(1) == QStringLiteral("e"))
type = LtsNotificationBox::MessageType::Error;
else if (qApp->arguments().at(1) == QStringLiteral("w"))
type = LtsNotificationBox::MessageType::Warning;
else if (qApp->arguments().at(1) == QStringLiteral("i"))
type = LtsNotificationBox::MessageType::Info;
else if (qApp->arguments().at(1) == QStringLiteral("s"))
type = LtsNotificationBox::MessageType::Success;
else
abort();
x1->message(QStringLiteral("Title Message"), QStringLiteral("A text that consists of a lot of characters and also even has<br />two lines."), type);
connect(x1, &LtsNotificationBox::signalClose, this, &QWidget::close);
setLayout(lay);
setAttribute(Qt::WA_TranslucentBackground);
}
Window::~Window()
{
//Q_CLEANUP_RESOURCE(lts_resources);
}
} // namespace LtsWidgets