Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qibusplatforminputcontext.cpp
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
4
5#include <QDebug>
6#include <QTextCharFormat>
7#include <QGuiApplication>
8#include <QWindow>
9#include <QEvent>
10#include <QFile>
11#include <QFileInfo>
12#include <QStandardPaths>
13#include <QDBusVariant>
14#include <QDBusPendingReply>
15#include <QDBusReply>
16#include <QDBusServiceWatcher>
17
18#include "qibusproxy.h"
19#include "qibusproxyportal.h"
21#include "qibustypes.h"
22
23#include <qpa/qplatformcursor.h>
24#include <qpa/qplatformscreen.h>
25#include <qpa/qwindowsysteminterface_p.h>
26
27#include <private/qguiapplication_p.h>
28#include <private/qxkbcommon_p.h>
29
30#include <memory>
31
32#include <sys/types.h>
33#include <signal.h>
34
35
36#ifndef IBUS_RELEASE_MASK
37#define IBUS_RELEASE_MASK (1 << 30)
38#define IBUS_SHIFT_MASK (1 << 0)
39#define IBUS_CONTROL_MASK (1 << 2)
40#define IBUS_MOD1_MASK (1 << 3)
41#define IBUS_META_MASK (1 << 28)
42#endif
43
45
46using namespace Qt::StringLiterals;
47
48enum { debug = 0 };
49
51{
52 Q_DISABLE_COPY_MOVE(QIBusPlatformInputContextPrivate)
53public:
56 {
57 // dereference QDBusConnection to actually disconnect
59 context = nullptr;
60 portalBus = nullptr;
61 bus = nullptr;
63 }
64
65 static QString getSocketPath();
66
67 void createConnection();
68 void initBus();
69 void createBusProxy();
70
71 std::unique_ptr<QIBusProxy> bus;
72 std::unique_ptr<QIBusProxyPortal> portalBus; // bus and portalBus are alternative.
73 std::unique_ptr<QIBusInputContextProxy> context;
75
76 bool usePortal; // return value of shouldConnectIbusPortal
77 bool valid;
83};
84
85
88{
89 if (!d->usePortal) {
91 QFile file(socketPath);
93#if QT_CONFIG(filesystemwatcher)
94 qCDebug(qtQpaInputMethods) << "socketWatcher.addPath" << socketPath;
95 // If KDE session save is used or restart ibus-daemon,
96 // the applications could run before ibus-daemon runs.
97 // We watch the getSocketPath() to get the launching ibus-daemon.
98 m_socketWatcher.addPath(socketPath);
99 connect(&m_socketWatcher, SIGNAL(fileChanged(QString)), this, SLOT(socketChanged(QString)));
100#endif
101 }
102 m_timer.setSingleShot(true);
103 connect(&m_timer, SIGNAL(timeout()), this, SLOT(connectToBus()));
104 }
105
106 QObject::connect(&d->serviceWatcher, SIGNAL(serviceRegistered(QString)), this, SLOT(busRegistered(QString)));
107 QObject::connect(&d->serviceWatcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(busUnregistered(QString)));
108
109 connectToContextSignals();
110
111 QInputMethod *p = qApp->inputMethod();
112 connect(p, SIGNAL(cursorRectangleChanged()), this, SLOT(cursorRectChanged()));
113 m_eventFilterUseSynchronousMode = false;
114 if (qEnvironmentVariableIsSet("IBUS_ENABLE_SYNC_MODE")) {
115 bool ok;
116 int enableSync = qEnvironmentVariableIntValue("IBUS_ENABLE_SYNC_MODE", &ok);
117 if (ok && enableSync == 1)
118 m_eventFilterUseSynchronousMode = true;
119 }
120}
121
123{
124 delete d;
125}
126
128{
129 return d->valid && d->busConnected;
130}
131
133{
134 switch (capability) {
136 return false; // QTBUG-40691, do not show IME on desktop for password entry fields.
137 default:
138 break;
139 }
140 return true;
141}
142
144{
145 if (!d->busConnected)
146 return;
147
148 if (a == QInputMethod::Click)
149 commit();
150}
151
153{
154 if (!d->busConnected)
155 return;
156
157 d->context->Reset();
158 d->predit = QString();
159 d->attributes.clear();
160}
161
163{
164 if (!d->busConnected)
165 return;
166
167 QObject *input = qApp->focusObject();
168 if (!input) {
169 d->predit = QString();
170 d->attributes.clear();
171 return;
172 }
173
174 if (!d->predit.isEmpty()) {
176 event.setCommitString(d->predit);
178 }
179
180 d->context->Reset();
181 d->predit = QString();
182 d->attributes.clear();
183}
184
185
186void QIBusPlatformInputContext::update(Qt::InputMethodQueries q)
187{
188 QObject *input = qApp->focusObject();
189
191 && (q.testFlag(Qt::ImSurroundingText)
192 || q.testFlag(Qt::ImCursorPosition)
193 || q.testFlag(Qt::ImAnchorPosition))) {
194
196
198
199 QString surroundingText = query.value(Qt::ImSurroundingText).toString();
200 uint cursorPosition = query.value(Qt::ImCursorPosition).toUInt();
201 uint anchorPosition = query.value(Qt::ImAnchorPosition).toUInt();
202
204 text.text = surroundingText;
205
208 QDBusVariant dbusText(variant);
209
210 d->context->SetSurroundingText(dbusText, cursorPosition, anchorPosition);
211 }
212}
213
215{
216 if (!d->busConnected)
217 return;
218
219 QRect r = qApp->inputMethod()->cursorRectangle().toRect();
220 if (!r.isValid())
221 return;
222
223 QWindow *inputWindow = qApp->focusWindow();
224 if (!inputWindow)
225 return;
226 if (!inputWindow->screen())
227 return;
228
229 if (QGuiApplication::platformName().startsWith("wayland"_L1)) {
230 auto margins = inputWindow->frameMargins();
231 r.translate(margins.left(), margins.top());
232 qreal scale = inputWindow->devicePixelRatio();
233 QRect newRect = QRect(r.x() * scale, r.y() * scale, r.width() * scale, r.height() * scale);
234 if (debug)
235 qDebug() << "microFocus" << newRect;
236 d->context->SetCursorLocationRelative(newRect.x(), newRect.y(),
237 newRect.width(), newRect.height());
238 return;
239 }
240
241 // x11/xcb
242 auto screenGeometry = inputWindow->screen()->geometry();
243 auto point = inputWindow->mapToGlobal(r.topLeft());
244 qreal scale = inputWindow->devicePixelRatio();
245 auto native = (point - screenGeometry.topLeft()) * scale + screenGeometry.topLeft();
246 QRect newRect(native, r.size() * scale);
247 if (debug)
248 qDebug() << "microFocus" << newRect;
249 d->context->SetCursorLocation(newRect.x(), newRect.y(),
250 newRect.width(), newRect.height());
251}
252
254{
255 if (!d->busConnected)
256 return;
257
258 // It would seem natural here to call FocusOut() on the input method if we
259 // transition from an IME accepted focus object to one that does not accept it.
260 // Mysteriously however that is not sufficient to fix bug QTBUG-63066.
261 if (object && !inputMethodAccepted())
262 return;
263
264 if (debug)
265 qDebug() << "setFocusObject" << object;
266 if (object)
267 d->context->FocusIn();
268 else
269 d->context->FocusOut();
270}
271
273{
274 QObject *input = qApp->focusObject();
275 if (!input)
276 return;
277
278 const QDBusArgument arg = qvariant_cast<QDBusArgument>(text.variant());
279
280 QIBusText t;
281 if (debug)
282 qDebug() << arg.currentSignature();
283 arg >> t;
284 if (debug)
285 qDebug() << "commit text:" << t.text;
286
288 event.setCommitString(t.text);
290
291 d->predit = QString();
292 d->attributes.clear();
293}
294
296{
297 if (!qApp)
298 return;
299
300 QObject *input = qApp->focusObject();
301 if (!input)
302 return;
303
304 const QDBusArgument arg = qvariant_cast<QDBusArgument>(text.variant());
305
306 QIBusText t;
307 arg >> t;
308 if (debug)
309 qDebug() << "preedit text:" << t.text;
310
311 d->attributes = t.attributes.imAttributes();
312 if (!t.text.isEmpty())
314
317
318 d->predit = t.text;
319}
320
322{
323 if (!qApp)
324 return;
325
326 QObject *input = qApp->focusObject();
327 if (!input)
328 return;
329
333
334 state &= ~IBUS_RELEASE_MASK;
335 keycode += 8;
336
337 Qt::KeyboardModifiers modifiers = Qt::NoModifier;
342 if (state & IBUS_MOD1_MASK)
344 if (state & IBUS_META_MASK)
346
347 int qtcode = QXkbCommon::keysymToQtKey(keyval, modifiers);
349
350 if (debug)
351 qDebug() << "forwardKeyEvent" << keyval << keycode << state << modifiers << qtcode << text;
352
353 QKeyEvent event(type, qtcode, modifiers, keycode, keyval, state, text);
355}
356
358{
359 if (debug)
360 qDebug("surroundingTextRequired");
361 d->needsSurroundingText = true;
363}
364
366{
367 QObject *input = qApp->focusObject();
368 if (!input)
369 return;
370
371 if (debug)
372 qDebug() << "deleteSurroundingText" << offset << n_chars;
373
375 event.setCommitString("", offset, n_chars);
377}
378
380{
382 if (!input)
383 return;
384
386 QInputMethodEvent event(QString(), attributes);
388}
389
391{
393 if (!input)
394 return;
395
398}
399
401{
402 if (!d->busConnected)
403 return false;
404
405 if (!inputMethodAccepted())
406 return false;
407
408 const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
409 quint32 sym = keyEvent->nativeVirtualKey();
410 quint32 code = keyEvent->nativeScanCode();
411 quint32 state = keyEvent->nativeModifiers();
412 quint32 ibusState = state;
413
414 if (keyEvent->type() != QEvent::KeyPress)
415 ibusState |= IBUS_RELEASE_MASK;
416
417 QDBusPendingReply<bool> reply = d->context->ProcessKeyEvent(sym, code - 8, ibusState);
418
419 if (m_eventFilterUseSynchronousMode || reply.isFinished()) {
420 bool filtered = reply.value();
421 qCDebug(qtQpaInputMethods) << "filterEvent return" << code << sym << state << filtered;
422 return filtered;
423 }
424
425 Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
426 const int qtcode = keyEvent->key();
427
428 // From QKeyEvent::modifiers()
429 switch (qtcode) {
430 case Qt::Key_Shift:
432 break;
433 case Qt::Key_Control:
435 break;
436 case Qt::Key_Alt:
438 break;
439 case Qt::Key_Meta:
441 break;
442 case Qt::Key_AltGr:
444 break;
445 }
446
448 args << QVariant::fromValue(keyEvent->timestamp());
449 args << QVariant::fromValue(static_cast<uint>(keyEvent->type()));
450 args << QVariant::fromValue(qtcode);
452 args << QVariant::fromValue(keyEvent->text());
453 args << QVariant::fromValue(keyEvent->isAutoRepeat());
454
457
458 return true;
459}
460
462{
465
466 if (reply.isError()) {
467 call->deleteLater();
468 return;
469 }
470
471 // Use watcher's window instead of the current focused window
472 // since there is a time lag until filterEventFinished() returns.
473 QWindow *window = watcher->window();
474
475 if (!window) {
476 call->deleteLater();
477 return;
478 }
479
480 Qt::KeyboardModifiers modifiers = watcher->modifiers();
481 QVariantList args = watcher->arguments();
482 const ulong time = static_cast<ulong>(args.at(0).toUInt());
483 const QEvent::Type type = static_cast<QEvent::Type>(args.at(1).toUInt());
484 const int qtcode = args.at(2).toInt();
485 const quint32 code = args.at(3).toUInt();
486 const quint32 sym = args.at(4).toUInt();
487 const quint32 state = args.at(5).toUInt();
488 const QString string = args.at(6).toString();
489 const bool isAutoRepeat = args.at(7).toBool();
490
491 // copied from QXcbKeyboard::handleKeyEvent()
492 bool filtered = reply.value();
493 qCDebug(qtQpaInputMethods) << "filterEventFinished return" << code << sym << state << filtered;
494 if (!filtered) {
495#ifndef QT_NO_CONTEXTMENU
496 if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu
497 && window != nullptr) {
498 const QPoint globalPos = window->screen()->handle()->cursor()->pos();
499 const QPoint pos = window->mapFromGlobal(globalPos);
501 globalPos, modifiers);
503 }
504#endif
506 code, sym, state, string, isAutoRepeat);
508 }
509 call->deleteLater();
510}
511
513{
514 // d->locale is not updated when IBus portal is used
515 if (d->usePortal)
517 return d->locale;
518}
519
521{
522 qCDebug(qtQpaInputMethods) << "socketChanged";
523 Q_UNUSED (str);
524
525 m_timer.stop();
526
527 // dereference QDBusConnection to actually disconnect
529 d->context = nullptr;
530 d->bus = nullptr;
531 d->busConnected = false;
532 QDBusConnection::disconnectFromBus("QIBusProxy"_L1);
533
534 m_timer.start(100);
535}
536
538{
539 qCDebug(qtQpaInputMethods) << "busRegistered";
540 Q_UNUSED (str);
541 if (d->usePortal) {
542 connectToBus();
543 }
544}
545
547{
548 qCDebug(qtQpaInputMethods) << "busUnregistered";
549 Q_UNUSED (str);
550 d->busConnected = false;
551}
552
553// When getSocketPath() is modified, the bus is not established yet
554// so use m_timer.
556{
557 qCDebug(qtQpaInputMethods) << "QIBusPlatformInputContext::connectToBus";
558 d->initBus();
559 connectToContextSignals();
560
561#if QT_CONFIG(filesystemwatcher)
562 if (!d->usePortal && m_socketWatcher.files().size() == 0)
563 m_socketWatcher.addPath(QIBusPlatformInputContextPrivate::getSocketPath());
564#endif
565}
566
568{
569 if (!d->bus || !d->bus->isValid())
570 return;
571
572 QIBusEngineDesc desc = d->bus->getGlobalEngine();
573 Q_ASSERT(engine_name == desc.engine_name);
574 QLocale locale(desc.language);
575 if (d->locale != locale) {
576 d->locale = locale;
578 }
579}
580
581void QIBusPlatformInputContext::connectToContextSignals()
582{
583 if (d->bus && d->bus->isValid()) {
584 connect(d->bus.get(), SIGNAL(GlobalEngineChanged(QString)), this, SLOT(globalEngineChanged(QString)));
585 }
586
587 if (d->context) {
588 connect(d->context.get(), SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant)));
589 connect(d->context.get(), SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool)));
590 connect(d->context.get(), SIGNAL(ForwardKeyEvent(uint,uint,uint)), this, SLOT(forwardKeyEvent(uint,uint,uint)));
591 connect(d->context.get(), SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint)));
592 connect(d->context.get(), SIGNAL(RequireSurroundingText()), this, SLOT(surroundingTextRequired()));
593 connect(d->context.get(), SIGNAL(HidePreeditText()), this, SLOT(hidePreeditText()));
594 connect(d->context.get(), SIGNAL(ShowPreeditText()), this, SLOT(showPreeditText()));
595 }
596}
597
598static inline bool checkNeedPortalSupport()
599{
600 return QFileInfo::exists("/.flatpak-info"_L1) || qEnvironmentVariableIsSet("SNAP");
601}
602
604{
605 // honor the same env as ibus-gtk
606 return (checkNeedPortalSupport() || qEnvironmentVariableIsSet("IBUS_USE_PORTAL"));
607}
608
610 : usePortal(shouldConnectIbusPortal()),
611 valid(false),
612 busConnected(false),
613 needsSurroundingText(false)
614{
615 if (usePortal) {
616 valid = true;
617 if (debug)
618 qDebug() << "use IBus portal";
619 } else {
621 }
622 if (!valid)
623 return;
624 initBus();
625
626 if (bus && bus->isValid()) {
627 QIBusEngineDesc desc = bus->getGlobalEngine();
628 locale = QLocale(desc.language);
629 }
630}
631
633{
635 busConnected = false;
637}
638
640{
641 QDBusConnection connection("QIBusProxy"_L1);
642 if (!connection.isConnected())
643 return;
644
645 const char* ibusService = usePortal ? "org.freedesktop.portal.IBus" : "org.freedesktop.IBus";
647 if (usePortal) {
648 portalBus = std::make_unique<QIBusProxyPortal>(QLatin1StringView(ibusService),
649 "/org/freedesktop/IBus"_L1,
650 connection);
651 if (!portalBus->isValid()) {
652 qWarning("QIBusPlatformInputContext: invalid portal bus.");
653 return;
654 }
655
656 ic = portalBus->CreateInputContext("QIBusInputContext"_L1);
657 } else {
658 bus = std::make_unique<QIBusProxy>(QLatin1StringView(ibusService),
659 "/org/freedesktop/IBus"_L1,
660 connection);
661 if (!bus->isValid()) {
662 qWarning("QIBusPlatformInputContext: invalid bus.");
663 return;
664 }
665
666 ic = bus->CreateInputContext("QIBusInputContext"_L1);
667 }
668
672
673 if (!ic.isValid()) {
674 qWarning("QIBusPlatformInputContext: CreateInputContext failed.");
675 return;
676 }
677
678 context = std::make_unique<QIBusInputContextProxy>(QLatin1StringView(ibusService), ic.value().path(), connection);
679
680 if (!context->isValid()) {
681 qWarning("QIBusPlatformInputContext: invalid input context.");
682 return;
683 }
684
685 enum Capabilities {
686 IBUS_CAP_PREEDIT_TEXT = 1 << 0,
687 IBUS_CAP_AUXILIARY_TEXT = 1 << 1,
688 IBUS_CAP_LOOKUP_TABLE = 1 << 2,
689 IBUS_CAP_FOCUS = 1 << 3,
690 IBUS_CAP_PROPERTY = 1 << 4,
691 IBUS_CAP_SURROUNDING_TEXT = 1 << 5
692 };
693 context->SetCapabilities(IBUS_CAP_PREEDIT_TEXT|IBUS_CAP_FOCUS|IBUS_CAP_SURROUNDING_TEXT);
694
695 if (debug)
696 qDebug(">>>> bus connected!");
697 busConnected = true;
698}
699
701{
703 QByteArray displayNumber = "0";
704 bool isWayland = false;
705
706 if (qEnvironmentVariableIsSet("IBUS_ADDRESS_FILE")) {
707 QByteArray path = qgetenv("IBUS_ADDRESS_FILE");
709 } else if (qEnvironmentVariableIsSet("WAYLAND_DISPLAY")) {
710 display = qgetenv("WAYLAND_DISPLAY");
711 isWayland = true;
712 } else {
713 display = qgetenv("DISPLAY");
714 }
715 QByteArray host = "unix";
716
717 if (isWayland) {
718 displayNumber = display;
719 } else {
720 int pos = display.indexOf(':');
721 if (pos > 0)
722 host = display.left(pos);
723 ++pos;
724 int pos2 = display.indexOf('.', pos);
725 if (pos2 > 0)
726 displayNumber = display.mid(pos, pos2 - pos);
727 else
728 displayNumber = display.mid(pos);
729 }
730
731 if (debug)
732 qDebug() << "host=" << host << "displayNumber" << displayNumber;
733
735 "/ibus/bus/"_L1 +
737 u'-' + QString::fromLocal8Bit(host) + u'-' + QString::fromLocal8Bit(displayNumber);
738}
739
741{
742 if (usePortal) {
744 return;
745 }
746
749 return;
750
752 int pid = -1;
753
754 while (!file.atEnd()) {
755 QByteArray line = file.readLine().trimmed();
756 if (line.startsWith('#'))
757 continue;
758
759 if (line.startsWith("IBUS_ADDRESS="))
760 address = line.mid(sizeof("IBUS_ADDRESS=") - 1);
761 if (line.startsWith("IBUS_DAEMON_PID="))
762 pid = line.mid(sizeof("IBUS_DAEMON_PID=") - 1).toInt();
763 }
764
765 if (debug)
766 qDebug() << "IBUS_ADDRESS=" << address << "PID=" << pid;
767 if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0)
768 return;
769
771}
772
774
775#include "moc_qibusplatforminputcontext.cpp"
\inmodule QtCore
Definition qbytearray.h:57
QByteArray left(qsizetype len) const
Returns a byte array that contains the first len bytes of this byte array.
QByteArray mid(qsizetype index, qsizetype len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
\inmodule QtDBus
\inmodule QtDBus
static QByteArray localMachineId()
static QDBusConnection connectToBus(BusType type, const QString &name)
Opens a connection of type type to one of the known buses and associate with it the connection name n...
static void disconnectFromBus(const QString &name)
Closes the bus connection of name name.
void finished(QDBusPendingCallWatcher *self=nullptr)
This signal is emitted when the pending call has finished and its reply is available.
\inmodule QtDBus
\inmodule QtDBus
Definition qdbusreply.h:24
Type value() const
Returns the remote function's calls return value.
Definition qdbusreply.h:78
bool isValid() const
Returns true if no error occurred; otherwise, returns false.
Definition qdbusreply.h:73
The QDBusServiceWatcher class allows the user to watch for a bus service change.
bool removeWatchedService(const QString &service)
Removes the service from the list of services being watched by this object.
void setConnection(const QDBusConnection &connection)
Sets the D-Bus connection that this object is attached to be connection.
void addWatchedService(const QString &newService)
Adds newService to the list of services to be watched by this object.
\inmodule QtDBus
\inmodule QtCore
Definition qcoreevent.h:45
Type
This enum type defines the valid event types in Qt.
Definition qcoreevent.h:51
@ KeyRelease
Definition qcoreevent.h:65
@ KeyPress
Definition qcoreevent.h:64
Type type() const
Returns the event type.
Definition qcoreevent.h:299
bool atEnd() const override
Returns true if the end of the file has been reached; otherwise returns false.
bool exists() const
Returns true if the file exists; otherwise returns false.
\inmodule QtCore
Definition qfile.h:93
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition qfile.cpp:881
static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
static QObject * focusObject()
Returns the QObject in currently active window that will be final receiver of events tied to focus,...
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
QString platformName
The name of the underlying platform plugin.
QList< QInputMethodEvent::Attribute > attributes
std::unique_ptr< QIBusInputContextProxy > context
std::unique_ptr< QIBusProxyPortal > portalBus
void invokeAction(QInputMethod::Action a, int x) override
Called when the word currently being composed in the input item is tapped by the user.
void commitText(const QDBusVariant &text)
void busUnregistered(const QString &str)
bool filterEvent(const QEvent *event) override
This function can be reimplemented to filter input events.
void globalEngineChanged(const QString &engine_name)
void filterEventFinished(QDBusPendingCallWatcher *call)
void update(Qt::InputMethodQueries) override
Notification on editor updates.
bool hasCapability(Capability capability) const override
Returns whether the implementation supports capability.
void socketChanged(const QString &str)
bool isValid() const override
Returns input context validity.
void forwardKeyEvent(uint keyval, uint keycode, uint state)
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
void updatePreeditText(const QDBusVariant &text, uint cursor_pos, bool visible)
void reset() override
Method to be called when input method needs to be reset.
void busRegistered(const QString &str)
void deleteSurroundingText(int offset, uint n_chars)
qint64 readLine(char *data, qint64 maxlen)
This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes,...
quint64 timestamp() const
Returns the window system's timestamp for this event.
Definition qevent.h:58
The QInputMethodEvent class provides parameters for input method events.
Definition qevent.h:624
The QInputMethodQueryEvent class provides an event sent by the input context to input objects.
Definition qevent.h:678
The QInputMethod class provides access to the active text input method.
Action
Indicates the kind of action performed by the user.
The QKeyEvent class describes a key event.
Definition qevent.h:423
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
Definition qevent.cpp:1465
quint32 nativeScanCode() const
Definition qevent.h:446
QString text() const
Returns the Unicode text that this key generated.
Definition qevent.h:442
quint32 nativeVirtualKey() const
Definition qevent.h:447
bool isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it comes from an initia...
Definition qevent.h:443
quint32 nativeModifiers() const
Definition qevent.h:448
int key() const
Returns the code of the key that was pressed or released.
Definition qevent.h:433
Definition qlist.h:74
const_reference at(qsizetype i) const noexcept
Definition qlist.h:429
void clear()
Definition qlist.h:417
bool isFinished() const
\inmodule QtCore
Definition qobject.h:90
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
void deleteLater()
\threadsafe
Definition qobject.cpp:2352
bool inputMethodAccepted() const
Returns true if current focus object supports input method events.
virtual QLocale locale() const
\inmodule QtCore\reentrant
Definition qpoint.h:23
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:238
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:184
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:235
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:187
QRect geometry
the screen's geometry in pixels
Definition qscreen.h:45
static QString writableLocation(StandardLocation type)
static QString findExecutable(const QString &executableName, const QStringList &paths=QStringList())
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
int toInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition qstring.h:660
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition qstring.cpp:5299
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5710
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5788
uint toUInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an {unsigned int} using base base, which is 10 by default and must be...
Definition qstring.h:662
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
Definition qstring.cpp:5204
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
void setSingleShot(bool singleShot)
Definition qtimer.cpp:580
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
Definition qtimer.cpp:208
void stop()
Stops the timer.
Definition qtimer.cpp:226
\inmodule QtCore
Definition qvariant.h:64
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:531
void setValue(T &&avalue)
Stores a copy of value.
Definition qvariant.h:488
\inmodule QtGui
Definition qwindow.h:63
static QString lookupStringNoKeysymTransformations(xkb_keysym_t keysym)
static int keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers modifiers)
EGLImageKHR int int EGLuint64KHR * modifiers
QString str
[2]
QString text
else opt state
[0]
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
@ ImSurroundingText
@ ImCursorPosition
@ ImAnchorPosition
@ Key_AltGr
Definition qnamespace.h:734
@ Key_Shift
Definition qnamespace.h:678
@ Key_Control
Definition qnamespace.h:679
@ Key_Alt
Definition qnamespace.h:681
@ Key_Meta
Definition qnamespace.h:680
@ Key_Menu
Definition qnamespace.h:722
@ ShiftModifier
@ ControlModifier
@ MetaModifier
@ GroupSwitchModifier
@ NoModifier
@ AltModifier
#define qApp
DBusConnection * connection
#define IBUS_MOD1_MASK
#define IBUS_SHIFT_MASK
#define IBUS_META_MASK
static bool shouldConnectIbusPortal()
static bool checkNeedPortalSupport()
#define IBUS_CONTROL_MASK
#define IBUS_RELEASE_MASK
#define qDebug
[1]
Definition qlogging.h:160
#define qWarning
Definition qlogging.h:162
#define qCDebug(category,...)
#define SLOT(a)
Definition qobjectdefs.h:51
#define SIGNAL(a)
Definition qobjectdefs.h:52
GLboolean GLboolean GLboolean GLboolean a
[7]
GLboolean r
[2]
GLuint object
[3]
GLbitfield GLuint64 timeout
[4]
GLenum type
GLenum GLuint GLintptr offset
struct _cl_event * event
GLenum query
GLdouble GLdouble t
Definition qopenglext.h:243
GLuint GLuint64EXT address
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLsizei const GLchar *const * path
GLfloat GLfloat p
[1]
GLenum GLenum GLenum GLenum GLenum scale
GLenum GLenum GLenum input
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
SSL_CTX int(*) void arg)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
#define Q_UNUSED(x)
@ desc
unsigned int quint32
Definition qtypes.h:45
unsigned long ulong
Definition qtypes.h:30
unsigned int uint
Definition qtypes.h:29
double qreal
Definition qtypes.h:92
QFutureWatcher< int > watcher
QFile file
[0]
QVariant variant
[1]
aWidget window() -> setWindowTitle("New Window Title")
[2]
QNetworkReply * reply
QJSValueList args