File indexing completed on 2024-04-28 15:32:17

0001 /*
0002     SPDX-FileCopyrightText: 2019 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "kbusyindicatorwidget.h"
0008 
0009 #include <QApplication>
0010 #include <QLabel>
0011 #include <QPushButton>
0012 #include <QVBoxLayout>
0013 
0014 int main(int argc, char **argv)
0015 {
0016     QApplication app(argc, argv);
0017 
0018     QWidget window;
0019     window.setBaseSize(128, 128);
0020     auto layout = new QVBoxLayout(&window);
0021 
0022     auto busyWidget = new QWidget(&window);
0023     auto busyLayout = new QHBoxLayout(busyWidget);
0024     auto busyIndicator = new KBusyIndicatorWidget(&window);
0025     auto busyLabel = new QLabel(QStringLiteral("Busy..."), &window);
0026     busyLayout->addWidget(busyIndicator);
0027     busyLayout->addWidget(busyLabel);
0028 
0029     auto toggle = new QPushButton(QStringLiteral("Toggle Visible"), &window);
0030 
0031     QObject::connect(toggle, &QPushButton::clicked, busyWidget, [=] {
0032         busyWidget->setVisible(!busyWidget->isVisible());
0033     });
0034 
0035     layout->addWidget(toggle);
0036     layout->addWidget(busyWidget);
0037     layout->setAlignment(Qt::AlignTop);
0038 
0039     window.show();
0040     return app.exec();
0041 }