Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindowsinputcontext.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 QWINDOWSINPUTCONTEXT_H
5#define QWINDOWSINPUTCONTEXT_H
6
7#include <QtCore/qt_windows.h>
8
9#include <QtCore/qlocale.h>
10#include <QtCore/qpointer.h>
11#include <qpa/qplatforminputcontext.h>
12
14
15class QInputMethodEvent;
16class QWindowsWindow;
17
19{
22
24 {
25 HWND hwnd = nullptr;
27 int position = 0;
28 bool isComposing = false;
30 };
31public:
32 explicit QWindowsInputContext();
34
35 static void setWindowsImeEnabled(QWindowsWindow *platformWindow, bool enabled);
36
37 bool hasCapability(Capability capability) const override;
38 QLocale locale() const override { return m_locale; }
39
40 void reset() override;
41 void update(Qt::InputMethodQueries) override;
42 void invokeAction(QInputMethod::Action, int cursorPosition) override;
43 void setFocusObject(QObject *object) override;
44
45 QRectF keyboardRect() const override;
46 bool isInputPanelVisible() const override;
49
50 bool startComposition(HWND hwnd);
51 bool composition(HWND hwnd, LPARAM lParam);
52 bool endComposition(HWND hwnd);
53 inline bool isComposing() const { return m_compositionContext.isComposing; }
54
55 int reconvertString(RECONVERTSTRING *reconv);
56
57 bool handleIME_Request(WPARAM wparam, LPARAM lparam, LRESULT *result);
58 void handleInputLanguageChanged(WPARAM wparam, LPARAM lparam);
59
60private slots:
61 void cursorRectChanged();
62
63private:
64 void initContext(HWND hwnd, QObject *focusObject);
65 void doneContext();
66 void startContextComposition();
67 void endContextComposition();
68 void updateEnabled();
69 HWND getVirtualKeyboardWindowHandle() const;
70
71 const DWORD m_WM_MSIME_MOUSE;
72 bool m_caretCreated = false;
73 HBITMAP m_transparentBitmap;
74 CompositionContext m_compositionContext;
75 bool m_endCompositionRecursionGuard = false;
76 LCID m_languageId;
77 QLocale m_locale;
78};
79
80QT_END_NAMESPACE
81
82#endif // QWINDOWSINPUTCONTEXT_H
\inmodule QtCore\reentrant
Definition qpoint.h:29
Singleton container for all relevant information.
QSharedPointer< QWindowCreationContext > windowCreationContext() const
QWindowsScreenManager & screenManager()
QWindowsWindow * findClosestPlatformWindow(HWND) const
QWindow * findWindow(HWND) const
bool asyncExpose() const
void addWindow(HWND, QWindowsWindow *w)
static bool systemParametersInfoForScreen(unsigned action, unsigned param, void *out, const QPlatformScreen *screen=nullptr)
static bool setProcessDpiAwareness(QtWindows::DpiAwareness dpiAwareness)
HDC displayContext() const
QWindowsTabletSupport * tabletSupport() const
static bool systemParametersInfoForWindow(unsigned action, unsigned param, void *out, const QPlatformWindow *win=nullptr)
static void setTabletAbsoluteRange(int a)
QWindowsWindow * findPlatformWindowAt(HWND parent, const QPoint &screenPoint, unsigned cwex_flags) const
bool initTouch(unsigned integrationOptions)
HWND createDummyWindow(const QString &classNameIn, const wchar_t *windowName, WNDPROC wndProc=nullptr, DWORD style=WS_OVERLAPPED)
Convenience to create a non-visible, message-only dummy window for example used as clipboard watcher ...
void setAsyncExpose(bool value)
QSharedPointer< QWindowCreationContext > setWindowCreationContext(const QSharedPointer< QWindowCreationContext > &ctx)
bool windowsProc(HWND hwnd, UINT message, QtWindows::WindowsEventType et, WPARAM wParam, LPARAM lParam, LRESULT *result, QWindowsWindow **platformWindowPtr)
Main windows procedure registered for windows.
unsigned systemInfo() const
static QtWindows::DpiAwareness processDpiAwareness()
QWindowsWindow * findPlatformWindow(HWND) const
QWindow * keyGrabber() const
QWindowsWindow * findPlatformWindow(const QWindowsMenuBar *mb) const
QWindow * windowUnderMouse() const
QPlatformKeyMapper * keyMapper() const
bool useRTLExtensions() const
static bool systemParametersInfo(unsigned action, unsigned param, void *out, unsigned dpi=0)
QWindowsMimeRegistry & mimeConverter() const
static bool isSessionLocked()
int screenDepth() const
bool initPowerNotificationHandler()
HandleBaseWindowHash & windows()
static QWindowsContext * instance()
QString registerWindowClass(QString cname, WNDPROC proc, unsigned style=0, HBRUSH brush=nullptr, bool icon=false)
void setDetectAltGrModifier(bool a)
Platform cursor implementation.
static bool hasOverrideCursor()
static void enforceOverrideCursor()
Windows Input context implementation.
QLocale locale() const override
QRectF keyboardRect() const override
This function can be reimplemented to return virtual keyboard rectangle in currently active window co...
void update(Qt::InputMethodQueries) override
Moves the candidate window along with microfocus of the focus object.
bool composition(HWND hwnd, LPARAM lParam)
Notify focus object about markup or final text.
bool hasCapability(Capability capability) const override
Returns whether the implementation supports capability.
void invokeAction(QInputMethod::Action, int cursorPosition) override
Called when the word currently being composed in the input item is tapped by the user.
void handleInputLanguageChanged(WPARAM wparam, LPARAM lparam)
void showInputPanel() override
Request to show input panel.
static void setWindowsImeEnabled(QWindowsWindow *platformWindow, bool enabled)
bool isInputPanelVisible() const override
Returns input panel visibility status.
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
bool handleIME_Request(WPARAM wparam, LPARAM lparam, LRESULT *result)
int reconvertString(RECONVERTSTRING *reconv)
Determines the string for reconversion with selection.
void hideInputPanel() override
Request to hide input panel.
void reset() override
Cancels a composition.
static QWindowsIntegration * instance()
Translates Windows keys to QWindowSystemInterface events.
bool translateKeyEvent(QWindow *widget, HWND hwnd, const MSG &msg, LRESULT *result)
To be called from the window procedure.
bool detectAltGrModifier() const
void setUseRTLExtensions(bool e)
QWindow * keyGrabber() const
Qt::KeyboardModifiers queryKeyboardModifiers() const override
bool useRTLExtensions() const
void setKeyGrabber(QWindow *w)
void setDetectAltGrModifier(bool a)
QList< QKeyCombination > possibleKeyCombinations(const QKeyEvent *e) const override
Windows native menu bar.
static QWindowsMenuBar * menuBarOf(const QWindow *notYetCreatedWindow)
void formatDebug(QDebug &d) const
void syncMenu(QPlatformMenu *) override
const Menus & menus() const
void removeMenu(QPlatformMenu *menu) override
void insertMenu(QPlatformMenu *menu, QPlatformMenu *before) override
void notifyRemoved(QWindowsMenu *menu)
bool notifyAboutToShow(HMENU hmenu)
void install(QWindowsWindow *window)
HMENU menuBarHandle() const
~QWindowsMenuBar() override
QPlatformMenu * menuForTag(quintptr tag) const override
bool notifyTriggered(uint id)
void handleReparent(QWindow *newParentWindow) override
QPlatformMenu * createMenu() const override
void redraw() const
void setChecked(bool isChecked) override
void setCheckable(bool checkable) override
void insertIntoMenu(QWindowsMenu *menuItem, bool append, int index)
UINT state() const
QString text() const
void setIconSize(int size) override
void formatDebug(QDebug &d) const
void setRole(MenuRole) override
void setIsSeparator(bool isSeparator) override
QString nativeText() const
~QWindowsMenuItem() override
void setIcon(const QIcon &icon) override
void setMenu(QPlatformMenu *menu) override
void setId(uint id)
UINT_PTR id() const
void setShortcut(const QKeySequence &shortcut) override
void setText(const QString &text) override
bool isVisible() const
void setEnabled(bool enabled) override
void setVisible(bool isVisible) override
const QWindowsMenu * parentMenu() const
HMENU parentMenuHandle() const
QWindowsMenu * subMenu() const
QWindowsMenu * parentMenu()
void setFont(const QFont &) override
HMENU parentMenuBarHandle() const
void setText(const QString &text) override
QString text() const
void syncSeparatorsCollapsible(bool) override
UINT_PTR id() const
HMENU parentHandle() const
void setEnabled(bool enabled) override
void syncMenuItem(QPlatformMenuItem *) override
const QWindowsMenu * parentMenu() const
void notifyRemoved(QWindowsMenuItem *item)
QPlatformMenu * createSubMenu() const override
void removeMenuItem(QPlatformMenuItem *menuItem) override
bool isEnabled() const override
bool isVisible() const
QPlatformMenuItem * createMenuItem() const override
const MenuItems & menuItems() const
void formatDebug(QDebug &d) const
HMENU menuHandle() const
QPlatformMenuItem * menuItemAt(int position) const override
void setVisible(bool visible) override
void setIcon(const QIcon &icon) override
HMENU parentMenuHandle() const
QPlatformMenuItem * menuItemForTag(quintptr tag) const override
void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) override
QWindowsMenuItem * itemForSubMenu(const QWindowsMenu *subMenu) const
bool removeFromParent()
void setAsItemSubMenu(QWindowsMenuItem *item)
const QWindowsMenuBar * parentMenuBar() const
QWindowsMenu(QWindowsMenu *parentMenu, HMENU menu)
void insertIntoMenuBar(QWindowsMenuBar *bar, bool append, int index)
Manages the list of QWindowsMimeConverter instances.
QWindow * windowUnderMouse() const
static QPointingDevicePtr createTouchDevice(bool mouseEmulation)
QWindowsPointerHandler()=default
static Qt::MouseButtons queryMouseButtons()
const QPointingDevicePtr & touchDevice() const
bool translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result)
bool translateMouseEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result)
void setTouchDevice(const QPointingDevicePtr &d)
static bool notifyAboutToShow(HMENU hmenu)
static bool notifyTriggered(uint id)
void dismiss() override
void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) override
bool trackPopupMenu(HWND windowHandle, int x, int y)
Manages a list of QWindowsScreen.
Tablet support for Windows.
static QWindowsTheme * instance()
Raster or OpenGL Window.
void alertWindow(int durationMs=0)
void checkForScreenChanged(ScreenChangeMode mode=FromGeometryChange)
bool testFlag(unsigned f) const
void setFlag(unsigned f) const
void clearFlag(unsigned f) const
static void settingsChanged()
static const char * embeddedNativeParentHandleProperty
QWindowsMenuBar * menuBar() const
bool frameStrutEventsEnabled() const override
Reimplement this method to return whether frame strut events are enabled.
@ WithinSetParent
Automatic mouse capture on button press.
void handleCompositionSettingsChanged()
WindowsEventType
Enumerations for WM_XX events.
@ PointerActivateWindowEvent
@ InputMethodEndCompositionEvent
@ ShowEventOnParentRestoring
@ InputMethodCompositionEvent
@ InputMethodOpenCandidateWindowEvent
@ MouseActivateWindowEvent
@ DpiChangedAfterParentEvent
@ InputMethodStartCompositionEvent
@ CompositionSettingsChanged
@ InputMethodCloseCandidateWindowEvent
@ AccessibleObjectFromWindowRequest
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
#define WM_TOUCH
#define DPI_AWARENESS_CONTEXT_UNAWARE
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE
#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED
static bool isTopLevel(HWND hwnd)
#define LANG_SYRIAC
static RECT rectFromNcCalcSize(UINT message, WPARAM wParam, LPARAM lParam, int n)
static bool enableNonClientDpiScaling(HWND hwnd)
static bool isInputMessage(UINT m)
static DPI_AWARENESS_CONTEXT qtDpiAwarenessToDpiAwarenessContext(QtWindows::DpiAwareness dpiAwareness)
static bool isMinimized(HWND hwnd)
static QMargins marginsFromRects(const RECT &frame, const RECT &client)
static bool useRTL_Extensions()
static bool sessionManagerInteractionBlocked()
static QWindowsInputContext * windowsInputContext()
static QtWindows::DpiAwareness dpiAwarenessContextToQtDpiAwareness(DPI_AWARENESS_CONTEXT context)
static QByteArray nativeEventType()
static bool isEmptyRect(const RECT &rect)
static bool findPlatformWindowHelper(const POINT &screenPoint, unsigned cwexFlags, const QWindowsContext *context, HWND *hwnd, QWindowsWindow **result)
Find a child window at a screen point.
WindowsNativeModifiers
@ ScrollLock
@ ExtendedKey
@ ShiftRight
@ LockAny
@ AltLeft
@ ShiftLeft
@ MetaRight
@ MetaLeft
@ MetaAny
@ AltRight
@ ControlLeft
@ ControlRight
@ CapsLock
@ NumLock
@ ShiftAny
@ ControlAny
quint32 qtKey[NumQtKeys]
static const size_t NumQtKeys
const HRESULT m_oleInitializeResult
QWindowsKeyMapper m_keyMapper
QWindowsPointerHandler m_pointerHandler
QSet< QString > m_registeredWindowClassNames
QWindowsScreenManager m_screenManager
QWindowsMimeRegistry m_mimeConverter
QWindowsContext::HandleBaseWindowHash m_windows
QSharedPointer< QWindowCreationContext > m_creationContext