Skip to content

Commit 67c141c

Browse files
committed
Fix minor UI issues with blob editing
By default, use the overwrite mode in the hex edit widget. This way text and hex editor start in the same mode, making it less confusing to press the INS key to change the mode. When editing the data using the hex editor also update the text editor.
1 parent a8af5a7 commit 67c141c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/EditDialog.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ EditDialog::EditDialog(QWidget* parent)
1515
QHBoxLayout* hexLayout = new QHBoxLayout(ui->editorBinary);
1616
hexEdit = new QHexEdit(this);
1717
hexLayout->addWidget(hexEdit);
18+
hexEdit->setOverwriteMode(false);
19+
connect(hexEdit, SIGNAL(dataChanged()), this, SLOT(hexDataChanged()));
1820

1921
QShortcut* ins = new QShortcut(QKeySequence(Qt::Key_Insert), this);
2022
connect(ins, SIGNAL(activated()), this, SLOT(toggleOverwriteMode()));
@@ -112,9 +114,16 @@ void EditDialog::accept()
112114
void EditDialog::editTextChanged()
113115
{
114116
if(ui->editorText->hasFocus())
117+
{
115118
hexEdit->setData(ui->editorText->toPlainText().toUtf8());
119+
checkDataType();
120+
}
121+
}
116122

117-
checkDataType();
123+
void EditDialog::hexDataChanged()
124+
{
125+
// Update the text editor accordingly
126+
ui->editorText->setPlainText(hexEdit->data());
118127
}
119128

120129
void EditDialog::checkDataType()

src/EditDialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ private slots:
3333
virtual void clearData();
3434
virtual void accept();
3535
virtual void editTextChanged();
36+
virtual void hexDataChanged();
3637
virtual void checkDataType();
3738
virtual void toggleOverwriteMode();
3839

0 commit comments

Comments
 (0)