Commit b9511fe1 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk
Browse files

BinEditor: Fix selection



* Last column is not selectable using the mouse
* Last byte is not selectable at all

Task-number: QTCREATORBUG-5209
Change-Id: I9b87819818bb3dab80ef2803208391599d206f1f
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 70a14404
...@@ -734,7 +734,7 @@ void BinEditor::paintEvent(QPaintEvent *e) ...@@ -734,7 +734,7 @@ void BinEditor::paintEvent(QPaintEvent *e)
selEnd = m_cursorPosition; selEnd = m_cursorPosition;
} else { } else {
selStart = m_cursorPosition; selStart = m_cursorPosition;
selEnd = m_anchorPosition + 1; selEnd = m_anchorPosition;
} }
QString itemString(m_bytesPerLine*3, QLatin1Char(' ')); QString itemString(m_bytesPerLine*3, QLatin1Char(' '));
...@@ -834,7 +834,7 @@ void BinEditor::paintEvent(QPaintEvent *e) ...@@ -834,7 +834,7 @@ void BinEditor::paintEvent(QPaintEvent *e)
m_lineHeight, color); m_lineHeight, color);
} }
if (selStart < selEnd && !isFullySelected && pos >= selStart && pos < selEnd) { if (selStart < selEnd && !isFullySelected && pos >= selStart && pos <= selEnd) {
selectionRect |= QRect(item_x, y-m_ascent, m_columnWidth, m_lineHeight); selectionRect |= QRect(item_x, y-m_ascent, m_columnWidth, m_lineHeight);
int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth
+ fm.width(printable.left(c)); + fm.width(printable.left(c));
...@@ -1380,7 +1380,7 @@ void BinEditor::copy(bool raw) ...@@ -1380,7 +1380,7 @@ void BinEditor::copy(bool raw)
if (selStart >= selEnd) if (selStart >= selEnd)
qSwap(selStart, selEnd); qSwap(selStart, selEnd);
const int selectionLength = selEnd - selStart; const int selectionLength = selEnd - selStart + 1;
if (selectionLength >> 22) { if (selectionLength >> 22) {
QMessageBox::warning(this, tr("Copying Failed"), QMessageBox::warning(this, tr("Copying Failed"),
tr("You cannot copy more than 4 MB of binary data.")); tr("You cannot copy more than 4 MB of binary data."));
......
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