From fb182f26271e544d0ccc09cdcb2289282fb8faa8 Mon Sep 17 00:00:00 2001 From: Pengfei Date: Tue, 17 Aug 2021 00:47:26 +0800 Subject: [PATCH] Fix clang, and clean up apple-specific code --- src/frontend/helpers/dpi_aware_dialog.cpp | 2 +- src/frontend/helpers/dpi_aware_dialog.h | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/frontend/helpers/dpi_aware_dialog.cpp b/src/frontend/helpers/dpi_aware_dialog.cpp index 92114d2..e314107 100644 --- a/src/frontend/helpers/dpi_aware_dialog.cpp +++ b/src/frontend/helpers/dpi_aware_dialog.cpp @@ -36,12 +36,12 @@ void DPIAwareDialog::showEvent(QShowEvent* event) { #endif } +#ifndef __APPLE__ void DPIAwareDialog::resizeEvent(QResizeEvent* event) { QDialog::resizeEvent(event); resized = true; } -#ifndef __APPLE__ void DPIAwareDialog::OnScreenChanged() { // Resize according to DPI const double scaleX = window_handle->screen()->logicalDotsPerInchX() / 96.0; diff --git a/src/frontend/helpers/dpi_aware_dialog.h b/src/frontend/helpers/dpi_aware_dialog.h index 7795309..801a210 100644 --- a/src/frontend/helpers/dpi_aware_dialog.h +++ b/src/frontend/helpers/dpi_aware_dialog.h @@ -13,24 +13,27 @@ public: protected: void showEvent(QShowEvent* event) override; - void resizeEvent(QResizeEvent* event) override; // Called with two zeroes to set up content sizes that are relative to dialog size. Also called // when screen is changed, to update those sizes. virtual void SetContentSizes(int previous_width = 0, int previous_height = 0){}; private: -#ifndef __APPLE__ - void OnScreenChanged(); -#endif - QWindow* window_handle{}; const int original_width{}; const int original_height{}; +#ifndef __APPLE__ +protected: + void resizeEvent(QResizeEvent* event) override; + +private: + void OnScreenChanged(); + bool resized = false; // whether this dialog has been manually resized double previous_scaleX{}; double previous_scaleY{}; int previous_width{}; int previous_height{}; +#endif };