Changeset View
Changeset View
Standalone View
Standalone View
tools/selection/text/kpToolText_KeyboardEvents_HandleArrowKeys.cpp
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | |||||
58 | #endif | 58 | #endif | ||
59 | 59 | | |||
60 | if (hasBegunShape ()) | 60 | if (hasBegunShape ()) | ||
61 | endShape (currentPoint (), normalizedRect ()); | 61 | endShape (currentPoint (), normalizedRect ()); | ||
62 | 62 | | |||
63 | if (!textLines.isEmpty () && cursorRow > 0) | 63 | if (!textLines.isEmpty () && cursorRow > 0) | ||
64 | { | 64 | { | ||
65 | cursorRow--; | 65 | cursorRow--; | ||
66 | cursorCol = qMin (cursorCol, (int) textLines [cursorRow].length ()); | 66 | cursorCol = qMin (cursorCol, textLines [cursorRow].length ()); | ||
67 | viewManager ()->setTextCursorPosition (cursorRow, cursorCol); | 67 | viewManager ()->setTextCursorPosition (cursorRow, cursorCol); | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | e->accept (); | 70 | e->accept (); | ||
71 | } | 71 | } | ||
72 | 72 | | |||
73 | // protected | 73 | // protected | ||
74 | void kpToolText::handleDownKeyPress (QKeyEvent *e, | 74 | void kpToolText::handleDownKeyPress (QKeyEvent *e, | ||
75 | const QList <QString> &textLines, int cursorRow, int cursorCol) | 75 | const QList <QString> &textLines, int cursorRow, int cursorCol) | ||
76 | { | 76 | { | ||
77 | #if DEBUG_KP_TOOL_TEXT | 77 | #if DEBUG_KP_TOOL_TEXT | ||
78 | qCDebug(kpLogTools) << "\tdown pressed"; | 78 | qCDebug(kpLogTools) << "\tdown pressed"; | ||
79 | #endif | 79 | #endif | ||
80 | 80 | | |||
81 | if (hasBegunShape ()) | 81 | if (hasBegunShape ()) | ||
82 | endShape (currentPoint (), normalizedRect ()); | 82 | endShape (currentPoint (), normalizedRect ()); | ||
83 | 83 | | |||
84 | if (!textLines.isEmpty () && cursorRow < (int) textLines.size () - 1) | 84 | if (!textLines.isEmpty () && cursorRow < textLines.size () - 1) | ||
85 | { | 85 | { | ||
86 | cursorRow++; | 86 | cursorRow++; | ||
87 | cursorCol = qMin (cursorCol, (int) textLines [cursorRow].length ()); | 87 | cursorCol = qMin (cursorCol, textLines [cursorRow].length ()); | ||
88 | viewManager ()->setTextCursorPosition (cursorRow, cursorCol); | 88 | viewManager ()->setTextCursorPosition (cursorRow, cursorCol); | ||
89 | } | 89 | } | ||
90 | 90 | | |||
91 | e->accept (); | 91 | e->accept (); | ||
92 | } | 92 | } | ||
93 | 93 | | |||
94 | // protected | 94 | // protected | ||
95 | void kpToolText::handleLeftKeyPress (QKeyEvent *e, | 95 | void kpToolText::handleLeftKeyPress (QKeyEvent *e, | ||
▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines |