diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2012-12-21 11:45:06 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-12-28 16:50:07 +0100 |
commit | 408c6daa008b07e7f422d07606f1f0b685006793 (patch) | |
tree | 61b264c04dd2a096bcd363b2736273c2f62111e5 /src/plugins/bineditor | |
parent | d0f9d0c136a1bc443f6db502551eb0f3d940bec4 (diff) | |
download | qt-creator-408c6daa008b07e7f422d07606f1f0b685006793.tar.gz |
BinEditor: Fix tooltip and context menu
Adapt to selection changes
Change-Id: I99aa2690da0da5cefecc542be47b48eb5f8424dc
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/bineditor')
-rw-r--r-- | src/plugins/bineditor/bineditor.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/plugins/bineditor/bineditor.cpp b/src/plugins/bineditor/bineditor.cpp index 69396c7cc1..6b0398c72f 100644 --- a/src/plugins/bineditor/bineditor.cpp +++ b/src/plugins/bineditor/bineditor.cpp @@ -1080,20 +1080,19 @@ QString BinEditor::toolTip(const QHelpEvent *helpEvent) const // Selection if mouse is in, else 1 byte at cursor int selStart = selectionStart(); int selEnd = selectionEnd(); - int byteCount = selEnd - selStart; - if (byteCount <= 0) { + int byteCount = selEnd - selStart + 1; + if (byteCount <= 1) { selStart = posAt(helpEvent->pos()); - selEnd = selStart + 1; + selEnd = selStart; byteCount = 1; } if (m_hexCursor == 0 || byteCount > 8) return QString(); const QPoint &startPoint = offsetToPos(selStart); - const QPoint &endPoint = offsetToPos(selEnd); - const QPoint expandedEndPoint - = QPoint(endPoint.x(), endPoint.y() + m_lineHeight); - const QRect selRect(startPoint, expandedEndPoint); + const QPoint &endPoint = offsetToPos(selEnd + 1); + QRect selRect(startPoint, endPoint); + selRect.setHeight(m_lineHeight); if (!selRect.contains(helpEvent->pos())) return QString(); @@ -1488,7 +1487,7 @@ void BinEditor::redo() void BinEditor::contextMenuEvent(QContextMenuEvent *event) { const int selStart = selectionStart(); - const int byteCount = selectionEnd() - selStart; + const int byteCount = selectionEnd() - selStart + 1; QMenu contextMenu; QAction copyAsciiAction(tr("Copy Selection as ASCII Characters"), this); @@ -1502,12 +1501,6 @@ void BinEditor::contextMenuEvent(QContextMenuEvent *event) contextMenu.addAction(©HexAction); contextMenu.addAction(&addWatchpointAction); - copyAsciiAction.setEnabled(byteCount > 0); - copyHexAction.setEnabled(byteCount > 0);; - jumpToBeAddressHereAction.setEnabled(byteCount > 0); - jumpToBeAddressNewWindowAction.setEnabled(byteCount > 0); - jumpToLeAddressHereAction.setEnabled(byteCount > 0); - jumpToLeAddressNewWindowAction.setEnabled(byteCount > 0); addWatchpointAction.setEnabled(byteCount > 0 && byteCount <= 32); quint64 beAddress = 0; |