fix: avoid promoting child widgets to child windows (#5161)

This commit is contained in:
nerix
2024-02-10 12:43:59 +01:00
committed by GitHub
parent f34a371576
commit 10aabd39e7
4 changed files with 94 additions and 30 deletions
+19
View File
@@ -153,6 +153,25 @@ private:
} ui_;
#ifdef USEWINSDK
/// @brief Returns the HWND of this window if it has one
///
/// A QWidget only has an HWND if it has been created. Before that,
/// accessing `winID()` will create the window which can lead to unintended
/// bugs.
std::optional<HWND> safeHWND() const;
/// @brief Tries to apply the `isTopMost_` setting
///
/// If the setting couldn't be applied (because the window wasn't created
/// yet), the operation is repeated after a short delay.
///
/// @pre When calling from outside this method, `waitingForTopMost_` must
/// be `false` to avoid too many pending calls.
/// @post If an operation was queued to be executed after some delay,
/// `waitingForTopMost_` will be set to `true`.
void tryApplyTopMost();
bool waitingForTopMost_ = false;
QRect initalBounds_;
QRect currentBounds_;
QRect nextBounds_;