Update README.md

Adapt to the latest changes in code.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-12-04 11:52:59 +08:00
parent ff9dddef76
commit 6c76dda4f0
1 changed files with 3 additions and 14 deletions

View File

@ -69,7 +69,7 @@ Please refer to [the QWidget example](/examples/QWidget/main.cpp) for more detai
QMainWindow *mainWindow = new QMainWindow; QMainWindow *mainWindow = new QMainWindow;
// Qt's internal function. Make sure it's a top level window. // Qt's internal function. Make sure it's a top level window.
mainWindow->createWinId(); mainWindow->createWinId();
const QWindow *win = mainWindow->windowHandle(); QWindow *win = mainWindow->windowHandle();
// Disable resizing of the given window. Resizing is enabled by default. // Disable resizing of the given window. Resizing is enabled by default.
FramelessWindowsManager::setResizable(win, false); FramelessWindowsManager::setResizable(win, false);
// All the following values should not be DPI-aware, just use the // All the following values should not be DPI-aware, just use the
@ -77,22 +77,11 @@ FramelessWindowsManager::setResizable(win, false);
// them yourself, this code will do the scaling according to DPI // them yourself, this code will do the scaling according to DPI
// internally and automatically. // internally and automatically.
// Maximum window size // Maximum window size
FramelessWindowsManager::setMaximumSize(win, {1280, 720}); win->setMaximumSize(1280, 720);
// Minimum window size // Minimum window size
FramelessWindowsManager::setMinimumSize(win, {800, 540}); win->setMinimumSize(800, 540);
// How to set ignore areas:
// The geometry of something you already know, in window coordinates
FramelessWindowsManager::addIgnoreArea(win, {100, 0, 30, 30});
// The geometry of a widget, in window coordinates.
// It won't update automatically when the geometry of that widget has
// changed, so if you want to add a widget, which is in a layout and
// it's geometry will possibly change, to the ignore list, try the
// next method (addIgnoreObject) instead.
FramelessWindowsManager::addIgnoreArea(win, pushButton_close.geometry());
// The **POINTER** of a QWidget or QQuickItem // The **POINTER** of a QWidget or QQuickItem
FramelessWindowsManager::addIgnoreObject(win, ui->pushButton_minimize); FramelessWindowsManager::addIgnoreObject(win, ui->pushButton_minimize);
// Move a QWidget or QWindow to the center of its current desktop.
FramelessWindowsManager::moveWindowToDesktopCenter(win);
``` ```
## Supported Platforms ## Supported Platforms