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
8
class
MainWindow
:
public
QMainWindow
9
{
10
public
:
11
explicit
MainWindow
(QWidget *parent =
nullptr
);
12
};
13
14
//! [0] //! [1]
15
MainWindow
::
MainWindow
(QWidget *parent)
16
:
QMainWindow
(
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
39
int
main
(
int
argc,
char
*argv[])
40
{
41
QApplication app(argc, argv);
42
MainWindow
window;
43
window.show();
44
return
app.exec();
45
}
main
int main(int argc, char *argv[])
[2]
Definition
buffer.cpp:77
MainWindow
[5]
Definition
src_corelib_kernel_qobject.cpp:52
MainWindow::MainWindow
MainWindow(QWidget *parent=nullptr)
qtbase
src
gui
doc
snippets
qstatustipevent
main.cpp
Generated on Thu Nov 14 2024 00:41:05 for Qt by
1.12.0