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
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]
5QCoreApplication* 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
14int 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]
30QApplication::setStyle(QStyleFactory::create("Fusion"));
31//! [1]
32
33
34//! [4]
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]
48{
49 const QWidgetList allWidgets = QApplication::allWidgets();
50 for (QWidget *widget : allWidgets)
51 widget->update();
52}
53//! [5]
54
55
56//! [7]
57if ((startPos - currentPos).manhattanLength() >=
58 QApplication::startDragDistance())
59 startTheDrag();
60//! [7]
int main(int argc, char *argv[])
[2]
Definition buffer.cpp:77
void updateAllWidgets()
[4]
void showAllHiddenTopLevelWidgets()
[1]
QCoreApplication * createApplication(int &argc, char *argv[])
[0]