Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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:
54 // This enum might be synced with IBusPreeditFocusMode
55 // in ibustypes.h of IBUS project
60
63 {
64 // dereference QDBusConnection to actually disconnect
66 context = nullptr;
67 portalBus = nullptr;
68 bus = nullptr;
70 }
71
72 static QString getSocketPath();
73
74 void createConnection();
75 void initBus();
76 void createBusProxy();
77
78 std::unique_ptr<QIBusProxy> bus;
79 std::unique_ptr<QIBusProxyPortal> portalBus; // bus and portalBus are alternative.
80 std::unique_ptr<QIBusInputContextProxy> context;
82
83 bool usePortal; // return value of shouldConnectIbusPortal
84 bool valid;
87 QList<QInputMethodEvent::Attribute> attributes;
90 PreeditFocusMode preeditFocusMode = PREEDIT_COMMIT; // for backward compatibility
91};
92
93
96{
97 if (!d->usePortal) {
99 QFile file(socketPath);
101#if QT_CONFIG(filesystemwatcher)
102 qCDebug(qtQpaInputMethods) << "socketWatcher.addPath" << socketPath;
103 // If KDE session save is used or restart ibus-daemon,
104 // the applications could run before ibus-daemon runs.
105 // We watch the getSocketPath() to get the launching ibus-daemon.
106 m_socketWatcher.addPath(socketPath);
107 connect(&m_socketWatcher, SIGNAL(fileChanged(QString)), this, SLOT(socketChanged(QString)));
108#endif
109 }
110 m_timer.setSingleShot(true);
111 connect(&m_timer, SIGNAL(timeout()), this, SLOT(connectToBus()));
112 }
113
114 QObject::connect(&d->serviceWatcher, SIGNAL(serviceRegistered(QString)), this, SLOT(busRegistered(QString)));
115 QObject::connect(&d->serviceWatcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(busUnregistered(QString)));
116
117 connectToContextSignals();
118
119 QInputMethod *p = qApp->inputMethod();
120 connect(p, SIGNAL(cursorRectangleChanged()), this, SLOT(cursorRectChanged()));
121 m_eventFilterUseSynchronousMode = false;
122 if (qEnvironmentVariableIsSet("IBUS_ENABLE_SYNC_MODE")) {
123 bool ok;
124 int enableSync = qEnvironmentVariableIntValue("IBUS_ENABLE_SYNC_MODE", &ok);
125 if (ok && enableSync == 1)
126 m_eventFilterUseSynchronousMode = true;
127 }
128}
129
134
136{
137 return d->valid && d->busConnected;
138}
139
141{
142 switch (capability) {
144 return false; // QTBUG-40691, do not show IME on desktop for password entry fields.
145 default:
146 break;
147 }
148 return true;
149}
150
152{
153 if (!d->busConnected)
154 return;
155
156 if (a == QInputMethod::Click)
157 commit();
158}
159
161{
162 if (!d->busConnected)
163 return;
164
165 d->context->Reset();
166 d->predit = QString();
167 d->attributes.clear();
168}
169
171{
172 if (!d->busConnected)
173 return;
174
175 QObject *input = qApp->focusObject();
176 if (!input) {
177 d->predit = QString();
178 d->attributes.clear();
179 return;
180 }
181
183 if (!d->predit.isEmpty()) {
185 event.setCommitString(d->predit);
187 }
188 } else {
189 if (!d->predit.isEmpty()) {
190 // Clear the existing preedit
193 }
194 }
195
196 d->context->Reset();
197 d->predit = QString();
198 d->attributes.clear();
199}
200
201
202void QIBusPlatformInputContext::update(Qt::InputMethodQueries q)
203{
204 QObject *input = qApp->focusObject();
205
207 && (q.testFlag(Qt::ImSurroundingText)
208 || q.testFlag(Qt::ImCursorPosition)
209 || q.testFlag(Qt::ImAnchorPosition))) {
210
212
214
215 QString surroundingText = query.value(Qt::ImSurroundingText).toString();
216 uint cursorPosition = query.value(Qt::ImCursorPosition).toUInt();
217 uint anchorPosition = query.value(Qt::ImAnchorPosition).toUInt();
218
220 text.text = surroundingText;
221
224 QDBusVariant dbusText(variant);
225
226 d->context->SetSurroundingText(dbusText, cursorPosition, anchorPosition);
227 }
228}
229
231{
232 if (!d->busConnected)
233 return;
234
235 QRect r = qApp->inputMethod()->cursorRectangle().toRect();
236 if (!r.isValid())
237 return;
238
239 QWindow *inputWindow = qApp->focusWindow();
240 if (!inputWindow)
241 return;
242 if (!inputWindow->screen())
243 return;
244
245 if (QGuiApplication::platformName().startsWith("wayland"_L1)) {
246 auto margins = inputWindow->frameMargins();
247 r.translate(margins.left(), margins.top());
248 qreal scale = inputWindow->devicePixelRatio();
249 QRect newRect = QRect(r.x() * scale, r.y() * scale, r.width() * scale, r.height() * scale);
250 if (debug)
251 qDebug() << "microFocus" << newRect;
252 d->context->SetCursorLocationRelative(newRect.x(), newRect.y(),
253 newRect.width(), newRect.height());
254 return;
255 }
256
257 // x11/xcb
258 auto screenGeometry = inputWindow->screen()->geometry();
259 auto point = inputWindow->mapToGlobal(r.topLeft());
260 qreal scale = inputWindow->devicePixelRatio();
261 auto native = (point - screenGeometry.topLeft()) * scale + screenGeometry.topLeft();
262 QRect newRect(native, r.size() * scale);
263 if (debug)
264 qDebug() << "microFocus" << newRect;
265 d->context->SetCursorLocation(newRect.x(), newRect.y(),
266 newRect.width(), newRect.height());
267}
268
270{
271 if (!d->busConnected)
272 return;
273
274 // It would seem natural here to call FocusOut() on the input method if we
275 // transition from an IME accepted focus object to one that does not accept it.
276 // Mysteriously however that is not sufficient to fix bug QTBUG-63066.
277 if (object && !inputMethodAccepted())
278 return;
279
280 if (debug)
281 qDebug() << "setFocusObject" << object;
282 if (object)
283 d->context->FocusIn();
284 else
285 d->context->FocusOut();
286}
287
289{
290 QObject *input = qApp->focusObject();
291 if (!input)
292 return;
293
294 const QDBusArgument arg = qvariant_cast<QDBusArgument>(text.variant());
295
296 QIBusText t;
297 if (debug)
298 qDebug() << arg.currentSignature();
299 arg >> t;
300 if (debug)
301 qDebug() << "commit text:" << t.text;
302
304 event.setCommitString(t.text);
306
307 d->predit = QString();
308 d->attributes.clear();
309}
310
312{
313 if (!qApp)
314 return;
315
316 QObject *input = qApp->focusObject();
317 if (!input)
318 return;
319
320 const QDBusArgument arg = qvariant_cast<QDBusArgument>(text.variant());
321
322 QIBusText t;
323 arg >> t;
324 if (debug)
325 qDebug() << "preedit text:" << t.text;
326
327 d->attributes = t.attributes.imAttributes();
328 if (!t.text.isEmpty())
330
333
334 d->predit = t.text;
335}
336
345
347{
348 if (!qApp)
349 return;
350
351 QObject *input = qApp->focusObject();
352 if (!input)
353 return;
354
358
359 state &= ~IBUS_RELEASE_MASK;
360 keycode += 8;
361
362 Qt::KeyboardModifiers modifiers = Qt::NoModifier;
367 if (state & IBUS_MOD1_MASK)
369 if (state & IBUS_META_MASK)
371
372 int qtcode = QXkbCommon::keysymToQtKey(keyval, modifiers);
374
375 if (debug)
376 qDebug() << "forwardKeyEvent" << keyval << keycode << state << modifiers << qtcode << text;
377
378 QKeyEvent event(type, qtcode, modifiers, keycode, keyval, state, text);
380}
381
383{
384 if (debug)
385 qDebug("surroundingTextRequired");
386 d->needsSurroundingText = true;
388}
389
391{
392 QObject *input = qApp->focusObject();
393 if (!input)
394 return;
395
396 if (debug)
397 qDebug() << "deleteSurroundingText" << offset << n_chars;
398
400 event.setCommitString("", offset, n_chars);
402}
403
405{
407 if (!input)
408 return;
409
410 QList<QInputMethodEvent::Attribute> attributes;
411 QInputMethodEvent event(QString(), attributes);
413}
414
424
426{
427 if (!d->busConnected)
428 return false;
429
430 if (!inputMethodAccepted())
431 return false;
432
433 const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
434 quint32 sym = keyEvent->nativeVirtualKey();
435 quint32 code = keyEvent->nativeScanCode();
436 quint32 state = keyEvent->nativeModifiers();
437 quint32 ibusState = state;
438
439 if (keyEvent->type() != QEvent::KeyPress)
440 ibusState |= IBUS_RELEASE_MASK;
441
442 QDBusPendingReply<bool> reply = d->context->ProcessKeyEvent(sym, code - 8, ibusState);
443
444 if (m_eventFilterUseSynchronousMode || reply.isFinished()) {
445 bool filtered = reply.value();
446 qCDebug(qtQpaInputMethods) << "filterEvent return" << code << sym << state << filtered;
447 return filtered;
448 }
449
450 Qt::KeyboardModifiers modifiers = keyEvent->modifiers();
451 const int qtcode = keyEvent->key();
452
453 // From QKeyEvent::modifiers()
454 switch (qtcode) {
455 case Qt::Key_Shift:
457 break;
458 case Qt::Key_Control:
460 break;
461 case Qt::Key_Alt:
463 break;
464 case Qt::Key_Meta:
466 break;
467 case Qt::Key_AltGr:
469 break;
470 }
471
473 args << QVariant::fromValue(keyEvent->timestamp());
474 args << QVariant::fromValue(static_cast<uint>(keyEvent->type()));
475 args << QVariant::fromValue(qtcode);
477 args << QVariant::fromValue(keyEvent->text());
478 args << QVariant::fromValue(keyEvent->isAutoRepeat());
479
482
483 return true;
484}
485
487{
489 QDBusPendingReply<bool> reply = *call;
490
491 if (reply.isError()) {
492 call->deleteLater();
493 return;
494 }
495
496 // Use watcher's window instead of the current focused window
497 // since there is a time lag until filterEventFinished() returns.
498 QWindow *window = watcher->window();
499
500 if (!window) {
501 call->deleteLater();
502 return;
503 }
504
505 Qt::KeyboardModifiers modifiers = watcher->modifiers();
506 QVariantList args = watcher->arguments();
507 const ulong time = static_cast<ulong>(args.at(0).toUInt());
508 const QEvent::Type type = static_cast<QEvent::Type>(args.at(1).toUInt());
509 const int qtcode = args.at(2).toInt();
510 const quint32 code = args.at(3).toUInt();
511 const quint32 sym = args.at(4).toUInt();
512 const quint32 state = args.at(5).toUInt();
513 const QString string = args.at(6).toString();
514 const bool isAutoRepeat = args.at(7).toBool();
515
516 // copied from QXcbKeyboard::handleKeyEvent()
517 bool filtered = reply.value();
518 qCDebug(qtQpaInputMethods) << "filterEventFinished return" << code << sym << state << filtered;
519 if (!filtered) {
520#ifndef QT_NO_CONTEXTMENU
521 if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu
522 && window != nullptr) {
523 const QPoint globalPos = window->screen()->handle()->cursor()->pos();
524 const QPoint pos = window->mapFromGlobal(globalPos);
526 globalPos, modifiers);
528 }
529#endif
531 code, sym, state, string, isAutoRepeat);
533 }
534 call->deleteLater();
535}
536
538{
539 // d->locale is not updated when IBus portal is used
540 if (d->usePortal)
542 return d->locale;
543}
544
546{
547 qCDebug(qtQpaInputMethods) << "socketChanged";
548 Q_UNUSED (str);
549
550 m_timer.stop();
551
552 // dereference QDBusConnection to actually disconnect
554 d->context = nullptr;
555 d->bus = nullptr;
556 d->busConnected = false;
557 QDBusConnection::disconnectFromBus("QIBusProxy"_L1);
558
559 m_timer.start(100);
560}
561
563{
564 qCDebug(qtQpaInputMethods) << "busRegistered";
565 Q_UNUSED (str);
566 if (d->usePortal) {
567 connectToBus();
568 }
569}
570
572{
573 qCDebug(qtQpaInputMethods) << "busUnregistered";
574 Q_UNUSED (str);
575 d->busConnected = false;
576}
577
578// When getSocketPath() is modified, the bus is not established yet
579// so use m_timer.
581{
582 qCDebug(qtQpaInputMethods) << "QIBusPlatformInputContext::connectToBus";
583 d->initBus();
584 connectToContextSignals();
585
586#if QT_CONFIG(filesystemwatcher)
587 if (!d->usePortal && m_socketWatcher.files().size() == 0)
588 m_socketWatcher.addPath(QIBusPlatformInputContextPrivate::getSocketPath());
589#endif
590}
591
593{
594 if (!d->bus || !d->bus->isValid())
595 return;
596
597 QIBusEngineDesc desc = d->bus->getGlobalEngine();
598 Q_ASSERT(engine_name == desc.engine_name);
599 QLocale locale(desc.language);
600 if (d->locale != locale) {
601 d->locale = locale;
603 }
604}
605
606void QIBusPlatformInputContext::connectToContextSignals()
607{
608 if (d->bus && d->bus->isValid()) {
609 connect(d->bus.get(), SIGNAL(GlobalEngineChanged(QString)), this, SLOT(globalEngineChanged(QString)));
610 }
611
612 if (d->context) {
613 connect(d->context.get(), SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant)));
614 connect(d->context.get(), SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool)));
615 connect(d->context.get(), SIGNAL(UpdatePreeditTextWithMode(QDBusVariant,uint,bool,uint)), this, SLOT(updatePreeditTextWithMode(QDBusVariant,uint,bool,uint)));
616 connect(d->context.get(), SIGNAL(ForwardKeyEvent(uint,uint,uint)), this, SLOT(forwardKeyEvent(uint,uint,uint)));
617 connect(d->context.get(), SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint)));
618 connect(d->context.get(), SIGNAL(RequireSurroundingText()), this, SLOT(surroundingTextRequired()));
619 connect(d->context.get(), SIGNAL(HidePreeditText()), this, SLOT(hidePreeditText()));
620 connect(d->context.get(), SIGNAL(ShowPreeditText()), this, SLOT(showPreeditText()));
621 }
622}
623
624static inline bool checkNeedPortalSupport()
625{
626 return QFileInfo::exists("/.flatpak-info"_L1) || qEnvironmentVariableIsSet("SNAP");
627}
628
630{
631 // honor the same env as ibus-gtk
632 return (checkNeedPortalSupport() || qEnvironmentVariableIsSet("IBUS_USE_PORTAL"));
633}
634
636 : usePortal(shouldConnectIbusPortal()),
637 valid(false),
638 busConnected(false),
639 needsSurroundingText(false)
640{
641 if (usePortal) {
642 valid = true;
643 if (debug)
644 qDebug() << "use IBus portal";
645 } else {
647 }
648 if (!valid)
649 return;
650 initBus();
651
652 if (bus && bus->isValid()) {
653 QIBusEngineDesc desc = bus->getGlobalEngine();
654 locale = QLocale(desc.language);
655 }
656}
657
664
666{
667 QDBusConnection connection("QIBusProxy"_L1);
668 if (!connection.isConnected())
669 return;
670
671 const char* ibusService = usePortal ? "org.freedesktop.portal.IBus" : "org.freedesktop.IBus";
672 QDBusReply<QDBusObjectPath> ic;
673 if (usePortal) {
674 portalBus = std::make_unique<QIBusProxyPortal>(QLatin1StringView(ibusService),
675 "/org/freedesktop/IBus"_L1,
676 connection);
677 if (!portalBus->isValid()) {
678 qWarning("QIBusPlatformInputContext: invalid portal bus.");
679 return;
680 }
681
682 ic = portalBus->CreateInputContext("QIBusInputContext"_L1);
683 } else {
684 bus = std::make_unique<QIBusProxy>(QLatin1StringView(ibusService),
685 "/org/freedesktop/IBus"_L1,
686 connection);
687 if (!bus->isValid()) {
688 qWarning("QIBusPlatformInputContext: invalid bus.");
689 return;
690 }
691
692 ic = bus->CreateInputContext("QIBusInputContext"_L1);
693 }
694
698
699 if (!ic.isValid()) {
700 qWarning("QIBusPlatformInputContext: CreateInputContext failed.");
701 return;
702 }
703
704 context = std::make_unique<QIBusInputContextProxy>(QLatin1StringView(ibusService), ic.value().path(), connection);
705
706 if (!context->isValid()) {
707 qWarning("QIBusPlatformInputContext: invalid input context.");
708 return;
709 }
710
711 enum Capabilities {
712 IBUS_CAP_PREEDIT_TEXT = 1 << 0,
713 IBUS_CAP_AUXILIARY_TEXT = 1 << 1,
714 IBUS_CAP_LOOKUP_TABLE = 1 << 2,
715 IBUS_CAP_FOCUS = 1 << 3,
716 IBUS_CAP_PROPERTY = 1 << 4,
717 IBUS_CAP_SURROUNDING_TEXT = 1 << 5
718 };
719 context->SetCapabilities(IBUS_CAP_PREEDIT_TEXT|IBUS_CAP_FOCUS|IBUS_CAP_SURROUNDING_TEXT);
720
721 context->setClientCommitPreedit(QIBusPropTypeClientCommitPreedit(true));
722
723 if (debug)
724 qDebug(">>>> bus connected!");
725 busConnected = true;
726}
727
729{
731 QByteArray displayNumber = "0";
732 bool isWayland = false;
733
734 if (qEnvironmentVariableIsSet("IBUS_ADDRESS_FILE")) {
735 QByteArray path = qgetenv("IBUS_ADDRESS_FILE");
737 } else if (qEnvironmentVariableIsSet("WAYLAND_DISPLAY")) {
738 display = qgetenv("WAYLAND_DISPLAY");
739 isWayland = true;
740 } else {
741 display = qgetenv("DISPLAY");
742 }
743 QByteArray host = "unix";
744
745 if (isWayland) {
746 displayNumber = display;
747 } else {
748 int pos = display.indexOf(':');
749 if (pos > 0)
750 host = display.left(pos);
751 ++pos;
752 int pos2 = display.indexOf('.', pos);
753 if (pos2 > 0)
754 displayNumber = display.mid(pos, pos2 - pos);
755 else
756 displayNumber = display.mid(pos);
757 }
758
759 if (debug)
760 qDebug() << "host=" << host << "displayNumber" << displayNumber;
761
763 "/ibus/bus/"_L1 +
765 u'-' + QString::fromLocal8Bit(host) + u'-' + QString::fromLocal8Bit(displayNumber);
766}
767
769{
770 if (usePortal) {
772 return;
773 }
774
777 return;
778
780 int pid = -1;
781
782 while (!file.atEnd()) {
783 QByteArray line = file.readLine().trimmed();
784 if (line.startsWith('#'))
785 continue;
786
787 if (line.startsWith("IBUS_ADDRESS="))
788 address = line.mid(sizeof("IBUS_ADDRESS=") - 1);
789 if (line.startsWith("IBUS_DAEMON_PID="))
790 pid = line.mid(sizeof("IBUS_DAEMON_PID=") - 1).toInt();
791 }
792
793 if (debug)
794 qDebug() << "IBUS_ADDRESS=" << address << "PID=" << pid;
795 if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0)
796 return;
797
799}
800
802
803#include "moc_qibusplatforminputcontext.cpp"
\inmodule QtCore
Definition qbytearray.h:57
QByteArray left(qsizetype n) const &
Definition qbytearray.h:169
qsizetype indexOf(char c, qsizetype from=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
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.
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:304
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 system entry this QFileInfo refers to exists; otherwise returns false.
\inmodule QtCore
Definition qfile.h:93
QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition qfile.cpp:904
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 updatePreeditTextWithMode(const QDBusVariant &text, uint cursor_pos, bool visible, uint mode)
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:625
The QInputMethodQueryEvent class provides an event sent by the input context to input objects.
Definition qevent.h:679
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:424
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
Definition qevent.cpp:1468
quint32 nativeScanCode() const
Definition qevent.h:447
QString text() const
Returns the Unicode text that this key generated.
Definition qevent.h:443
quint32 nativeVirtualKey() const
Definition qevent.h:448
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:444
quint32 nativeModifiers() const
Definition qevent.h:449
int key() const
Returns the code of the key that was pressed or released.
Definition qevent.h:434
const_reference at(qsizetype i) const noexcept
Definition qlist.h:446
void clear()
Definition qlist.h:434
bool isFinished() const
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
void deleteLater()
\threadsafe
Definition qobject.cpp:2435
bool inputMethodAccepted() const
Returns true if current focus object supports input method events.
virtual QLocale locale() const
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
static QString writableLocation(StandardLocation type)
static QString findExecutable(const QString &executableName, const QStringList &paths=QStringList())
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
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:731
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:5455
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5871
QString mid(qsizetype position, qsizetype n=-1) const &
Definition qstring.cpp:5300
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5949
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
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:733
void setSingleShot(bool singleShot)
Definition qtimer.cpp:552
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
Definition qtimer.cpp:241
void stop()
Stops the timer.
Definition qtimer.cpp:267
\inmodule QtCore
Definition qvariant.h:65
void setValue(T &&avalue)
Definition qvariant.h:493
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:536
\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:739
@ Key_Shift
Definition qnamespace.h:683
@ Key_Control
Definition qnamespace.h:684
@ Key_Alt
Definition qnamespace.h:686
@ Key_Meta
Definition qnamespace.h:685
@ Key_Menu
Definition qnamespace.h:727
@ ShiftModifier
@ ControlModifier
@ MetaModifier
@ GroupSwitchModifier
@ NoModifier
@ AltModifier
QList< QString > QStringList
Constructs a string list that contains the given string, str.
#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:164
#define qWarning
Definition qlogging.h:166
#define qCDebug(category,...)
#define SLOT(a)
Definition qobjectdefs.h:52
#define SIGNAL(a)
Definition qobjectdefs.h:53
GLenum mode
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)
unsigned int quint32
Definition qtypes.h:50
unsigned long ulong
Definition qtypes.h:35
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187
int keycode
Definition qvnc.cpp:140
QFutureWatcher< int > watcher
QFile file
[0]
QVariant variant
[1]
aWidget window() -> setWindowTitle("New Window Title")
[2]
QNetworkReply * reply
QJSValueList args