64 Q_DECLARE_PUBLIC(QApplication)
66 QApplicationPrivate(
int &argc,
char **argv);
67 ~QApplicationPrivate();
69 virtual void notifyLayoutDirectionChange() override;
70 virtual void notifyActiveWindowChange(QWindow *) override;
72 static bool autoSipEnabled;
73 static QString desktopStyleKey();
75 void createEventDispatcher() override;
76 static void dispatchEnterLeave(QWidget *enter, QWidget *leave,
const QPointF &globalPosF);
77 static QWidget *desktop();
78 void notifyWindowIconChanged() override;
79 bool compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents) final;
82 QActionPrivate *createActionPrivate()
const override;
85 QShortcutPrivate *createShortcutPrivate()
const override;
89 Qt::WindowModality defaultModality()
const override;
90 bool windowNeverBlocked(QWindow *window)
const override;
91 static bool isBlockedByModal(QWidget *widget);
92 static bool modalState();
93 static bool tryModalHelper(QWidget *widget, QWidget **rettop =
nullptr);
95#ifdef QT_KEYPAD_NAVIGATION
96 static bool keypadNavigationEnabled()
98 return navigationMode == Qt::NavigationModeKeypadTabOrder ||
99 navigationMode == Qt::NavigationModeKeypadDirectional;
103 bool notify_helper(QObject *receiver, QEvent * e);
107 void process_cmdline();
109 static void setActiveWindow(QWidget* act);
111 static bool inPopupMode();
112 void closePopup(QWidget *popup);
113 void openPopup(QWidget *popup);
114 static bool replayMousePress;
116 static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);
117 static QWidget *focusNextPrevChild_helper(QWidget *toplevel,
bool next,
118 bool *wrappingOccurred =
nullptr);
120#if QT_CONFIG(graphicsview)
123 QList<QGraphicsScene *> scene_list;
126 QBasicTimer toolTipWakeUp, toolTipFallAsleep;
127 QPoint toolTipPos, toolTipGlobalPos;
128 QPointer<QWidget> toolTipWidget;
130 static QSize app_strut;
131 static QWidgetList *popupWidgets;
132 static QStyle *app_style;
135 void handleThemeChanged() override;
137 QPalette basePalette()
const override;
138 void handlePaletteChanged(
const char *className =
nullptr) override;
140#if QT_CONFIG(draganddrop)
141 void notifyDragStarted(
const QDrag *) override;
145 static QFont *sys_font;
146 static QFont *set_font;
147 static QWidget *main_widget;
148 static QWidget *focus_widget;
149 static QWidget *hidden_focus_widget;
150#if QT_CONFIG(wheelevent)
151 static QPointer<QWidget> wheel_widget;
154 static int enabledAnimations;
155 static bool widgetCount;
157 static void initializeWidgetPalettesFromTheme();
158 static void initializeWidgetFontHash();
159 static void setSystemFont(
const QFont &font);
161 using PaletteHash = QHash<QByteArray, QPalette>;
162 static PaletteHash widgetPalettes;
164 static QApplicationPrivate *instance() {
return self; }
166#ifdef QT_KEYPAD_NAVIGATION
167 static QWidget *oldEditFocus;
168 static Qt::NavigationMode navigationMode;
171#ifndef QT_NO_STYLE_STYLESHEET
172 static QString styleSheet;
174 static QPointer<QWidget> leaveAfterRelease;
175 static QWidget *pickMouseReceiver(QWidget *candidate,
const QPointF &windowPos, QPointF *pos,
176 QEvent::Type type, Qt::MouseButtons buttons,
177 QWidget *buttonDown, QWidget *alienWidget);
178 static bool sendMouseEvent(QWidget *receiver, QMouseEvent *event, QWidget *alienWidget,
179 QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,
180 bool spontaneous =
true,
bool onlyDispatchEnterLeave =
false);
181 void sendSyntheticEnterLeave(QWidget *widget);
183 static QWindow *windowForWidget(
const QWidget *widget)
185 if (QWindow *window = widget->windowHandle())
187 if (
const QWidget *nativeParent = widget->nativeParentWidget())
188 return nativeParent->windowHandle();
193 static HWND getHWNDForWidget(
const QWidget *widget)
195 if (QWindow *window = windowForWidget(widget))
196 if (window->handle() && QGuiApplication::platformNativeInterface())
197 return static_cast<HWND> (QGuiApplication::platformNativeInterface()->
198 nativeResourceForWindow(QByteArrayLiteral(
"handle"), window));
203#ifndef QT_NO_GESTURES
204 QGestureManager *gestureManager;
205 QWidget *gestureWidget;
208 static bool updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent);
209 void initializeMultitouch();
210 void initializeMultitouch_sys();
211 void cleanupMultitouch();
212 void cleanupMultitouch_sys();
213 QWidget *findClosestTouchPointTarget(
const QPointingDevice *device,
const QEventPoint &touchPoint);
214 void appendTouchPoint(
const QEventPoint &touchPoint);
215 void removeTouchPoint(
int touchPointId);
216 enum ImplicitTouchGrabMode { GrabAcceptedPoints, GrabAllPoints };
217 void activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchBeginEvent,
218 ImplicitTouchGrabMode grabMode = GrabAcceptedPoints);
219 static bool translateRawTouchEvent(QWidget *widget,
const QTouchEvent *touchEvent);
220 static void translateTouchCancel(
const QPointingDevice *device, ulong timestamp);
222 QPixmap applyQIconStyleHelper(QIcon::Mode mode,
const QPixmap& base)
const override;
225 static QApplicationPrivate *self;
226 static bool tryCloseAllWidgetWindows(QWindowList *processedWindows);
228 static void giveFocusAccordingToFocusPolicy(QWidget *w, QEvent *event, QPoint localPos);
229 static bool shouldSetFocus(QWidget *w, Qt::FocusPolicy policy);
231 static QWidget *active_window;
233 static bool isAlien(QWidget *);
Q_GLOBAL_STATIC(DefaultRoleNames, qDefaultRoleNames, { { Qt::DisplayRole, "display" }, { Qt::DecorationRole, "decoration" }, { Qt::EditRole, "edit" }, { Qt::ToolTipRole, "toolTip" }, { Qt::StatusTipRole, "statusTip" }, { Qt::WhatsThisRole, "whatsThis" }, }) const QHash< int