forked from github_mirror/framelesshelper
Add moveWindowToDesktopCenter to the quick helper.
It may be useful for Qt Quick users. Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
aa146d1893
commit
d8e07b86c4
|
@ -263,13 +263,27 @@ void FramelessQuickHelper::removeWindowFrame(const bool center) {
|
|||
#ifdef Q_OS_WINDOWS
|
||||
const auto hWnd = reinterpret_cast<HWND>(win->winId());
|
||||
if (hWnd) {
|
||||
WinNativeEventFilter::addFramelessWindow(hWnd, nullptr, center);
|
||||
WinNativeEventFilter::addFramelessWindow(hWnd);
|
||||
}
|
||||
#else
|
||||
m_framelessHelper.removeWindowFrame(win);
|
||||
if (center) {
|
||||
FramelessHelper::moveWindowToDesktopCenter(win);
|
||||
#endif
|
||||
}
|
||||
if (center) {
|
||||
moveWindowToDesktopCenter();
|
||||
}
|
||||
}
|
||||
|
||||
void FramelessQuickHelper::moveWindowToDesktopCenter() {
|
||||
const auto win = window();
|
||||
if (win) {
|
||||
#ifdef Q_OS_WINDOWS
|
||||
const auto hWnd = reinterpret_cast<HWND>(win->winId());
|
||||
if (hWnd) {
|
||||
WinNativeEventFilter::moveWindowToDesktopCenter(hWnd);
|
||||
}
|
||||
#else
|
||||
FramelessHelper::moveWindowToDesktopCenter(win);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
|
||||
public Q_SLOTS:
|
||||
void removeWindowFrame(const bool center = true);
|
||||
void moveWindowToDesktopCenter();
|
||||
|
||||
void setIgnoreAreas(const QVector<QRect> &val);
|
||||
void clearIgnoreAreas();
|
||||
|
|
Loading…
Reference in New Issue