Qt 4.8
Static Public Functions | List of all members
QInputContextFactory Class Reference

The QInputContextFactory class creates QInputContext objects. More...

#include <qinputcontextfactory.h>

Static Public Functions

static QInputContextcreate (const QString &key, QObject *parent)
 
static QString description (const QString &key)
 Returns an internationalized brief description of the QInputContext object specified by key. More...
 
static QString displayName (const QString &key)
 Returns a user friendly internationalized name of the QInputContext object specified by key. More...
 
static QStringList keys ()
 Returns the list of keys this factory can create input contexts for. More...
 
static QStringList languages (const QString &key)
 Returns the languages supported by the QInputContext object specified by key. More...
 

Detailed Description

The QInputContextFactory class creates QInputContext objects.

The input context factory creates a QInputContext object for a given key with QInputContextFactory::create().

The input contexts are either built-in or dynamically loaded from an input context plugin (see QInputContextPlugin).

keys() returns a list of valid keys. The keys are the names used, for example, to identify and specify input methods for the input method switching mechanism. The names have to be consistent with QInputContext::identifierName(), and may only contain ASCII characters.

A key can be used to retrieve the associated input context's supported languages using languages(). You can retrieve the input context's description using description() and finally you can get a user friendly internationalized name of the QInputContext object specified by the key using displayName().

Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.

This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own license. You may use this file under your Qt license. Following description is copied from their original file headers. Contact immod.nosp@m.ule-.nosp@m.qt@fr.nosp@m.eede.nosp@m.sktop.nosp@m..org if any conditions of this licensing are not clear to you.

See also
QInputContext, QInputContextPlugin

Definition at line 72 of file qinputcontextfactory.h.

Functions

◆ create()

static QInputContext* QInputContextFactory::create ( const QString key,
QObject parent 
)
static

◆ description()

QString QInputContextFactory::description ( const QString key)
static

Returns an internationalized brief description of the QInputContext object specified by key.

You can, for example, use this description in a user interface.

See also
keys(), displayName()

Definition at line 333 of file qinputcontextfactory.cpp.

334 {
335 #if defined(Q_WS_X11) && !defined(QT_NO_XIM)
336  if (key == QLatin1String("xim"))
337  return QInputContext::tr( "XIM input method" );
338 #endif
339 #if defined(Q_WS_WIN) && !defined(QT_NO_XIM)
340  if (key == QLatin1String("win"))
341  return QInputContext::tr( "Windows input method" );
342 #endif
343 #if defined(Q_WS_MAC)
344  if (key == QLatin1String("mac"))
345  return QInputContext::tr( "Mac OS X input method" );
346 #endif
347 #if defined(Q_WS_S60)
348  if (key == QLatin1String("coefep"))
349  return QInputContext::tr( "S60 FEP input method" );
350 #endif
351 #if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
352  Q_UNUSED(key);
353 #else
354  if (QInputContextFactoryInterface *factory =
355  qobject_cast<QInputContextFactoryInterface*>(loader()->instance(key)))
356  return factory->description(key);
357 #endif // QT_NO_LIBRARY
358  return QString();
359 }
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ displayName()

QString QInputContextFactory::displayName ( const QString key)
static

Returns a user friendly internationalized name of the QInputContext object specified by key.

You can, for example, use this name in a menu.

See also
keys(), QInputContext::identifierName()

Definition at line 305 of file qinputcontextfactory.cpp.

Referenced by QMultiInputContext::QMultiInputContext().

306 {
307  QString result;
308 #if defined(Q_WS_X11) && !defined(QT_NO_XIM)
309  if (key == QLatin1String("xim"))
310  return QInputContext::tr( "XIM" );
311 #endif
312 #ifdef Q_WS_S60
313  if (key == QLatin1String("coefep"))
314  return QInputContext::tr( "FEP" );
315 #endif
316 #if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
317  Q_UNUSED(key);
318 #else
319  if (QInputContextFactoryInterface *factory =
320  qobject_cast<QInputContextFactoryInterface*>(loader()->instance(key)))
321  return factory->displayName(key);
322 #endif // QT_NO_LIBRARY
323  return QString();
324 }
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ keys()

QStringList QInputContextFactory::keys ( )
static

Returns the list of keys this factory can create input contexts for.

The keys are the names used, for example, to identify and specify input methods for the input method switching mechanism. The names have to be consistent with QInputContext::identifierName(), and may only contain ASCII characters.

See also
create(), displayName(), QInputContext::identifierName()

Definition at line 184 of file qinputcontextfactory.cpp.

Referenced by QApplication::inputContext(), QMultiInputContext::QMultiInputContext(), and QApplicationPrivate::x11_apply_settings().

185 {
186  QStringList result;
187 #if defined(Q_WS_X11) && !defined(QT_NO_XIM)
188  result << QLatin1String("xim");
189 #endif
190 #if defined(Q_WS_WIN) && !defined(QT_NO_XIM)
191  result << QLatin1String("win");
192 #endif
193 #if defined(Q_WS_MAC)
194  result << QLatin1String("mac");
195 #endif
196 #if defined(Q_WS_S60)
197  result << QLatin1String("coefep");
198 #endif
199 #ifndef QT_NO_LIBRARY
200  result += loader()->keys();
201 #endif // QT_NO_LIBRARY
202  return result;
203 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QStringList class provides a list of strings.
Definition: qstringlist.h:66

◆ languages()

QStringList QInputContextFactory::languages ( const QString key)
static

Returns the languages supported by the QInputContext object specified by key.

The languages are expressed as language code (e.g. "zh_CN", "zh_TW", "zh_HK", "ja", "ko", ...). An input context that supports multiple languages can return all supported languages as a QStringList. The name has to be consistent with QInputContext::language().

This information may be used to optimize a user interface.

See also
keys(), QInputContext::language(), QLocale

Definition at line 261 of file qinputcontextfactory.cpp.

262 {
263  QStringList result;
264 #if defined(Q_WS_X11) && !defined(QT_NO_XIM)
265  if (key == QLatin1String("xim"))
266  return QStringList(QString());
267 #endif
268 #if defined(Q_WS_WIN)
269  if (key == QLatin1String("win"))
270  return QStringList(QString());
271 #endif
272 #if defined(Q_WS_MAC)
273  if (key == QLatin1String("mac"))
274  return QStringList(QString());
275 #endif
276 #if defined(Q_WS_S60)
277  if (key == QLatin1String("coefep"))
278  {
279  CAknInputLanguageList *langList = s60LangList();
280  int count = langList->Count();
281  for (int i = 0; i < count; ++i)
282  {
283  result.append(QString(qt_symbianLocaleName(langList->At(i)->LanguageCode())));
284  }
285  delete langList;
286  }
287 #endif
288 #if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS)
289  Q_UNUSED(key);
290 #else
291  if (QInputContextFactoryInterface *factory =
292  qobject_cast<QInputContextFactoryInterface*>(loader()->instance(key)))
293  result = factory->languages(key);
294 #endif // QT_NO_LIBRARY
295  return result;
296 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

The documentation for this class was generated from the following files: