Support better committing preedit in QLineController
Similar as 7851568c65
for
QWidgetLineController
Change-Id: I7c1a1dc22e9b73515a5a72093866ac747a80896f
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
7a0c060268
commit
bd8188ebd4
@ -148,6 +148,30 @@ void QLineControl::paste(QClipboard::Mode clipboardMode)
|
|||||||
|
|
||||||
#endif // !QT_NO_CLIPBOARD
|
#endif // !QT_NO_CLIPBOARD
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
|
||||||
|
Exits preedit mode and commits parts marked as tentative commit
|
||||||
|
*/
|
||||||
|
void QLineControl::commitPreedit()
|
||||||
|
{
|
||||||
|
if (!composeMode())
|
||||||
|
return;
|
||||||
|
|
||||||
|
qApp->inputPanel()->reset();
|
||||||
|
|
||||||
|
if (!m_tentativeCommit.isEmpty()) {
|
||||||
|
internalInsert(m_tentativeCommit);
|
||||||
|
m_tentativeCommit.clear();
|
||||||
|
finishChange(-1, true/*not used, not documented*/, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_preeditCursor = 0;
|
||||||
|
setPreeditArea(-1, QString());
|
||||||
|
m_textLayout.clearAdditionalFormats();
|
||||||
|
updateDisplayText(/*force*/ true);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
|
|
||||||
@ -243,6 +267,8 @@ void QLineControl::clear()
|
|||||||
*/
|
*/
|
||||||
void QLineControl::setSelection(int start, int length)
|
void QLineControl::setSelection(int start, int length)
|
||||||
{
|
{
|
||||||
|
commitPreedit();
|
||||||
|
|
||||||
if(start < 0 || start > (int)m_text.length()){
|
if(start < 0 || start > (int)m_text.length()){
|
||||||
qWarning("QLineControl::setSelection: Invalid start position");
|
qWarning("QLineControl::setSelection: Invalid start position");
|
||||||
return;
|
return;
|
||||||
@ -403,6 +429,8 @@ bool QLineControl::fixup() // this function assumes that validate currently retu
|
|||||||
*/
|
*/
|
||||||
void QLineControl::moveCursor(int pos, bool mark)
|
void QLineControl::moveCursor(int pos, bool mark)
|
||||||
{
|
{
|
||||||
|
commitPreedit();
|
||||||
|
|
||||||
if (pos != m_cursor) {
|
if (pos != m_cursor) {
|
||||||
separate();
|
separate();
|
||||||
if (m_maskData)
|
if (m_maskData)
|
||||||
|
@ -209,6 +209,7 @@ public:
|
|||||||
QString text() const;
|
QString text() const;
|
||||||
QString realText() const;
|
QString realText() const;
|
||||||
void setText(const QString &txt);
|
void setText(const QString &txt);
|
||||||
|
void commitPreedit();
|
||||||
|
|
||||||
QString displayText() const { return m_textLayout.text(); }
|
QString displayText() const { return m_textLayout.text(); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user