File indexing completed on 2024-04-14 03:52:06

0001 /*
0002     SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #include <QApplication>
0008 #include <QPushButton>
0009 #include <QThread>
0010 #include <QVBoxLayout>
0011 #include <QWidget>
0012 
0013 #include "kcursorsaver.h"
0014 
0015 class KCursorSaverTestWidget : public QWidget
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     explicit KCursorSaverTestWidget(QWidget *parent = nullptr);
0021 };
0022 
0023 KCursorSaverTestWidget::KCursorSaverTestWidget(QWidget *parent)
0024     : QWidget(parent)
0025 {
0026     QVBoxLayout *layout = new QVBoxLayout(this);
0027     QPushButton *busyButton = new QPushButton(QStringLiteral("busy"), this);
0028     layout->addWidget(busyButton);
0029     connect(busyButton, &QPushButton::clicked, this, []() {
0030         KCursorSaver saver(Qt::WaitCursor);
0031         QThread::sleep(3);
0032     });
0033 }
0034 
0035 int main(int argc, char *argv[])
0036 {
0037     QApplication app(argc, argv);
0038     KCursorSaverTestWidget mainWidget;
0039     mainWidget.show();
0040 
0041     return app.exec();
0042 }
0043 
0044 #include "kcursorsavergui_test.moc"