// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QApplication>
#include <QCheckBox>
#include <QLatin1String>
#include <QMainWindow>
#include <QtOhosExtras>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow window;
window.setWindowTitle(QLatin1String("Keep Window Screen On Example"));
QCheckBox keepScreenOnCheckBox("Keep on", &window);
QObject::connect(
&keepScreenOnCheckBox, &QCheckBox::stateChanged, &window,
[window = &window](int state) {
QtOhosExtras::setWindowKeepScreenOn(window, state == Qt::Checked);
});
window.show();
return app.exec();
}