File: kassistantdialogtest.cpp

package info (click to toggle)
kwidgetsaddons 5.116.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,836 kB
  • sloc: cpp: 32,526; python: 677; sh: 14; makefile: 7
file content (35 lines) | stat: -rw-r--r-- 1,092 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
    kassistantdialogtest - a test program for the KAssistantDialog class
    SPDX-FileCopyrightText: 1998 Thomas Tanghus <tanghus@kde.org>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

#include <QApplication>
#include <QHBoxLayout>
#include <QLabel>
#include <kassistantdialog.h>

int main(int argc, char **argv)
{
    QApplication::setApplicationName(QStringLiteral("test"));
    QApplication a(argc, argv);
    a.setAttribute(Qt::AA_UseHighDpiPixmaps, true);

    KAssistantDialog *dlg = new KAssistantDialog();
    QObject::connect(dlg, &QDialog::finished, &a, &QCoreApplication::quit);
    for (int i = 1; i < 11; i++) {
        QWidget *p = new QWidget;
        QString msg = QStringLiteral("This is page %1 out of 10").arg(i);
        QLabel *label = new QLabel(msg, p);
        QHBoxLayout *layout = new QHBoxLayout(p);
        label->setAlignment(Qt::AlignCenter);
        label->setFixedSize(300, 200);
        layout->addWidget(label);
        QString title = QStringLiteral("%1. page").arg(i);
        dlg->addPage(p, title);
    }

    dlg->show();
    return a.exec();
}