Use Qt's High-DPI scaling on Windows (#4868)

This commit is contained in:
nerix
2024-05-12 13:59:14 +02:00
committed by GitHub
parent 8202cd0d99
commit febcf464fe
21 changed files with 459 additions and 320 deletions
+5 -4
View File
@@ -75,7 +75,6 @@ public:
bool applyLastBoundsCheck();
float scale() const override;
float qtFontScale() const;
/// @returns true if the window is the top-most window.
/// Either #setTopMost was called or the `TopMost` flag is set which overrides this
@@ -132,7 +131,6 @@ private:
void drawCustomWindowFrame(QPainter &painter);
void onFocusLost();
bool handleDPICHANGED(MSG *msg);
bool handleSHOWWINDOW(MSG *msg);
bool handleSIZE(MSG *msg);
bool handleMOVE(MSG *msg);
@@ -149,8 +147,6 @@ private:
bool frameless_;
bool shown_ = false;
FlagsEnum<Flags> flags_;
float nativeScale_ = 1;
bool isResizeFixing_ = false;
bool isTopMost_ = false;
struct {
@@ -168,6 +164,7 @@ private:
widgets::BoundsChecking lastBoundsCheckMode_ = widgets::BoundsChecking::Off;
#ifdef USEWINSDK
void updateRealSize();
/// @brief Returns the HWND of this window if it has one
///
/// A QWidget only has an HWND if it has been created. Before that,
@@ -193,6 +190,10 @@ private:
QTimer useNextBounds_;
bool isNotMinimizedOrMaximized_{};
bool lastEventWasNcMouseMove_ = false;
/// The real bounds of the window as returned by
/// GetWindowRect. Used for drawing.
QRect realBounds_;
bool isMaximized_ = false;
#endif
pajlada::Signals::SignalHolder connections_;