Debian Codegraph @

tests/manual/wasm/cursors/MainWindow.cpp

raw
1 // Copyright (C) 2019 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3 #include "MainWindow.h"
4 #include "ui_MainWindow.h"
5
6 #include <QPushButton>
7 #include <QVariant>
8 #include <QApplication>
9
10 MainWindow::MainWindow(QWidget *parent)
11 : QMainWindow(parent)
12 , ui(new Ui::MainWindow)
13 {
14 ui->setupUi(this);
15
16 for (int i = 0; i <= Qt::LastCursor; i++) {
17 auto shape = Qt::CursorShape(i);
18 auto button =
19 new QPushButton(QVariant::fromValue(shape).toString(), this);
20 ui->buttonsLayout->addWidget(button);
21 QObject::connect(button, &QPushButton::clicked,
22 [this, shape]() { ui->cursorWidget->setCursor(shape); });
23 }
24 }
25
26 MainWindow::~MainWindow()
27 {
28 delete ui;
29 }