Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
src_gui_kernel_qapplication.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
4
//! [0]
5
QCoreApplication
*
createApplication
(
int
&argc,
char
*argv[])
6
{
7
for
(
int
i = 1; i < argc; ++i) {
8
if
(!qstrcmp(argv[i],
"-no-gui"
))
9
return
new
QCoreApplication(argc, argv);
10
}
11
return
new
QApplication(argc, argv);
12
}
13
14
int
main
(
int
argc,
char
* argv[])
15
{
16
QScopedPointer<QCoreApplication> app(createApplication(argc, argv));
17
18
if
(qobject_cast<QApplication *>(app.data())) {
19
// start GUI version...
20
}
else
{
21
// start non-GUI version...
22
}
23
24
return
app->exec();
25
}
26
//! [0]
27
28
29
//! [1]
30
QApplication::setStyle(QStyleFactory::create(
"Fusion"
));
31
//! [1]
32
33
34
//! [4]
35
void
showAllHiddenTopLevelWidgets
()
36
{
37
const
QWidgetList topLevelWidgets = QApplication::topLevelWidgets();
38
for
(QWidget *widget : topLevelWidgets) {
39
if
(widget->isHidden())
40
widget->show();
41
}
42
}
43
//! [4]
44
45
46
//! [5]
47
void
updateAllWidgets
()
48
{
49
const
QWidgetList allWidgets = QApplication::allWidgets();
50
for
(QWidget *widget : allWidgets)
51
widget->update();
52
}
53
//! [5]
54
55
56
//! [7]
57
if
((startPos - currentPos).manhattanLength() >=
58
QApplication::startDragDistance())
59
startTheDrag();
60
//! [7]
main
int main(int argc, char *argv[])
[ctor_close]
Definition
src_corelib_animation_qpropertyanimation.cpp:100
updateAllWidgets
void updateAllWidgets()
[4]
Definition
src_gui_kernel_qapplication.cpp:47
showAllHiddenTopLevelWidgets
void showAllHiddenTopLevelWidgets()
[1]
Definition
src_gui_kernel_qapplication.cpp:35
createApplication
QCoreApplication * createApplication(int &argc, char *argv[])
[0]
Definition
src_gui_kernel_qapplication.cpp:5
qtbase
src
widgets
doc
snippets
code
src_gui_kernel_qapplication.cpp
Generated on
for Qt by
1.18.0