1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the QtGui module of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:LGPL$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and Digia. For licensing terms and
14
** conditions see http://qt.digia.com/licensing. For further information
15
** use the contact form at http://qt.digia.com/contact-us.
17
** GNU Lesser General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU Lesser
19
** General Public License version 2.1 as published by the Free Software
20
** Foundation and appearing in the file LICENSE.LGPL included in the
21
** packaging of this file. Please review the following information to
22
** ensure the GNU Lesser General Public License version 2.1 requirements
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25
** In addition, as a special exception, Digia gives you certain additional
26
** rights. These rights are described in the Digia Qt LGPL Exception
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29
** GNU General Public License Usage
30
** Alternatively, this file may be used under the terms of the GNU
31
** General Public License version 3.0 as published by the Free Software
32
** Foundation and appearing in the file LICENSE.GPL included in the
33
** packaging of this file. Please review the following information to
34
** ensure the GNU General Public License version 3.0 requirements will be
35
** met: http://www.gnu.org/copyleft/gpl.html.
40
****************************************************************************/
42
#ifndef QGUIAPPLICATION_H
43
#define QGUIAPPLICATION_H
45
#include <QtCore/qcoreapplication.h>
46
#include <QtGui/qwindowdefs.h>
47
#include <QtGui/qinputmethod.h>
48
#include <QtCore/qlocale.h>
49
#include <QtCore/qpoint.h>
50
#include <QtCore/qsize.h>
57
class QSessionManager;
58
class QGuiApplicationPrivate;
59
class QPlatformNativeInterface;
60
class QPlatformIntegration;
68
#define qApp (static_cast<QGuiApplication *>(QCoreApplication::instance()))
73
#define qGuiApp (static_cast<QGuiApplication *>(QCoreApplication::instance()))
75
class Q_GUI_EXPORT QGuiApplication : public QCoreApplication
78
Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName)
79
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection)
80
Q_PROPERTY(QString platformName READ platformName STORED false)
81
Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
85
QGuiApplication(int &argc, char **argv);
87
QGuiApplication(int &argc, char **argv, int = ApplicationFlags);
89
virtual ~QGuiApplication();
91
static void setApplicationDisplayName(const QString &name);
92
static QString applicationDisplayName();
94
static QWindowList allWindows();
95
static QWindowList topLevelWindows();
96
static QWindow *topLevelAt(const QPoint &pos);
98
static QString platformName();
100
static QWindow *modalWindow();
102
static QWindow *focusWindow();
103
static QObject *focusObject();
105
static QScreen *primaryScreen();
106
static QList<QScreen *> screens();
107
qreal devicePixelRatio() const;
110
static QCursor *overrideCursor();
111
static void setOverrideCursor(const QCursor &);
112
static void changeOverrideCursor(const QCursor &);
113
static void restoreOverrideCursor();
117
static void setFont(const QFont &);
119
#ifndef QT_NO_CLIPBOARD
120
static QClipboard *clipboard();
123
static QPalette palette();
124
static void setPalette(const QPalette &pal);
126
static Qt::KeyboardModifiers keyboardModifiers();
127
static Qt::KeyboardModifiers queryKeyboardModifiers();
128
static Qt::MouseButtons mouseButtons();
130
static void setLayoutDirection(Qt::LayoutDirection direction);
131
static Qt::LayoutDirection layoutDirection();
133
static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
134
static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
136
static QStyleHints *styleHints();
137
static void setDesktopSettingsAware(bool on);
138
static bool desktopSettingsAware();
140
static QInputMethod *inputMethod();
142
static QPlatformNativeInterface *platformNativeInterface();
144
static void setQuitOnLastWindowClosed(bool quit);
145
static bool quitOnLastWindowClosed();
148
bool notify(QObject *, QEvent *);
150
#ifndef QT_NO_SESSIONMANAGER
151
// session management
152
bool isSessionRestored() const;
153
QString sessionId() const;
154
QString sessionKey() const;
155
bool isSavingSession() const;
159
void fontDatabaseChanged();
160
void screenAdded(QScreen *screen);
161
void lastWindowClosed();
162
void focusObjectChanged(QObject *focusObject);
163
void focusWindowChanged(QWindow *focusWindow);
164
#ifndef QT_NO_SESSIONMANAGER
165
void commitDataRequest(QSessionManager &sessionManager);
166
void saveStateRequest(QSessionManager &sessionManager);
170
bool event(QEvent *);
171
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
173
QGuiApplication(QGuiApplicationPrivate &p);
176
Q_DISABLE_COPY(QGuiApplication)
177
Q_DECLARE_PRIVATE(QGuiApplication)
179
Q_PRIVATE_SLOT(d_func(), void _q_updateFocusObject(QObject *object))
181
#ifndef QT_NO_GESTURES
182
friend class QGestureManager;
184
friend class QFontDatabasePrivate;
185
friend class QPlatformIntegration;
192
#endif // QGUIAPPLICATION_H