Commit 4db18745 authored by hjk's avatar hjk
Browse files

bineditor: don't draw blinking cursor when we have a selection

Reviewed-by: ck
parent 6de9244e
...@@ -871,6 +871,7 @@ void BinEditor::paintEvent(QPaintEvent *e) ...@@ -871,6 +871,7 @@ void BinEditor::paintEvent(QPaintEvent *e)
} }
int x = -xoffset + m_margin + m_labelWidth; int x = -xoffset + m_margin + m_labelWidth;
bool cursorWanted = m_cursorPosition == m_anchorPosition;
if (isFullySelected) { if (isFullySelected) {
painter.save(); painter.save();
...@@ -893,7 +894,7 @@ void BinEditor::paintEvent(QPaintEvent *e) ...@@ -893,7 +894,7 @@ void BinEditor::paintEvent(QPaintEvent *e)
} }
if (cursor >= 0) { if (cursor >= 0 && cursorWanted) {
int w = fm.boundingRect(itemString.mid(cursor*3, 2)).width(); int w = fm.boundingRect(itemString.mid(cursor*3, 2)).width();
QRect cursorRect(x + cursor * m_columnWidth, y - m_ascent, w + 1, m_lineHeight); QRect cursorRect(x + cursor * m_columnWidth, y - m_ascent, w + 1, m_lineHeight);
painter.save(); painter.save();
...@@ -933,7 +934,7 @@ void BinEditor::paintEvent(QPaintEvent *e) ...@@ -933,7 +934,7 @@ void BinEditor::paintEvent(QPaintEvent *e)
} }
} }
if (cursor >= 0 && !printable.isEmpty()) { if (cursor >= 0 && !printable.isEmpty() && cursorWanted) {
QRect cursorRect(text_x + fm.width(printable.left(cursor)), QRect cursorRect(text_x + fm.width(printable.left(cursor)),
y-m_ascent, y-m_ascent,
fm.width(printable.at(cursor)), fm.width(printable.at(cursor)),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment