hello, On 20 February 2017 at 20:35, Stefan Fuchs <[email protected]> wrote: > > Ohoh... it was so clear that sooner or later I will be punished by some > strange effect(s) for being a little bit too over-motivated and changing > things where I have no experience... ;-( >
it's probably not a good idea to modify the HTML entry in the .ui file for the QTextEdit because QtCreator will overwrite it once you attempt to edit it again. i think the HTML is there for a reason, but i cannot explain the differences you and Dirk observe. in terms of adding control for the printed planner details font, here is my go at it (patch attached) - i.e. this is what i think is the *correct* way to approach the problem. please, read the patch description and test it to see if it fits your needs. also, i don't exactly understand the zoom issue mentioned in your pull-request. lubomir --
From abdec10178cc95d7b17f3386f638dda7e8037ec5 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" <[email protected]> Date: Mon, 20 Feb 2017 21:15:59 +0200 Subject: [PATCH] Planner: use the default application font for the planner details The PlannerDetails class now has a settingsChanged() slot that will be called each time the application settings change; of interest - when the application default font and font size change. The planner details QTextEdit will now be shown using the default font instead of "Courier,13pt", which was a hardcoded font. The same will also be printed using said font. This gives the user some control over the hardcopy font, but eventually there could be a separate font setting for the planner details. Signed-off-by: Lubomir I. Ivanov <[email protected]> --- desktop-widgets/diveplanner.cpp | 6 ++++++ desktop-widgets/diveplanner.h | 4 +++- desktop-widgets/mainwindow.cpp | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index fddc5bb..6150a73 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -508,4 +508,10 @@ void PlannerSettingsWidget::setBackgasBreaks(bool dobreaks) PlannerDetails::PlannerDetails(QWidget *parent) : QWidget(parent) { ui.setupUi(this); + settingsChanged(); +} + +void PlannerDetails::settingsChanged() +{ + divePlanOutput()->setStyleSheet(QString("font: %1pt '%2'").arg(prefs.font_size).arg(prefs.divelist_font)); } diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h index 91501ce..8db5cfc 100644 --- a/desktop-widgets/diveplanner.h +++ b/desktop-widgets/diveplanner.h @@ -98,7 +98,9 @@ public: explicit PlannerDetails(QWidget *parent = 0); QPushButton *printPlan() const { return ui.printPlan; } QTextEdit *divePlanOutput() const { return ui.divePlanOutput; } - +public +slots: + void settingsChanged(); private: Ui::plannerDetails ui; }; diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 1941476..ae3dce9 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -182,6 +182,7 @@ MainWindow::MainWindow() : QMainWindow(), connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), diveListView, SLOT(reloadHeaderActions())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), information(), SLOT(updateDiveInfo())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), divePlannerWidget(), SLOT(settingsChanged())); + connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this->plannerDetails(), SLOT(settingsChanged())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), divePlannerSettingsWidget(), SLOT(settingsChanged())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), TankInfoModel::instance(), SLOT(update())); connect(ui.actionRecent1, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool))); -- 1.7.11.msysgit.0
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
