qt5 の input method

13
Qt5Input Method 朝木卓見 1

Upload: takumi-asaki

Post on 22-Jun-2015

7.492 views

Category:

Technology


0 download

DESCRIPTION

Qt5 の Input Method の概要。

TRANSCRIPT

Page 1: Qt5 の Input Method

Qt5のInput Method朝木卓見

1

Page 2: Qt5 の Input Method

Qt4からQt5へ• Qt4では各プラットフォームでIMに(も)個別対応

• QPAによる抽象化

• QWidget依存からの脱却が必要

• デスクトップ全盛期はIMの重要度が低かった

• ユーザーが入力するだけ(アプリから制御出来ない)

• 旧APIは自由度・拡張性・抽象度が低い

• モバイルの躍進でIMへの需要が高まる

• アプリからの制御・アプリとの連携が必要に

2

Page 3: Qt5 の Input Method

Qt4のInput Method

Qt GUI

WindowsIMM32

Mac OS XNSTextInput

X11immodule

QWSQWSInputMethod

Application

QInputContext

QInputMethodEvent

scim ibus uim

QtGui

3

Page 4: Qt5 の Input Method

Qt4のAPI• Qt::WA_InputMethodEnabled

• QInputContext

• QInputMethodEvent

• QWidget::inputMethodQuery()

• QWidget::inputMethodHints (4.6)

• QEvent::RequestSoftwareInputPanel (4.6)

• QEvent::CloseSoftwareInputPanel (4.6)

IMの制御は4.6から

4

Page 5: Qt5 の Input Method

Qt5の主な変化

• QInputContextクラスを整理

• QPlatformInputContextとQInputMethodに分割

• システム向けとアプリ向け

• QWidget依存を取り除く

• アプリとの連携を視野に

5

Page 6: Qt5 の Input Method

QPlatformInputContext

• 各プラットフォームのInput MethodをQtにインテグレーションするためのクラス

• qtbase/src/platforms/*

• qtbase/src/plugins/platforminputcontexts/* (X11)

• QWidget非依存

• QPA用API

• 非アプリ向け

• ソース・バイナリ互換維持の対象外

6

Page 7: Qt5 の Input Method

QInputMethod

• アプリとInput Methodが連携するためのAPI

• http://qt-project.org/doc/qt-5.0/qtgui/qinputmethod.html

• show(), hide()

• keyboardRectangle()

7

Page 8: Qt5 の Input Method

InputMethodQuery

• Input Methodからアプリへの問い合わせ

• カーソル、フォント、サラウンドテキスト等

• Qt4

• QWidget::inputMethodQuery()

• Qt5

• QInputMethodQueryEvent

8

Page 9: Qt5 の Input Method

Qt5のInput Method

QPlatformAbstraction

Application

QPlatformInputContext

QInputMethodEvent QInputMethod

Mac OS XNSTextInput

Client

WindowsIMM32 ibus Mallit

9

Page 10: Qt5 の Input Method

Qt5のAPI• Qt::WA_InputMethodEnabled

• QPlatformInputContext (QPA API)

• QInputMethod

• QApplication::autoSipEnabled (Software Input Panel)

• QInputMethodEvent

• QInputMethodQueryEvent

• QWidget::inputMethodHints (値の追加あり)

• QEvent::RequestSoftwareInputPanel

• QEvent::CloseSoftwareInputPanel

10

Page 11: Qt5 の Input Method

Qt Quick 2

• inputMethodHintsプロパティの追加

• TextInput

• TextEdit

• Qt.inputMethodプロパティ

11

Page 12: Qt5 の Input Method

まとめ

• APIが大きく変更(主に以下のケースに影響)

• Input Methodを実装する場合

• 細かな制御が必要な場合

• 実装は?

• 要確認

12