File: kmainwindowtest.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-- 932 bytes parent folder | download | duplicates (3)
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
/*
    SPDX-FileCopyrightText: 2002 Simon Hausmann <hausmann@kde.org>
    SPDX-FileCopyrightText: 2005-2006 David Faure <faure@kde.org>

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

#include "kmainwindowtest.h"

#include <QApplication>
#include <QLabel>
#include <QMenuBar>
#include <QStatusBar>
#include <QTimer>

MainWindow::MainWindow()
{
    QTimer::singleShot(2 * 1000, this, &MainWindow::showMessage);

    setCentralWidget(new QLabel(QStringLiteral("foo"), this));

    menuBar()->addAction(QStringLiteral("hi"));
}

void MainWindow::showMessage()
{
    statusBar()->show();
    statusBar()->showMessage(QStringLiteral("test"));
}

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

    MainWindow *mw = new MainWindow; // deletes itself when closed
    mw->show();

    return app.exec();
}

#include "moc_kmainwindowtest.cpp"