From 60526b7be100c551deb7f47070d1398af36374bb Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sat, 2 May 2020 19:00:07 +0800 Subject: [PATCH] Update README.md Add instructions about how to set ignore areas and etc. Fixes: #5 Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 6439a1d..11e6063 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,36 @@ int main(int argc, char *argv[]) { } ``` +#### Ignore areas and etc + +```cpp +WinNativeEventFilter::WINDOWDATA data; +// The window can't be resized if fixedSize is set to TRUE. +data.fixedSize = FALSE; +// All the following values should not be DPI-aware, +// just use the original numbers, assuming the window's DPI +// is 96, don't scale them yourself, this code will +// do the scaling according to DPI internally and automatically. +// Maximum window size +data.maximumSize = QSize(1280, 720); +// Minimum window size +data.minimumSize = QSize(800, 540); +// How to set ignore areas: +// The geometry of something you already know, in window coordinates +data.ignoreAreas.append(QRect(100, 0, 30, 30)); +// The geometry of a widget, in window coordinates +data.ignoreAreas.append(pushButton_close.geometry()); +// Pass data as the second parameter +WinNativeEventFilter::addFramelessWindow(reinterpret_cast(widget.winId()), &data); +// Or +WinNativeEventFilter::setWindowData(reinterpret_cast(widget.winId()), &data); +// Or +const auto data = WinNativeEventFilter::windowData(reinterpret_cast(widget.winId())); +data.borderWidth = 5; +data.borderHeight = 5; +data.titlebarHeight = 30; +``` + ### Linux and macOS ```cpp