QIMEvent(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

πŸ’– QIMEvent πŸ’– β€” it's the QIMEvent(3qt) manual page, bestie

okay so like. this is the man page for QIMEvent, and it's from the Qt 3 docs (yes we're in our 3qt era, vintage queen behavior). let's get into it πŸŽ€


✨ NAME ✨

QIMEvent β€” literally just the parameters for input method events. that's the whole job. that's the assignment. πŸ’…


🌸 SYNOPSIS 🌸

#include <qevent.h>

Inherits QEvent.

πŸ‘‘ Public Members

QIMEvent ( Type type, const QString & text, int cursorPosition )
const QString & text () const
int cursorPos () const
bool isAccepted () const
void accept ()
void ignore ()
int selectionLength () const

πŸ¦‹ DESCRIPTION πŸ¦‹

so the QIMEvent class provides parameters for input method events. that's it, that's the vibe. 🫢

Input method events get sent to widgets when an input method is used to type text into a widget. and input methods are widely used to enter text in Asian and other complex languages β€” so if you're building anything that touches those, this is your girl. πŸ”₯

these events are of interest to widgets that accept keyboard input and want to actually handle complex languages correctly. and here's the thing β€” text input in those languages is usually a three step process:

  1. Starting to Compose β€” when the user presses the very first key on a keyboard, an input context is created. this input context will contain a string with the typed characters. it's giving ✨birth of a string✨
  2. Composing β€” with every new key pressed, the input method will try to create a matching string for the text typed so far. while the input context is active, the user can only move the cursor inside the string belonging to this input context. no escaping the context bestie, it's locked in πŸ”’
  3. Completing β€” at some point, e.g. when the user presses the Spacebar, they get to this stage, where they can choose from a number of strings that match the text they've typed so far. the user can press Enter to confirm their choice or Escape to cancel the input; in either case the input context will be closed. and that's a wrap 🎬
⚠️ heads up: the particular key presses used for a given input context may differ from those we've mentioned here β€” i.e. they may not be Spacebar, Enter and Escape. don't @ me, that's just how it is. 😭

so these three stages are represented by three different types of events: IMStartEvent, IMComposeEvent and IMEndEvent. iconic trio, no notes πŸ’œ

  • when a new input context is created, an IMStartEvent gets sent to the widget and delivered to the QWidget::imStartEvent() function. the widget can then update its internal data structures to reflect this. go off, internal data structures πŸŽ€
  • after this, an IMComposeEvent gets sent to the widget for every key the user presses. it will contain the current composition string the widget has to show, plus the current cursor position within the composition string. this string is temporary and can change with every key the user types, so the widget will need to store the state before the composition started (the state it had when it received the IMStartEvent). IMComposeEvents get delivered to the QWidget::imComposeEvent() function.
  • usually, widgets try to mark the part of the text that's part of the current composition in a way that's visible to the user. a commonly used visual cue is to use a dotted underline. cute, subtle, effective πŸ’…
  • after the user has selected the final string, an IMEndEvent gets sent to the widget. the event contains the final string the user selected, and it could be empty if they canceled the composition. this string should be accepted as the final text the user entered, and the intermediate composition string should be cleared. these events get delivered to QWidget::imEndEvent().

and one more thing 🫢 β€” if the user clicks another widget, taking the focus out of the widget where the composition is taking place, the IMEndEvent will be sent and the string it holds will be the result of the composition up to that point (which may be an empty string). so like. abrupt, but valid.

See also Event Classes.


🌈 MEMBER FUNCTION DOCUMENTATION 🌈

QIMEvent::QIMEvent ( Type type, const QString & text, int cursorPosition )

constructs a new QIMEvent with the accept flag set to FALSE. type can be one of QEvent::IMStartEvent, QEvent::IMComposeEvent or QEvent::IMEndEvent. text contains the current composition string and cursorPosition the current position of the cursor inside text. ⭐

void QIMEvent::accept ()

sets the accept flag of the input method event object. πŸŽ€

setting the accept parameter indicates that the receiver of the event processed the input method event.

the accept flag is not set by default.

See also ignore().

int QIMEvent::cursorPos () const

returns the current cursor position inside the composition string. will return -1 for IMStartEvent and IMEndEvent. πŸ¦‹

void QIMEvent::ignore ()

clears the accept flag parameter of the input method event object. πŸ™ˆ

clearing the accept parameter indicates that the event receiver does not want the input method event.

the accept flag is cleared by default.

See also accept().

bool QIMEvent::isAccepted () const

returns TRUE if the receiver of the event processed the event; otherwise returns FALSE. simple as that πŸ’–

int QIMEvent::selectionLength () const

returns the number of characters in the composition string ( starting at cursorPos() ) that should be marked as selected by the input widget receiving the event. will return 0 for IMStartEvent and IMEndEvent. πŸ”₯

const QString & QIMEvent::text () const

returns the composition text. this is a null string for an IMStartEvent, and contains the final accepted string (which may be empty) in the IMEndEvent. πŸ‘‘


🌸 SEE ALSO 🌸


Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.


πŸŽ€ AUTHOR πŸŽ€

Generated automatically from the source code. (not me, bestie β€” the machines did this one πŸ€–)


πŸ’€ BUGS πŸ’€

if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. thank you. 🫢

the definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. this man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. πŸ™ˆ

if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qimevent.3qt) and the Qt version (3.3.8). literally so helpful of you πŸ’–


and that's the whole thing, babe. this page was brought to you by Trolltech AS, dated 2 February 2007, living in the 3.3.8 era β€” and honestly? she's still serving. slay, QIMEvent(3qt). periodt. πŸ’…βœ¨πŸŒˆ

πŸ“¦ where this page comes from