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
qapplication.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QAPPLICATION_H
5#define QAPPLICATION_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtCore/qcoreapplication.h>
9#include <QtGui/qwindowdefs.h>
10#include <QtCore/qpoint.h>
11#include <QtCore/qsize.h>
12#include <QtGui/qcursor.h>
13#include <QtGui/qguiapplication.h>
14
16
17
18class QStyle;
19class QEventLoop;
20class QIcon;
21class QLocale;
23
24class QApplication;
26#if defined(qApp)
27#undef qApp
28#endif
29#define qApp (static_cast<QApplication *>(QCoreApplication::instance()))
30
31class Q_WIDGETS_EXPORT QApplication : public QGuiApplication
32{
34 Q_PROPERTY(int cursorFlashTime READ cursorFlashTime WRITE setCursorFlashTime)
35 Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval)
36 Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval WRITE setKeyboardInputInterval)
37#if QT_CONFIG(wheelevent)
38 Q_PROPERTY(int wheelScrollLines READ wheelScrollLines WRITE setWheelScrollLines)
39#endif
40 Q_PROPERTY(int startDragTime READ startDragTime WRITE setStartDragTime)
41 Q_PROPERTY(int startDragDistance READ startDragDistance WRITE setStartDragDistance)
42#ifndef QT_NO_STYLE_STYLESHEET
43 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
44#endif
45 Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled)
46
47public:
48#ifdef Q_QDOC
49 QApplication(int &argc, char **argv);
50#else
51 QApplication(int &argc, char **argv, int = ApplicationFlags);
52#endif
53 virtual ~QApplication();
54
55 static QStyle *style();
56 static void setStyle(QStyle*);
57 static QStyle *setStyle(const QString&);
58
60 static QPalette palette(const QWidget *);
61 static QPalette palette(const char *className);
62 static void setPalette(const QPalette &, const char* className = nullptr);
63 static QFont font();
64 static QFont font(const QWidget*);
65 static QFont font(const char *className);
66 static void setFont(const QFont &, const char* className = nullptr);
67
68#if QT_DEPRECATED_SINCE(6,0)
69 QT_DEPRECATED_VERSION_X_6_0("Use the QFontMetricsF constructor instead.")
71#endif
72
73 static QWidgetList allWidgets();
74 static QWidgetList topLevelWidgets();
75
76 static QWidget *activePopupWidget();
77 static QWidget *activeModalWidget();
78 static QWidget *focusWidget();
79
80 static QWidget *activeWindow();
81
82#if QT_DEPRECATED_SINCE(6, 5)
83 QT_DEPRECATED_VERSION_X_6_5("Use QWidget::activateWindow() instead.")
84 static void setActiveWindow(QWidget* act);
85#endif
86
87 static QWidget *widgetAt(const QPoint &p);
88 static inline QWidget *widgetAt(int x, int y) { return widgetAt(QPoint(x, y)); }
89 static QWidget *topLevelAt(const QPoint &p);
90 static inline QWidget *topLevelAt(int x, int y) { return topLevelAt(QPoint(x, y)); }
91
92 static void beep();
93 static void alert(QWidget *widget, int duration = 0);
94
95 static void setCursorFlashTime(int);
96 static int cursorFlashTime();
97
98 static void setDoubleClickInterval(int);
99 static int doubleClickInterval();
100
101 static void setKeyboardInputInterval(int);
103
104#if QT_CONFIG(wheelevent)
105 static void setWheelScrollLines(int);
106 static int wheelScrollLines();
107#endif
108
109 static void setStartDragTime(int ms);
110 static int startDragTime();
111 static void setStartDragDistance(int l);
112 static int startDragDistance();
113
114 static bool isEffectEnabled(Qt::UIEffect);
115 static void setEffectEnabled(Qt::UIEffect, bool enable = true);
116
117 static int exec();
118 bool notify(QObject *, QEvent *) override;
119
120#ifdef QT_KEYPAD_NAVIGATION
121 static void setNavigationMode(Qt::NavigationMode mode);
122 static Qt::NavigationMode navigationMode();
123#endif
124
126
129
130public:
131 QString styleSheet() const;
132 bool autoSipEnabled() const;
133public Q_SLOTS:
134#ifndef QT_NO_STYLE_STYLESHEET
135 void setStyleSheet(const QString& sheet);
136#endif
137 void setAutoSipEnabled(const bool enabled);
138 static void closeAllWindows();
139 static void aboutQt();
140
141protected:
142 bool event(QEvent *) override;
143 bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) override;
144
145private:
146 Q_DISABLE_COPY(QApplication)
147 Q_DECLARE_PRIVATE(QApplication)
148
149 friend class QGraphicsWidget;
150 friend class QGraphicsItem;
151 friend class QGraphicsScene;
153 friend class QWidget;
154 friend class QWidgetPrivate;
155 friend class QWidgetWindow;
156 friend class QTranslator;
157 friend class QWidgetAnimator;
158#ifndef QT_NO_SHORTCUT
159 friend class QShortcut;
160 friend class QLineEdit;
161 friend class QWidgetTextControl;
162#endif
163 friend class QAction;
164
165#ifndef QT_NO_GESTURES
166 friend class QGestureManager;
167#endif
168};
169
171
172#endif // QAPPLICATION_H
The QAction class provides an abstraction for user commands that can be added to different user inter...
Definition qaction.h:30
The QApplication class manages the GUI application's control flow and main settings.
static int cursorFlashTime()
static int startDragTime()
void focusChanged(QWidget *old, QWidget *now)
static QWidget * widgetAt(int x, int y)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static int startDragDistance()
static QWidget * topLevelAt(int x, int y)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static int doubleClickInterval()
static int keyboardInputInterval()
\inmodule QtCore
Definition qeventloop.h:16
\inmodule QtCore
Definition qcoreevent.h:45
\reentrant \inmodule QtGui
\reentrant
Definition qfont.h:22
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene.
\macro qGuiApp
static QPalette palette()
Returns the current application palette.
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
The QLineEdit widget is a one-line text editor.
Definition qlineedit.h:28
\inmodule QtCore
Definition qobject.h:103
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
The QPlatformNativeInterface class provides an abstraction for retrieving native resource handles.
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QShortcut class is used to create keyboard shortcuts.
Definition qshortcut.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
Definition qstyle.h:29
\inmodule QtCore
Definition qtranslator.h:19
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QOpenGLWidget * widget
[1]
fontMetrics
qApp setStyleSheet("QPushButton { color: white }")
[21]
Combined button and popup list for selecting options.
NavigationMode
#define QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(T)
GLint GLint GLint GLint GLint x
[0]
GLenum mode
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLboolean enable
GLint y
struct _cl_event * event
GLfloat GLfloat p
[1]
static void closeAllWindows()
static QT_BEGIN_NAMESPACE QWindow * topLevelAt(const QPoint &pos)
#define QT_DEPRECATED_VERSION_X_6_5(text)
#define QT_DEPRECATED_VERSION_X_6_0(text)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
const char className[16]
[1]
Definition qwizard.cpp:100
dialog exec()
widget setStyle(proxy)