Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
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}
27
28
32
33
36{
37 const QWidgetList topLevelWidgets = QApplication::topLevelWidgets();
38 for (QWidget *widget : topLevelWidgets) {
39 if (widget->isHidden())
40 widget->show();
41 }
42}
44
45
48{
49 const QWidgetList allWidgets = QApplication::allWidgets();
50 for (QWidget *widget : allWidgets)
51 widget->update();
52}
54
55
57if ((startPos - currentPos).manhattanLength() >=
59 startTheDrag();
The QApplication class manages the GUI application's control flow and main settings.
static void setStyle(QStyle *)
Sets the application's GUI style to style.
static QWidgetList topLevelWidgets()
Returns a list of the top-level widgets (windows) in the application.
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
int startDragDistance
the minimum distance required for a drag and drop operation to start.
static QWidgetList allWidgets()
Returns a list of all the widgets in the application.
\inmodule QtCore
static QStyle * create(const QString &)
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition qwidget.h:877
void show()
Shows the widget and its child widgets.
Definition qwidget.cpp:7875
void update()
Updates the widget unless updates are disabled or the widget is hidden.
QOpenGLWidget * widget
[1]
int main()
[0]
Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2)
QApplication app(argc, argv)
[0]
void updateAllWidgets()
[4]
void showAllHiddenTopLevelWidgets()
[1]
QCoreApplication * createApplication(int &argc, char *argv[])
[0]