forked from github_mirror/framelesshelper
Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
5f77fe6fad
commit
0b3972643d
|
@ -32,7 +32,6 @@ int main(int argc, char *argv[]) {
|
||||||
QWidget widget;
|
QWidget widget;
|
||||||
widget.setContentsMargins(0, 0, 0, 0);
|
widget.setContentsMargins(0, 0, 0, 0);
|
||||||
QLabel *label = new QLabel;
|
QLabel *label = new QLabel;
|
||||||
label->setText(QObject::tr("Hello, World!"));
|
|
||||||
QObject::connect(&widget, &QWidget::windowTitleChanged, label,
|
QObject::connect(&widget, &QWidget::windowTitleChanged, label,
|
||||||
&QLabel::setText);
|
&QLabel::setText);
|
||||||
QPushButton *minimizeButton = new QPushButton;
|
QPushButton *minimizeButton = new QPushButton;
|
||||||
|
@ -70,6 +69,7 @@ int main(int argc, char *argv[]) {
|
||||||
mainLayout->addLayout(tbLayout);
|
mainLayout->addLayout(tbLayout);
|
||||||
mainLayout->addStretch();
|
mainLayout->addStretch();
|
||||||
widget.setLayout(mainLayout);
|
widget.setLayout(mainLayout);
|
||||||
|
widget.setWindowTitle(QObject::tr("Hello, World!"));
|
||||||
helper.setIgnoreObjects(&widget,
|
helper.setIgnoreObjects(&widget,
|
||||||
{minimizeButton, maximizeButton, closeButton});
|
{minimizeButton, maximizeButton, closeButton});
|
||||||
helper.removeWindowFrame(&widget);
|
helper.removeWindowFrame(&widget);
|
||||||
|
|
|
@ -43,7 +43,6 @@ int main(int argc, char *argv[]) {
|
||||||
QWidget widget;
|
QWidget widget;
|
||||||
widget.setContentsMargins(0, 0, 0, 0);
|
widget.setContentsMargins(0, 0, 0, 0);
|
||||||
QLabel *label = new QLabel;
|
QLabel *label = new QLabel;
|
||||||
label->setText(QObject::tr("Hello, World!"));
|
|
||||||
QObject::connect(&widget, &QWidget::windowTitleChanged, label,
|
QObject::connect(&widget, &QWidget::windowTitleChanged, label,
|
||||||
&QLabel::setText);
|
&QLabel::setText);
|
||||||
QPushButton *minimizeButton = new QPushButton;
|
QPushButton *minimizeButton = new QPushButton;
|
||||||
|
@ -81,6 +80,7 @@ int main(int argc, char *argv[]) {
|
||||||
mainLayout->addLayout(tbLayout);
|
mainLayout->addLayout(tbLayout);
|
||||||
mainLayout->addStretch();
|
mainLayout->addStretch();
|
||||||
widget.setLayout(mainLayout);
|
widget.setLayout(mainLayout);
|
||||||
|
widget.setWindowTitle(QObject::tr("Hello, World!"));
|
||||||
const auto hWnd_widget = reinterpret_cast<HWND>(widget.winId());
|
const auto hWnd_widget = reinterpret_cast<HWND>(widget.winId());
|
||||||
WinNativeEventFilter::addFramelessWindow(hWnd_widget);
|
WinNativeEventFilter::addFramelessWindow(hWnd_widget);
|
||||||
const auto data_widget = WinNativeEventFilter::windowData(hWnd_widget);
|
const auto data_widget = WinNativeEventFilter::windowData(hWnd_widget);
|
||||||
|
|
|
@ -11,12 +11,11 @@ Window {
|
||||||
|
|
||||||
FramelessHelper {
|
FramelessHelper {
|
||||||
id: framelessHelper
|
id: framelessHelper
|
||||||
Component.onCompleted: framelessHelper.removeWindowFrame()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: titleBar
|
id: titleBar
|
||||||
height: 30
|
height: framelessHelper.titleBarHeight
|
||||||
color: "white"
|
color: "white"
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -75,4 +74,6 @@ Window {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: framelessHelper.removeWindowFrame()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue