Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QApplication>
4#include <QMainWindow>
5#include <QMenuBar>
6#include <QStatusBar>
7
8class MainWindow : public QMainWindow
9{
10public:
11 explicit MainWindow(QWidget *parent = nullptr);
12};
13
14//! [0] //! [1]
15MainWindow::MainWindow(QWidget *parent)
17{
18//! [0]
19 QWidget *myWidget = new QWidget;
20 myWidget->setStatusTip(tr("This is my widget."));
21
22 setCentralWidget(myWidget);
23//! [1]
24
25//! [2]
26 QMenu *fileMenu = menuBar()->addMenu(tr("File"));
27
28 QAction *newAct = new QAction(tr("&New"), this);
29 newAct->setStatusTip(tr("Create a new file."));
30 fileMenu->addAction(newAct);
31//! [2]
32
33 statusBar()->showMessage(tr("Ready"));
34 setWindowTitle(tr("QStatusTipEvent"));
35//! [3]
36}
37//! [3]
38
39int main(int argc, char *argv[])
40{
41 QApplication app(argc, argv);
42 MainWindow window;
43 window.show();
44 return app.exec();
45}
int main(int argc, char *argv[])
[2]
Definition buffer.cpp:77
MainWindow(QWidget *parent=nullptr)