Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
18dd2735
Commit
18dd2735
authored
Feb 02, 2010
by
ck
Browse files
BinEditor: Copy data as displayed in hex column.
Instigated-by: hjk
parent
f52e7cc3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/bineditor/bineditor.cpp
View file @
18dd2735
...
...
@@ -1121,10 +1121,19 @@ void BinEditor::zoomOut(int range)
void
BinEditor
::
copy
()
{
int
selStart
=
qMin
(
m_cursorPosition
,
m_anchorPosition
);
int
selEnd
=
qMax
(
m_cursorPosition
,
m_anchorPosition
);
if
(
selStart
<
selEnd
)
QApplication
::
clipboard
()
->
setText
(
QString
::
fromLatin1
(
dataMid
(
selStart
,
selEnd
-
selStart
)));
const
int
selStart
=
selectionStart
();
const
int
selEnd
=
selectionEnd
();
if
(
selStart
<
selEnd
)
{
const
QByteArray
&
data
=
dataMid
(
selStart
,
selEnd
-
selStart
);
QString
hexString
;
const
char
*
const
hex
=
"0123456789abcdef"
;
for
(
int
i
=
0
;
i
<
data
.
size
();
++
i
)
{
const
uchar
val
=
static_cast
<
uchar
>
(
data
[
i
]);
hexString
.
append
(
hex
[
val
>>
4
]).
append
(
hex
[
val
&
0xf
]).
append
(
' '
);
}
hexString
.
chop
(
1
);
QApplication
::
clipboard
()
->
setText
(
hexString
);
}
}
void
BinEditor
::
highlightSearchResults
(
const
QByteArray
&
pattern
,
QTextDocument
::
FindFlags
findFlags
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment