Fix clang, and clean up apple-specific code

This commit is contained in:
Pengfei
2021-08-17 00:47:26 +08:00
parent e2cd3f117a
commit fb182f2627
2 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -36,12 +36,12 @@ void DPIAwareDialog::showEvent(QShowEvent* event) {
#endif #endif
} }
#ifndef __APPLE__
void DPIAwareDialog::resizeEvent(QResizeEvent* event) { void DPIAwareDialog::resizeEvent(QResizeEvent* event) {
QDialog::resizeEvent(event); QDialog::resizeEvent(event);
resized = true; resized = true;
} }
#ifndef __APPLE__
void DPIAwareDialog::OnScreenChanged() { void DPIAwareDialog::OnScreenChanged() {
// Resize according to DPI // Resize according to DPI
const double scaleX = window_handle->screen()->logicalDotsPerInchX() / 96.0; const double scaleX = window_handle->screen()->logicalDotsPerInchX() / 96.0;
+8 -5
View File
@@ -13,24 +13,27 @@ public:
protected: protected:
void showEvent(QShowEvent* event) override; 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 // 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. // when screen is changed, to update those sizes.
virtual void SetContentSizes(int previous_width = 0, int previous_height = 0){}; virtual void SetContentSizes(int previous_width = 0, int previous_height = 0){};
private: private:
#ifndef __APPLE__
void OnScreenChanged();
#endif
QWindow* window_handle{}; QWindow* window_handle{};
const int original_width{}; const int original_width{};
const int original_height{}; 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 bool resized = false; // whether this dialog has been manually resized
double previous_scaleX{}; double previous_scaleX{};
double previous_scaleY{}; double previous_scaleY{};
int previous_width{}; int previous_width{};
int previous_height{}; int previous_height{};
#endif
}; };