mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-24 03:30:59 +08:00
update
This commit is contained in:
parent
ef65183320
commit
012f30c979
@ -59,9 +59,6 @@ int main(int argc, char *argv[])
|
|||||||
QGuiApplication::setQuitOnLastWindowClosed(false);
|
QGuiApplication::setQuitOnLastWindowClosed(false);
|
||||||
SettingsHelper::getInstance()->init(argv);
|
SettingsHelper::getInstance()->init(argv);
|
||||||
Log::setup(argv,uri);
|
Log::setup(argv,uri);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
|
|
||||||
#endif
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
|
@ -105,22 +105,14 @@ void FluFrameless::componentComplete() {
|
|||||||
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
|
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
|
||||||
DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
|
DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||||
if (_fixSize) {
|
if (_fixSize) {
|
||||||
#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0))
|
|
||||||
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME);;
|
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME);;
|
||||||
#else
|
|
||||||
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION);
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i <= QGuiApplication::screens().count() - 1; ++i) {
|
for (int i = 0; i <= QGuiApplication::screens().count() - 1; ++i) {
|
||||||
connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] {
|
connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] {
|
||||||
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED);
|
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0))
|
|
||||||
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME);
|
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME);
|
||||||
#else
|
|
||||||
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CAPTION);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
connect(window(), &QQuickWindow::screenChanged, this, [hwnd] {
|
connect(window(), &QQuickWindow::screenChanged, this, [hwnd] {
|
||||||
@ -183,28 +175,10 @@ void FluFrameless::componentComplete() {
|
|||||||
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult);
|
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0))
|
|
||||||
clientRect->top = originalTop;
|
clientRect->top = originalTop;
|
||||||
clientRect->bottom = originalBottom;
|
clientRect->bottom = originalBottom;
|
||||||
clientRect->left = originalLeft;
|
clientRect->left = originalLeft;
|
||||||
clientRect->right = originalRight;
|
clientRect->right = originalRight;
|
||||||
#else
|
|
||||||
bool isMaximum = ::IsZoomed(hwnd);
|
|
||||||
if (isMaximum) {
|
|
||||||
auto geometry = window()->screen()->geometry();
|
|
||||||
auto offsetX = qAbs(geometry.left() - originalLeft);
|
|
||||||
auto offsetY = qAbs(geometry.top() - originalTop);
|
|
||||||
clientRect->top = originalTop + offsetY;
|
|
||||||
clientRect->bottom = originalBottom - offsetY;
|
|
||||||
clientRect->left = originalLeft + offsetX;
|
|
||||||
clientRect->right = originalRight - offsetX;
|
|
||||||
} else {
|
|
||||||
clientRect->top = originalTop;
|
|
||||||
clientRect->bottom = originalBottom;
|
|
||||||
clientRect->left = originalLeft;
|
|
||||||
clientRect->right = originalRight;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
_setMaximizeHovered(false);
|
_setMaximizeHovered(false);
|
||||||
*result = WVR_REDRAW;
|
*result = WVR_REDRAW;
|
||||||
return true;
|
return true;
|
||||||
@ -262,21 +236,12 @@ void FluFrameless::componentComplete() {
|
|||||||
*result = HTCLIENT;
|
*result = HTCLIENT;
|
||||||
return true;
|
return true;
|
||||||
} else if (uMsg == WM_NCPAINT) {
|
} else if (uMsg == WM_NCPAINT) {
|
||||||
#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0))
|
|
||||||
*result = FALSE;
|
*result = FALSE;
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
if (isCompositionEnabled()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*result = FALSE;
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
} else if (uMsg == WM_NCACTIVATE) {
|
} else if (uMsg == WM_NCACTIVATE) {
|
||||||
*result = TRUE;
|
*result = TRUE;
|
||||||
return true;
|
return true;
|
||||||
} else if (uMsg == WM_GETMINMAXINFO) {
|
} else if (uMsg == WM_GETMINMAXINFO) {
|
||||||
#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0))
|
|
||||||
auto *minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam);
|
auto *minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam);
|
||||||
auto pixelRatio = window()->devicePixelRatio();
|
auto pixelRatio = window()->devicePixelRatio();
|
||||||
auto geometry = window()->screen()->availableGeometry();
|
auto geometry = window()->screen()->availableGeometry();
|
||||||
@ -286,7 +251,6 @@ void FluFrameless::componentComplete() {
|
|||||||
minmaxInfo->ptMaxPosition.y = rect.top;
|
minmaxInfo->ptMaxPosition.y = rect.top;
|
||||||
minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio);
|
minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio);
|
||||||
minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio);
|
minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio);
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) {
|
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) {
|
||||||
if (_hitMaximizeButton()) {
|
if (_hitMaximizeButton()) {
|
||||||
@ -411,27 +375,27 @@ void FluFrameless::_setMaximizeHovered(bool val) {
|
|||||||
|
|
||||||
void FluFrameless::_updateCursor(int edges) {
|
void FluFrameless::_updateCursor(int edges) {
|
||||||
switch (edges) {
|
switch (edges) {
|
||||||
case 0:
|
case 0:
|
||||||
window()->setCursor(Qt::ArrowCursor);
|
window()->setCursor(Qt::ArrowCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::LeftEdge:
|
case Qt::LeftEdge:
|
||||||
case Qt::RightEdge:
|
case Qt::RightEdge:
|
||||||
window()->setCursor(Qt::SizeHorCursor);
|
window()->setCursor(Qt::SizeHorCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::TopEdge:
|
case Qt::TopEdge:
|
||||||
case Qt::BottomEdge:
|
case Qt::BottomEdge:
|
||||||
window()->setCursor(Qt::SizeVerCursor);
|
window()->setCursor(Qt::SizeVerCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::LeftEdge | Qt::TopEdge:
|
case Qt::LeftEdge | Qt::TopEdge:
|
||||||
case Qt::RightEdge | Qt::BottomEdge:
|
case Qt::RightEdge | Qt::BottomEdge:
|
||||||
window()->setCursor(Qt::SizeFDiagCursor);
|
window()->setCursor(Qt::SizeFDiagCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::RightEdge | Qt::TopEdge:
|
case Qt::RightEdge | Qt::TopEdge:
|
||||||
case Qt::LeftEdge | Qt::BottomEdge:
|
case Qt::LeftEdge | Qt::BottomEdge:
|
||||||
window()->setCursor(Qt::SizeBDiagCursor);
|
window()->setCursor(Qt::SizeBDiagCursor);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,13 +94,6 @@ Button {
|
|||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
Behavior on color {
|
|
||||||
enabled: control.animationEnabled
|
|
||||||
ColorAnimation{
|
|
||||||
duration: 83
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluIcon {
|
FluIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
iconSource: FluentIcons.CheckboxIndeterminate
|
iconSource: FluentIcons.CheckboxIndeterminate
|
||||||
@ -114,7 +107,6 @@ Button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluIcon {
|
FluIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
iconSource: FluentIcons.AcceptMedium
|
iconSource: FluentIcons.AcceptMedium
|
||||||
|
@ -95,13 +95,6 @@ Button {
|
|||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
Behavior on color {
|
|
||||||
enabled: control.animationEnabled
|
|
||||||
ColorAnimation{
|
|
||||||
duration: 83
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluIcon {
|
FluIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
iconSource: FluentIcons.CheckboxIndeterminate
|
iconSource: FluentIcons.CheckboxIndeterminate
|
||||||
|
Loading…
Reference in New Issue
Block a user