summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qwidgetlinecontrol_p.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2016-04-19 10:15:54 +0200
committerRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2016-04-25 05:55:57 +0000
commit1b5bc9723c0b23ca5197097c3087df6bbe024a2a (patch)
treedfbc879e0e966e9ac4bdf720c8aac70e09acaf24 /src/widgets/widgets/qwidgetlinecontrol_p.h
parente36f03f97a20494857225a0e77aa5d358f686faf (diff)
QWidgetLineControl: respect run-time changes to cursorFlashTime
cursorFlashTime will now change dynamically from QPA while platform controlled text selection (on mobile) is ongoing. This patch will therefore update QWidgetLineControl so that it listens to the cursorFlashTimeChanged signal and changes the blinking rate when triggered. The previous code had a function setBlinkingRate, which is now changed to setBlinkingCursorEnabled (like in QWidgetTextControl). This is because all callers of the function did either pass "QApplication::cursorFlashTime" or "0", which basically means enable or disable blinking. This moves the control of the blinking rate fully to QWidgetLineControl, which simplifies the code a bit, especially when cursorFlashTime can change. Note that when setting a blink period to 0, it means "show the cursor without blinking". AFAICS, the current implementation did not guarantee that. This is now made more explicit in the code. If hiding the cursor is needed, a separate function "setCursorVisible" is already available for controlling that. Change-Id: I7d39882de192a23e6e7ba370749892c7702c3d3b Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'src/widgets/widgets/qwidgetlinecontrol_p.h')
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index 8b723b0224..34d19d1e77 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -83,7 +83,7 @@ public:
: m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto),
m_hideCursor(false), m_separator(0), m_readOnly(0),
m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0),
- m_validInput(1), m_blinkStatus(0), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0),
+ m_validInput(1), m_blinkStatus(0), m_blinkEnabled(false), m_blinkTimer(0), m_deleteAllTimer(0),
m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1),
m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0),
m_selstart(0), m_selend(0), m_passwordEchoEditing(false)
@@ -354,8 +354,8 @@ public:
void processInputMethodEvent(QInputMethodEvent *event);
void processKeyEvent(QKeyEvent* ev);
- int cursorBlinkPeriod() const { return m_blinkPeriod; }
- void setCursorBlinkPeriod(int msec);
+ void setBlinkingCursorEnabled(bool enable);
+ void updateCursorBlinking();
void resetCursorBlinkTimer();
bool cursorBlinkStatus() const { return m_blinkStatus; }
@@ -433,7 +433,7 @@ private:
uint m_selDirty : 1;
uint m_validInput : 1;
uint m_blinkStatus : 1;
- int m_blinkPeriod; // 0 for non-blinking cursor
+ uint m_blinkEnabled : 1;
int m_blinkTimer;
int m_deleteAllTimer;
int m_ascent;