File: kmainwindowrestoretest.cpp

package info (click to toggle)
kf6-kxmlgui 6.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,708 kB
  • sloc: cpp: 16,748; xml: 45; python: 41; ansic: 22; sh: 18; makefile: 7
file content (42 lines) | stat: -rw-r--r-- 1,374 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
36
37
38
39
40
41
42

#include "kmainwindowrestoretest.h"

#include <QApplication>
#include <QLabel>

// clang-format off
#define MAKE_WINDOW( kind, title ) do { \
        MainWin##kind * m = new MainWin##kind; \
        m->setCaption( title ); \
        m->setCentralWidget( new QLabel( title, m ) ); \
        m->show(); \
    } while ( false )
// clang-format on

int main(int argc, char *argv[])
{
    QApplication::setApplicationName(QStringLiteral("kmainwindowrestoretest"));
    QApplication app(argc, argv);

    if (qApp->isSessionRestored()) {
        kRestoreMainWindows<MainWin1, MainWin2, MainWin3>();
        kRestoreMainWindows<MainWin4, MainWin5>();
        kRestoreMainWindows<MainWin6>(); // should be equivalent to RESTORE()
    } else {
        MAKE_WINDOW(1, QStringLiteral("First 1"));
        MAKE_WINDOW(1, QStringLiteral("Second 1"));
        MAKE_WINDOW(2, QStringLiteral("Only 2"));
        MAKE_WINDOW(3, QStringLiteral("First 3"));
        MAKE_WINDOW(4, QStringLiteral("First 4"));
        MAKE_WINDOW(4, QStringLiteral("Second 4"));
        MAKE_WINDOW(3, QStringLiteral("Second 3"));
        MAKE_WINDOW(4, QStringLiteral("Third 4"));
        MAKE_WINDOW(5, QStringLiteral("First 5"));
        MAKE_WINDOW(5, QStringLiteral("Second 5"));
        MAKE_WINDOW(1, QStringLiteral("Only 6"));
    }

    return app.exec();
}

#include "moc_kmainwindowrestoretest.cpp"