Compare commits
2 Commits
924ce5d127
...
cc4e88adbd
Author | SHA1 | Date |
---|---|---|
|
cc4e88adbd | |
|
284afed52f |
|
@ -67,10 +67,10 @@ FluScrollablePage{
|
|||
text:"Always"
|
||||
Layout.preferredWidth: 120
|
||||
FluMenuItem{
|
||||
text:"Nerver"
|
||||
text:"Never"
|
||||
onClicked: {
|
||||
btn_close_button_visibility.text = text
|
||||
tab_view.closeButtonVisibility = FluTabViewType.Nerver
|
||||
tab_view.closeButtonVisibility = FluTabViewType.Never
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
|
|
|
@ -68,10 +68,10 @@ FluScrollablePage{
|
|||
text:"Always"
|
||||
Layout.preferredWidth: 120
|
||||
FluMenuItem{
|
||||
text:"Nerver"
|
||||
text:"Never"
|
||||
onClicked: {
|
||||
btn_close_button_visibility.text = text
|
||||
tab_view.closeButtonVisibility = FluTabViewType.Nerver
|
||||
tab_view.closeButtonVisibility = FluTabViewType.Never
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
|
|
|
@ -145,7 +145,7 @@ enum TabWidthBehavior {
|
|||
};
|
||||
Q_ENUM_NS(TabWidthBehavior)
|
||||
enum CloseButtonVisibility {
|
||||
Nerver = 0x0000,
|
||||
Never = 0x0000,
|
||||
Always = 0x0001,
|
||||
OnHover = 0x0002
|
||||
};
|
||||
|
|
|
@ -57,21 +57,26 @@ static inline bool isCompositionEnabled(){
|
|||
}
|
||||
return composition_enabled;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void showShadow(HWND hwnd){
|
||||
const MARGINS shadow = { 0, 0, 1, 0 };
|
||||
typedef HRESULT (WINAPI* DwmExtendFrameIntoClientAreaPtr)(HWND hWnd, const MARGINS *pMarInset);
|
||||
HMODULE module = LoadLibraryW(L"dwmapi.dll");
|
||||
if (module)
|
||||
{
|
||||
DwmExtendFrameIntoClientAreaPtr dwm_extendframe_into_client_area_;
|
||||
dwm_extendframe_into_client_area_= reinterpret_cast<DwmExtendFrameIntoClientAreaPtr>(GetProcAddress(module, "DwmExtendFrameIntoClientArea"));
|
||||
if (dwm_extendframe_into_client_area_)
|
||||
if(isCompositionEnabled()){
|
||||
const MARGINS shadow = { 0, 0, 1, 0 };
|
||||
typedef HRESULT (WINAPI* DwmExtendFrameIntoClientAreaPtr)(HWND hWnd, const MARGINS *pMarInset);
|
||||
HMODULE module = LoadLibraryW(L"dwmapi.dll");
|
||||
if (module)
|
||||
{
|
||||
dwm_extendframe_into_client_area_(hwnd, &shadow);
|
||||
DwmExtendFrameIntoClientAreaPtr dwm_extendframe_into_client_area_;
|
||||
dwm_extendframe_into_client_area_= reinterpret_cast<DwmExtendFrameIntoClientAreaPtr>(GetProcAddress(module, "DwmExtendFrameIntoClientArea"));
|
||||
if (dwm_extendframe_into_client_area_)
|
||||
{
|
||||
dwm_extendframe_into_client_area_(hwnd, &shadow);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ULONG_PTR cNewStyle = GetClassLongPtr(hwnd, GCL_STYLE) | CS_DROPSHADOW;
|
||||
SetClassLongPtr(hwnd, GCL_STYLE, cNewStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +116,9 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
|||
}else if(uMsg == WM_NCCALCSIZE){
|
||||
const auto clientRect = ((wParam == FALSE) ? reinterpret_cast<LPRECT>(lParam) : &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(lParam))->rgrc[0]);
|
||||
const LONG originalTop = clientRect->top;
|
||||
const LONG originalBottom = clientRect->bottom;
|
||||
const LONG originalLeft = clientRect->left;
|
||||
const LONG originalRight = clientRect->right;
|
||||
const LRESULT hitTestResult = ::DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam);
|
||||
if ((hitTestResult != HTERROR) && (hitTestResult != HTNOWHERE)) {
|
||||
*result = hitTestResult;
|
||||
|
@ -133,7 +140,14 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
|||
offsetTop = 1;
|
||||
}
|
||||
}
|
||||
clientRect->top = originalTop+offsetTop;
|
||||
if(isCompositionEnabled()){
|
||||
clientRect->top = originalTop+offsetTop;
|
||||
}else{
|
||||
clientRect->top = originalTop;
|
||||
clientRect->bottom = originalBottom;
|
||||
clientRect->left = originalLeft;
|
||||
clientRect->right = originalRight;
|
||||
}
|
||||
*result = WVR_REDRAW;
|
||||
return true;
|
||||
}if(uMsg == WM_NCHITTEST){
|
||||
|
@ -157,8 +171,8 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
|||
QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
|
||||
}
|
||||
return false;
|
||||
}else if(uMsg == WM_NCPAINT){
|
||||
*result = 0;
|
||||
}else if(uMsg == WM_NCPAINT || uMsg == 0x00AE || uMsg == 0x00AF){
|
||||
*result = FALSE;
|
||||
return true;
|
||||
}else if(uMsg == WM_NCACTIVATE){
|
||||
*result = DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1);
|
||||
|
@ -285,23 +299,21 @@ void FluFramelessHelper::componentComplete(){
|
|||
_realHeight = QQmlProperty(window,"_realHeight");
|
||||
_realWidth = QQmlProperty(window,"_realWidth");
|
||||
_appBarHeight = QQmlProperty(window,"_appBarHeight");
|
||||
_enableMarginsBottomLeftRight = QQmlProperty(window,"_enableMarginsBottomLeftRight");
|
||||
#ifdef Q_OS_WIN
|
||||
if(isCompositionEnabled()){
|
||||
window->setFlag(Qt::CustomizeWindowHint,true);
|
||||
_nativeEvent =new FramelessEventFilter(this);
|
||||
qApp->installNativeEventFilter(_nativeEvent);
|
||||
HWND hwnd = reinterpret_cast<HWND>(window->winId());
|
||||
DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
|
||||
if(resizeable()){
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME);
|
||||
}else{
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME);
|
||||
}
|
||||
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||
|
||||
_enableMarginsBottomLeftRight.write(!isCompositionEnabled());
|
||||
window->setFlag(Qt::CustomizeWindowHint,true);
|
||||
_nativeEvent =new FramelessEventFilter(this);
|
||||
qApp->installNativeEventFilter(_nativeEvent);
|
||||
HWND hwnd = reinterpret_cast<HWND>(window->winId());
|
||||
DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
|
||||
if(resizeable()){
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME);
|
||||
}else{
|
||||
window->setFlags((window->flags() & (~Qt::WindowMinMaxButtonsHint) & (~Qt::Dialog)) | Qt::FramelessWindowHint | Qt::Window);
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME);
|
||||
}
|
||||
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||
showShadow(hwnd);
|
||||
#else
|
||||
window->setFlags((window->flags() & (~Qt::WindowMinMaxButtonsHint) & (~Qt::Dialog)) | Qt::FramelessWindowHint | Qt::Window);
|
||||
#endif
|
||||
|
@ -374,10 +386,8 @@ FluFramelessHelper::~FluFramelessHelper(){
|
|||
if (!window.isNull()) {
|
||||
window->setFlags(Qt::Window);
|
||||
#ifdef Q_OS_WIN
|
||||
if(isCompositionEnabled()){
|
||||
qApp->removeNativeEventFilter(_nativeEvent);
|
||||
delete _nativeEvent;
|
||||
}
|
||||
qApp->removeNativeEventFilter(_nativeEvent);
|
||||
delete _nativeEvent;
|
||||
#endif
|
||||
window->removeEventFilter(this);
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ private:
|
|||
QQmlProperty _realHeight;
|
||||
QQmlProperty _realWidth;
|
||||
QQmlProperty _appBarHeight;
|
||||
QQmlProperty _enableMarginsBottomLeftRight;
|
||||
};
|
||||
|
||||
#endif // FLUFRAMELESSHELPER_H
|
||||
|
|
|
@ -44,6 +44,7 @@ Rectangle{
|
|||
d.win.visibility = Window.Windowed
|
||||
else
|
||||
d.win.visibility = Window.Maximized
|
||||
d.hoverMaxBtn = false
|
||||
}
|
||||
}
|
||||
property var minClickListener: function(){
|
||||
|
|
|
@ -236,7 +236,7 @@ Item {
|
|||
width: visible ? 24 : 0
|
||||
height: 24
|
||||
visible: {
|
||||
if(closeButtonVisibility === FluTabViewType.Nerver)
|
||||
if(closeButtonVisibility === FluTabViewType.Never)
|
||||
return false
|
||||
if(closeButtonVisibility === FluTabViewType.OnHover)
|
||||
return item_mouse_hove.containsMouse || item_btn_close.hovered
|
||||
|
|
|
@ -64,6 +64,7 @@ Window {
|
|||
property int _realHeight
|
||||
property int _realWidth
|
||||
property int _appBarHeight: appBar.height
|
||||
property bool _enableMarginsBottomLeftRight: false
|
||||
id:window
|
||||
color:"transparent"
|
||||
Component.onCompleted: {
|
||||
|
@ -209,6 +210,9 @@ Window {
|
|||
anchors{
|
||||
fill:parent
|
||||
topMargin: _offsetXY.y
|
||||
bottomMargin: _enableMarginsBottomLeftRight ? _offsetXY.y : 0
|
||||
leftMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0
|
||||
rightMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0
|
||||
}
|
||||
onWidthChanged: {
|
||||
window.appBar.width = width
|
||||
|
|
|
@ -80,6 +80,8 @@ Module {
|
|||
prototype: "QObject"
|
||||
exports: ["FluentUI/FluFramelessHelper 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
Signal { name: "loadCompleted" }
|
||||
Method { name: "showSystemMenu" }
|
||||
}
|
||||
Component {
|
||||
name: "FluNavigationViewType"
|
||||
|
@ -186,7 +188,7 @@ Module {
|
|||
Enum {
|
||||
name: "CloseButtonVisibility"
|
||||
values: {
|
||||
"Nerver": 0,
|
||||
"Never": 0,
|
||||
"Always": 1,
|
||||
"OnHover": 2
|
||||
}
|
||||
|
@ -2341,11 +2343,13 @@ Module {
|
|||
Property { name: "closeClickListener"; type: "QVariant" }
|
||||
Property { name: "stayTopClickListener"; type: "QVariant" }
|
||||
Property { name: "darkClickListener"; type: "QVariant" }
|
||||
Property { name: "systemMenuListener"; type: "QVariant" }
|
||||
Method { name: "stayTopButton"; type: "QVariant" }
|
||||
Method { name: "minimizeButton"; type: "QVariant" }
|
||||
Method { name: "maximizeButton"; type: "QVariant" }
|
||||
Method { name: "closeButton"; type: "QVariant" }
|
||||
Method { name: "darkButton"; type: "QVariant" }
|
||||
Method { name: "maximizeButtonHover"; type: "QVariant" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickRectangle"
|
||||
|
@ -3013,15 +3017,15 @@ Module {
|
|||
defaultProperty: "data"
|
||||
Property { name: "logo"; type: "QUrl" }
|
||||
Property { name: "title"; type: "string" }
|
||||
Property { name: "items"; type: "FluObject_QMLTYPE_125"; isPointer: true }
|
||||
Property { name: "footerItems"; type: "FluObject_QMLTYPE_125"; isPointer: true }
|
||||
Property { name: "items"; type: "FluObject_QMLTYPE_157"; isPointer: true }
|
||||
Property { name: "footerItems"; type: "FluObject_QMLTYPE_157"; isPointer: true }
|
||||
Property { name: "displayMode"; type: "int" }
|
||||
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
|
||||
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
|
||||
Property { name: "topPadding"; type: "int" }
|
||||
Property { name: "pageMode"; type: "int" }
|
||||
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_34"; isPointer: true }
|
||||
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_34"; isPointer: true }
|
||||
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_45"; isPointer: true }
|
||||
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_45"; isPointer: true }
|
||||
Property { name: "navCompactWidth"; type: "int" }
|
||||
Property { name: "navTopMargin"; type: "int" }
|
||||
Property { name: "cellHeight"; type: "int" }
|
||||
|
@ -3109,21 +3113,17 @@ Module {
|
|||
Property { name: "_ext"; type: "QVariant" }
|
||||
Property { name: "_parent"; type: "QVariant" }
|
||||
Property { name: "title"; type: "string" }
|
||||
Property { name: "order"; type: "int" }
|
||||
Property { name: "url"; type: "QVariant" }
|
||||
Property { name: "disabled"; type: "bool" }
|
||||
Property { name: "icon"; type: "int" }
|
||||
Property { name: "iconVisible"; type: "bool" }
|
||||
Property { name: "infoBadge"; type: "QQmlComponent"; isPointer: true }
|
||||
Property { name: "recentlyAdded"; type: "bool" }
|
||||
Property { name: "recentlyUpdated"; type: "bool" }
|
||||
Property { name: "desc"; type: "string" }
|
||||
Property { name: "image"; type: "QVariant" }
|
||||
Property { name: "count"; type: "int" }
|
||||
Property { name: "onTapListener"; type: "QVariant" }
|
||||
Property { name: "iconDelegate"; type: "QQmlComponent"; isPointer: true }
|
||||
Property { name: "menuDelegate"; type: "QQmlComponent"; isPointer: true }
|
||||
Property { name: "editDelegate"; type: "QQmlComponent"; isPointer: true }
|
||||
Property { name: "extra"; type: "QVariant" }
|
||||
Property { name: "showEdit"; type: "bool" }
|
||||
Signal { name: "tap" }
|
||||
}
|
||||
|
@ -3534,13 +3534,6 @@ Module {
|
|||
}
|
||||
Method { name: "count"; type: "QVariant" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQmlTableModelColumn"
|
||||
name: "FluentUI/FluTableModelColumn 1.0"
|
||||
exports: ["FluentUI/FluTableModelColumn 1.0"]
|
||||
exportMetaObjectRevisions: [0]
|
||||
isComposite: true
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickRectangle"
|
||||
name: "FluentUI/FluTableView 1.0"
|
||||
|
@ -3798,7 +3791,15 @@ Module {
|
|||
Property { name: "resizeBorderColor"; type: "QColor" }
|
||||
Property { name: "resizeBorderWidth"; type: "int" }
|
||||
Property { name: "closeListener"; type: "QVariant" }
|
||||
Property { name: "_offsetXY"; type: "QPointF" }
|
||||
Property { name: "_originalPos"; type: "QVariant" }
|
||||
Property { name: "_accentColor"; type: "QColor" }
|
||||
Property { name: "_realHeight"; type: "int" }
|
||||
Property { name: "_realWidth"; type: "int" }
|
||||
Property { name: "_appBarHeight"; type: "int" }
|
||||
Property { name: "_enableMarginsBottomLeftRight"; type: "bool" }
|
||||
Property { name: "content"; type: "QObject"; isList: true; isReadonly: true }
|
||||
Signal { name: "showSystemMenu" }
|
||||
Signal {
|
||||
name: "initArgument"
|
||||
Parameter { name: "argument"; type: "QVariant" }
|
||||
|
@ -3846,12 +3847,14 @@ Module {
|
|||
Parameter { name: "path"; type: "QVariant" }
|
||||
}
|
||||
Method { name: "moveWindowToDesktopCenter"; type: "QVariant" }
|
||||
Method { name: "fixWindowSize"; type: "QVariant" }
|
||||
Method {
|
||||
name: "onResult"
|
||||
type: "QVariant"
|
||||
Parameter { name: "data"; type: "QVariant" }
|
||||
}
|
||||
Method { name: "containerItem"; type: "QVariant" }
|
||||
Method { name: "layoutContainer"; type: "QVariant" }
|
||||
Method { name: "layoutContent"; type: "QVariant" }
|
||||
}
|
||||
Component {
|
||||
prototype: "QQuickRow"
|
||||
|
|
|
@ -44,6 +44,7 @@ Rectangle{
|
|||
d.win.visibility = Window.Windowed
|
||||
else
|
||||
d.win.visibility = Window.Maximized
|
||||
d.hoverMaxBtn = false
|
||||
}
|
||||
}
|
||||
property var minClickListener: function(){
|
||||
|
|
|
@ -236,7 +236,7 @@ Item {
|
|||
width: visible ? 24 : 0
|
||||
height: 24
|
||||
visible: {
|
||||
if(closeButtonVisibility === FluTabViewType.Nerver)
|
||||
if(closeButtonVisibility === FluTabViewType.Never)
|
||||
return false
|
||||
if(closeButtonVisibility === FluTabViewType.OnHover)
|
||||
return item_mouse_hove.containsMouse || item_btn_close.hovered
|
||||
|
|
|
@ -63,6 +63,7 @@ Window {
|
|||
property int _realHeight
|
||||
property int _realWidth
|
||||
property int _appBarHeight: appBar.height
|
||||
property bool _enableMarginsBottomLeftRight: false
|
||||
id:window
|
||||
color:"transparent"
|
||||
Component.onCompleted: {
|
||||
|
@ -208,6 +209,9 @@ Window {
|
|||
anchors{
|
||||
fill:parent
|
||||
topMargin: _offsetXY.y
|
||||
bottomMargin: _enableMarginsBottomLeftRight ? _offsetXY.y : 0
|
||||
leftMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0
|
||||
rightMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0
|
||||
}
|
||||
onWidthChanged: {
|
||||
window.appBar.width = width
|
||||
|
|
Loading…
Reference in New Issue