From kde-commits Sun Jan 30 13:45:49 2005 From: Kazuki Ohta Date: Sun, 30 Jan 2005 13:45:49 +0000 To: kde-commits Subject: kdegraphics/kolourpaint Message-Id: <20050130134549.6EF5CEA21 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=110709281228960 CVS commit by kzk: The enhancement of InputMethod support of KolourPaint. When the text which is composed by InputMethod, update correctly the microFocusHint, which is to be used by CandidateWindow. M +9 -0 kpview.cpp 1.40 M +1 -0 kpview.h 1.14 M +13 -1 kpviewmanager.cpp 1.18 M +1 -1 kpviewmanager.h 1.10 M +5 -1 tools/kptooltext.cpp 1.15 --- kdegraphics/kolourpaint/kpview.cpp #1.39:1.40 @@ -457,4 +457,13 @@ void kpView::updateQueuedArea () } +// public +void kpView::updateMicroFocusHint (const QRect µFocusHint) +{ + int x = microFocusHint.topLeft().x(); + int y = microFocusHint.topLeft().y(); + int width = microFocusHint.width(); + int height = microFocusHint.height(); + setMicroFocusHint (x, y, width, height); +} // public --- kdegraphics/kolourpaint/kpview.h #1.13:1.14 @@ -101,4 +101,5 @@ public: void invalidateQueuedArea (); void updateQueuedArea (); + void updateMicroFocusHint (const QRect µFocusHint); signals: --- kdegraphics/kolourpaint/kpviewmanager.cpp #1.17:1.18 @@ -321,5 +321,5 @@ int kpViewManager::textCursorCol () cons } -void kpViewManager::setTextCursorPosition (int row, int col) +void kpViewManager::setTextCursorPosition (int row, int col, bool isUpdateMicroFocusHint) { if (row == m_textCursorRow && col == m_textCursorCol) @@ -340,4 +340,16 @@ void kpViewManager::setTextCursorPositio restoreQueueUpdates (); restoreFastUpdates (); + + if (isUpdateMicroFocusHint) + { + if (m_viewUnderCursor) + { + QPoint topLeft = sel->pointForTextRowCol (m_textCursorRow, m_textCursorCol); + if (topLeft != KP_INVALID_POINT) + { + m_viewUnderCursor->updateMicroFocusHint(QRect (topLeft.x (), topLeft.y (), 1, sel->textStyle ().fontMetrics ().height ())); + } + } + } } --- kdegraphics/kolourpaint/kpviewmanager.h #1.9:1.10 @@ -92,5 +92,5 @@ public: int textCursorRow () const; int textCursorCol () const; - void setTextCursorPosition (int row, int col); + void setTextCursorPosition (int row, int col, bool isUpdateMicroFocusHint = false); bool textCursorBlinkState () const; --- kdegraphics/kolourpaint/tools/kptooltext.cpp #1.14:1.15 @@ -594,5 +594,9 @@ void kpToolText::imComposeEvent (QIMEven // set cursor pos if (m_IMStartCursorRow >= 0) - viewManager ()->setTextCursorPosition (m_IMStartCursorRow, m_IMStartCursorCol + e->cursorPos () + e->selectionLength()); + { + int row = m_IMStartCursorRow; + int col = m_IMStartCursorCol + e->cursorPos () /* + e->selectionLength()*/; + viewManager ()->setTextCursorPosition (row, col, true /* update MicroFocusHint */); + } }