summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qapplication_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qapplication_p.h')
-rw-r--r--src/widgets/kernel/qapplication_p.h160
1 files changed, 46 insertions, 114 deletions
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 133279f977..21b1605dfc 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QAPPLICATION_P_H
#define QAPPLICATION_P_H
@@ -81,12 +45,12 @@ class QGraphicsScene;
class QObject;
class QWidget;
class QSocketNotifier;
-class QTouchDevice;
+class QPointingDevice;
#ifndef QT_NO_GESTURES
class QGestureManager;
#endif
-extern Q_GUI_EXPORT bool qt_is_gui_used;
+extern Q_GUI_EXPORT bool qt_is_tty_app;
#ifndef QT_NO_CLIPBOARD
extern QClipboard *qt_clipboard;
#endif
@@ -94,70 +58,62 @@ extern QClipboard *qt_clipboard;
typedef QHash<QByteArray, QFont> FontHash;
Q_WIDGETS_EXPORT FontHash *qt_app_fonts_hash();
-typedef QHash<QByteArray, QPalette> PaletteHash;
-PaletteHash *qt_app_palettes_hash();
-
-#define QApplicationPrivateBase QGuiApplicationPrivate
-
-class Q_WIDGETS_EXPORT QApplicationPrivate : public QApplicationPrivateBase
+class Q_WIDGETS_EXPORT QApplicationPrivate : public QGuiApplicationPrivate
{
Q_DECLARE_PUBLIC(QApplication)
public:
- QApplicationPrivate(int &argc, char **argv, int flags);
+ QApplicationPrivate(int &argc, char **argv);
~QApplicationPrivate();
virtual void notifyLayoutDirectionChange() override;
virtual void notifyActiveWindowChange(QWindow *) override;
- virtual bool shouldQuit() override;
- bool tryCloseAllWindows() override;
-
-#if 0 // Used to be included in Qt4 for Q_WS_X11
-#if QT_CONFIG(settings)
- static bool x11_apply_settings();
-#endif
- static void reset_instance_pointer();
-#endif
static bool autoSipEnabled;
static QString desktopStyleKey();
-
void createEventDispatcher() override;
static void dispatchEnterLeave(QWidget *enter, QWidget *leave, const QPointF &globalPosF);
-
+ static QWidget *desktop();
void notifyWindowIconChanged() override;
+#ifndef QT_NO_ACTION
+ QActionPrivate *createActionPrivate() const override;
+#endif
+#ifndef QT_NO_SHORTCUT
+ QShortcutPrivate *createShortcutPrivate() const override;
+#endif
+
//modality
- bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const override;
+ Qt::WindowModality defaultModality() const override;
+ bool windowNeverBlocked(QWindow *window) const override;
static bool isBlockedByModal(QWidget *widget);
static bool modalState();
- static bool tryModalHelper(QWidget *widget, QWidget **rettop = 0);
-#if 0 // Used to be included in Qt4 for Q_WS_MAC
- static QWidget *tryModalHelper_sys(QWidget *top);
- bool canQuit();
+ static bool tryModalHelper(QWidget *widget, QWidget **rettop = nullptr);
+
+#ifdef QT_KEYPAD_NAVIGATION
+ static bool keypadNavigationEnabled()
+ {
+ return navigationMode == Qt::NavigationModeKeypadTabOrder ||
+ navigationMode == Qt::NavigationModeKeypadDirectional;
+ }
#endif
bool notify_helper(QObject *receiver, QEvent * e);
- void init(
-#if 0 // Used to be included in Qt4 for Q_WS_X11
- Display *dpy = 0, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0
-#endif
- );
+ void init();
void initialize();
void process_cmdline();
-#if 0 // Used to be included in Qt4 for Q_WS_X11
- static void x11_initialize_style();
-#endif
+ static void setActiveWindow(QWidget* act);
static bool inPopupMode();
bool popupActive() override { return inPopupMode(); }
+ bool closeAllPopups() override;
void closePopup(QWidget *popup);
void openPopup(QWidget *popup);
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);
static QWidget *focusNextPrevChild_helper(QWidget *toplevel, bool next,
- bool *wrappingOccurred = 0);
+ bool *wrappingOccurred = nullptr);
#if QT_CONFIG(graphicsview)
// Maintain a list of all scenes to ensure font and palette propagation to
@@ -172,13 +128,12 @@ public:
static QSize app_strut;
static QWidgetList *popupWidgets;
static QStyle *app_style;
- static QPalette *sys_pal;
- static QPalette *set_pal;
protected:
- void notifyThemeChanged() override;
- void sendApplicationPaletteChange(bool toAllWidgets = false,
- const char *className = nullptr) override;
+ void handleThemeChanged() override;
+
+ QPalette basePalette() const override;
+ void handlePaletteChanged(const char *className = nullptr) override;
#if QT_CONFIG(draganddrop)
void notifyDragStarted(const QDrag *) override;
@@ -190,24 +145,19 @@ public:
static QWidget *main_widget;
static QWidget *focus_widget;
static QWidget *hidden_focus_widget;
- static QWidget *active_window;
#if QT_CONFIG(wheelevent)
- static int wheel_scroll_lines;
static QPointer<QWidget> wheel_widget;
#endif
static int enabledAnimations; // Combination of QPlatformTheme::UiEffect
static bool widgetCount; // Coupled with -widgetcount switch
- static void setSystemPalette(const QPalette &pal);
- static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash);
- static void initializeWidgetPaletteHash();
+ static void initializeWidgetPalettesFromTheme();
static void initializeWidgetFontHash();
static void setSystemFont(const QFont &font);
-#if 0 // Used to be included in Qt4 for Q_WS_X11
- static void applyX11SpecificCommandLineArguments(QWidget *main_widget);
-#endif
+ using PaletteHash = QHash<QByteArray, QPalette>;
+ static PaletteHash widgetPalettes;
static QApplicationPrivate *instance() { return self; }
@@ -216,10 +166,6 @@ public:
static Qt::NavigationMode navigationMode;
#endif
-#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ || 0 /* Used to be included in Qt4 for Q_WS_X11 */
- void _q_alertTimeOut();
- QHash<QWidget *, QTimer *> alertTimerHash;
-#endif
#ifndef QT_NO_STYLE_STYLESHEET
static QString styleSheet;
#endif
@@ -238,7 +184,7 @@ public:
return window;
if (const QWidget *nativeParent = widget->nativeParentWidget())
return nativeParent->windowHandle();
- return 0;
+ return nullptr;
}
#ifdef Q_OS_WIN
@@ -256,31 +202,23 @@ public:
QGestureManager *gestureManager;
QWidget *gestureWidget;
#endif
-#if 0 /* Used to be included in Qt4 for Q_WS_X11 */ || 0 /* Used to be included in Qt4 for Q_WS_WIN */
- QPixmap *move_cursor;
- QPixmap *copy_cursor;
- QPixmap *link_cursor;
-#endif
-#if 0 // Used to be included in Qt4 for Q_WS_WIN
- QPixmap *ignore_cursor;
-#endif
static bool updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent);
void initializeMultitouch();
void initializeMultitouch_sys();
void cleanupMultitouch();
void cleanupMultitouch_sys();
- QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint);
- void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint);
+ QWidget *findClosestTouchPointTarget(const QPointingDevice *device, const QEventPoint &touchPoint);
+ void appendTouchPoint(const QEventPoint &touchPoint);
void removeTouchPoint(int touchPointId);
- void activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchBeginEvent);
- static bool translateRawTouchEvent(QWidget *widget,
- QTouchDevice *device,
- const QList<QTouchEvent::TouchPoint> &touchPoints,
- ulong timestamp);
- static void translateTouchCancel(QTouchDevice *device, ulong timestamp);
+ enum ImplicitTouchGrabMode { GrabAcceptedPoints, GrabAllPoints };
+ void activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchBeginEvent,
+ ImplicitTouchGrabMode grabMode = GrabAcceptedPoints);
+ static bool translateRawTouchEvent(QWidget *widget, const QTouchEvent *touchEvent);
+ static void translateTouchCancel(const QPointingDevice *device, ulong timestamp);
QPixmap applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const override;
+
private:
static QApplicationPrivate *self;
static bool tryCloseAllWidgetWindows(QWindowList *processedWindows);
@@ -288,18 +226,12 @@ private:
static void giveFocusAccordingToFocusPolicy(QWidget *w, QEvent *event, QPoint localPos);
static bool shouldSetFocus(QWidget *w, Qt::FocusPolicy policy);
+ static QWidget *active_window;
static bool isAlien(QWidget *);
};
-#if 0 // Used to be included in Qt4 for Q_WS_WIN
- extern void qt_win_set_cursor(QWidget *, bool);
-#elif 0 // Used to be included in Qt4 for Q_WS_X11
- extern void qt_x11_enforce_cursor(QWidget *, bool);
- extern void qt_x11_enforce_cursor(QWidget *);
-#else
- extern void qt_qpa_set_cursor(QWidget * w, bool force);
-#endif
+extern void qt_qpa_set_cursor(QWidget * w, bool force);
QT_END_NAMESPACE