mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
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.
This commit is contained in:
@@ -15,6 +15,8 @@ EditDialog::EditDialog(QWidget* parent)
|
||||
QHBoxLayout* hexLayout = new QHBoxLayout(ui->editorBinary);
|
||||
hexEdit = new QHexEdit(this);
|
||||
hexLayout->addWidget(hexEdit);
|
||||
hexEdit->setOverwriteMode(false);
|
||||
connect(hexEdit, SIGNAL(dataChanged()), this, SLOT(hexDataChanged()));
|
||||
|
||||
QShortcut* ins = new QShortcut(QKeySequence(Qt::Key_Insert), this);
|
||||
connect(ins, SIGNAL(activated()), this, SLOT(toggleOverwriteMode()));
|
||||
@@ -112,9 +114,16 @@ void EditDialog::accept()
|
||||
void EditDialog::editTextChanged()
|
||||
{
|
||||
if(ui->editorText->hasFocus())
|
||||
{
|
||||
hexEdit->setData(ui->editorText->toPlainText().toUtf8());
|
||||
checkDataType();
|
||||
}
|
||||
}
|
||||
|
||||
checkDataType();
|
||||
void EditDialog::hexDataChanged()
|
||||
{
|
||||
// Update the text editor accordingly
|
||||
ui->editorText->setPlainText(hexEdit->data());
|
||||
}
|
||||
|
||||
void EditDialog::checkDataType()
|
||||
|
||||
@@ -33,6 +33,7 @@ private slots:
|
||||
virtual void clearData();
|
||||
virtual void accept();
|
||||
virtual void editTextChanged();
|
||||
virtual void hexDataChanged();
|
||||
virtual void checkDataType();
|
||||
virtual void toggleOverwriteMode();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user