From f62d78ce1522eb7082415ad976cbc4a856af2876 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Mon, 19 Dec 2016 19:43:28 +0100 Subject: [PATCH] Apply changed font settings to edit dock without restart See issue #894. --- src/EditDialog.cpp | 17 +++++++++++------ src/EditDialog.h | 1 + src/MainWindow.cpp | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/EditDialog.cpp b/src/EditDialog.cpp index d462b51a..5971a446 100644 --- a/src/EditDialog.cpp +++ b/src/EditDialog.cpp @@ -33,14 +33,10 @@ EditDialog::EditDialog(QWidget* parent) QShortcut* ins = new QShortcut(QKeySequence(Qt::Key_Insert), this); connect(ins, SIGNAL(activated()), this, SLOT(toggleOverwriteMode())); - // Set the font for the text and hex editors - QFont editorFont(Settings::getSettingsValue("databrowser", "font").toString()); - editorFont.setPointSize(Settings::getSettingsValue("databrowser", "fontsize").toInt()); - ui->editorText->setFont(editorFont); - hexEdit->setFont(editorFont); - connect(ui->editorText, SIGNAL(textChanged()), this, SLOT(updateApplyButton())); connect(hexEdit, SIGNAL(dataChanged()), this, SLOT(updateApplyButton())); + + reloadSettings(); } EditDialog::~EditDialog() @@ -545,3 +541,12 @@ QString EditDialog::humanReadableSize(double byteCount) return size + " " + yiUnit + "B"; } + +void EditDialog::reloadSettings() +{ + // Set the font for the text and hex editors + QFont editorFont(Settings::getSettingsValue("databrowser", "font").toString()); + editorFont.setPointSize(Settings::getSettingsValue("databrowser", "fontsize").toInt()); + ui->editorText->setFont(editorFont); + hexEdit->setFont(editorFont); +} diff --git a/src/EditDialog.h b/src/EditDialog.h index 96ad32a6..3d8b0079 100644 --- a/src/EditDialog.h +++ b/src/EditDialog.h @@ -24,6 +24,7 @@ public slots: virtual void setFocus(); virtual void reject(); void setReadOnly(bool ro); + void reloadSettings(); protected: virtual void showEvent(QShowEvent* ev); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 46d460dd..90d496d2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1681,11 +1681,12 @@ void MainWindow::reloadSettings() sqlArea->getResultView()->setFont(logfont); } - // Set font for SQL logs + // Set font for SQL logs and edit dialog ui->editLogApplication->reloadSettings(); ui->editLogUser->reloadSettings(); ui->editLogApplication->setFont(logfont); ui->editLogUser->setFont(logfont); + editDock->reloadSettings(); // Load extensions loadExtensionsFromSettings();