File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,21 @@ void HexEditDialog::on_btnUnicode2Hex_clicked()
96
96
void HexEditDialog::on_chkKeepSize_toggled (bool checked)
97
97
{
98
98
mHexEdit ->setKeepSize (checked);
99
+ QByteArray data = mHexEdit ->data ();
100
+ if (checked)
101
+ {
102
+ int dataSize = data.size ();
103
+ QString asciiMask = QString (" x" ).repeated (dataSize / sizeof (char ));
104
+ QString unicodeMask = QString (" x" ).repeated (dataSize / sizeof (wchar_t ));
105
+ ui->lineEditAscii ->setInputMask (asciiMask);
106
+ ui->lineEditUnicode ->setInputMask (unicodeMask);
107
+ }
108
+ else
109
+ {
110
+ ui->lineEditAscii ->setInputMask (" " );
111
+ ui->lineEditUnicode ->setInputMask (" " );
112
+ mHexEdit ->setData (data);
113
+ }
99
114
}
100
115
101
116
void HexEditDialog::dataChangedSlot ()
@@ -126,11 +141,15 @@ void HexEditDialog::dataChangedSlot()
126
141
void HexEditDialog::on_lineEditAscii_textEdited (const QString & arg1)
127
142
{
128
143
Q_UNUSED (arg1);
144
+ int cursorPosition = ui->lineEditAscii ->cursorPosition ();
129
145
on_btnAscii2Hex_clicked ();
146
+ ui->lineEditAscii ->setCursorPosition (cursorPosition);
130
147
}
131
148
132
149
void HexEditDialog::on_lineEditUnicode_textEdited (const QString & arg1)
133
150
{
134
151
Q_UNUSED (arg1);
152
+ int cursorPosition = ui->lineEditUnicode ->cursorPosition ();
135
153
on_btnUnicode2Hex_clicked ();
154
+ ui->lineEditUnicode ->setCursorPosition (cursorPosition);
136
155
}
You can’t perform that action at this time.
0 commit comments