Compare commits

..

No commits in common. "f830d5a9bfc0f6836e6e2aa7c80d7201b730013f" and "2d4e61445e28c4f428d487b6d8438f025f2a1e2e" have entirely different histories.

13 changed files with 139 additions and 248 deletions

View File

@ -22,37 +22,18 @@ FluScrollablePage{
FluGroupBox {
title: qsTr("RadioButton Group")
Layout.fillWidth: true
Layout.preferredHeight: 150
Layout.topMargin: 20
FluRadioButtons {
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
spacing: 10
disabled: radio_button_switch.checked
FluRadioButton { text: qsTr("E-mail") }
FluRadioButton { text: qsTr("Calendar") }
FluRadioButton { text: qsTr("Contacts") }
}
FluToggleSwitch{
id: radio_button_switch
anchors{
right: parent.right
verticalCenter: parent.verticalCenter
}
text: qsTr("Disabled")
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: 4
code:`
FluGroupBox {
code:'FluGroupBox {
title: qsTr("CheckBox Group")
ColumnLayout {
spacing: 10
@ -61,20 +42,7 @@ FluGroupBox {
FluCheckBox { text: qsTr("Calendar") }
FluCheckBox { text: qsTr("Contacts") }
}
}
FluGroupBox {
title: qsTr("RadioButton Group")
FluRadioButtons {
spacing: 10
disabled: true // FluRadioButton
manuallyDisabled: true // FluRadioButtondisabled
FluRadioButton { text: qsTr("E-mail") }
FluRadioButton { text: qsTr("Calendar") }
FluRadioButton { text: qsTr("Contacts") }
}
}
`
}'
}
}

View File

@ -9,13 +9,9 @@ FluScrollablePage{
title: qsTr("InfoBar")
property var info1
property var info2
property var info3
FluFrame{
Layout.fillWidth: true
Layout.preferredHeight: 350
Layout.preferredHeight: 270
padding: 10
ColumnLayout{
spacing: 14
@ -53,51 +49,6 @@ FluScrollablePage{
showInfo(qsTr("This is an InfoBar in the Info Style"),0,qsTr("Manual shutdown is supported"))
}
}
FluText{
wrapMode: Text.WrapAnywhere
width: parent.width
text: qsTr("Manually close the info message box")
}
Row{
spacing: 5
FluButton{
text: (info1 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info1")
onClicked: {
if(info1) {
info1.close()
return
}
info1 = showInfo(qsTr("This is an '%1'").arg("info1"), 0)
}
}
FluButton{
text: (info2 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info2")
onClicked: {
if(info2) {
info2.close()
return
}
info2 = showInfo(qsTr("This is an '%1'").arg("info2"), 0)
}
}
FluButton{
text: (info3 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info3")
onClicked: {
if(info3) {
info3.close()
return
}
info3 = showInfo(qsTr("This is an '%1'").arg("info3"), 0)
}
}
FluButton{
text: qsTr("clear all info")
onClicked: {
clearAllInfo()
}
}
}
FluButton{
text:"Loading"
onClicked: {
@ -109,17 +60,12 @@ FluScrollablePage{
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -6
code:`
showInfo(qsTr("This is an InfoBar in the Info Style"))
code:'showInfo(qsTr("This is an InfoBar in the Info Style"))
showWarning(qsTr("This is an InfoBar in the Warning Style"))
showError(qsTr("This is an InfoBar in the Error Style"))
showSuccess(qsTr("This is an InfoBar in the Success Style"))
var info1 = showInfo(qsTr("This is an 'Info1'"), 0)
info1.close()
`
showSuccess(qsTr("This is an InfoBar in the Success Style"))'
}
}

View File

@ -73,7 +73,12 @@ void FluFrameless::componentComplete() {
int w = window()->width();
int h = window()->height();
_current = window()->winId();
window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint);
window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (QQuickWindow::sceneGraphBackend() == "software") {
window()->setFlag(Qt::FramelessWindowHint, false);
}
#endif
if (!_fixSize) {
window()->setFlag(Qt::WindowMaximizeButtonHint);
}
@ -92,14 +97,14 @@ void FluFrameless::componentComplete() {
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
if (_fixSize) {
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_CAPTION);
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME);
for (int i = 0; i <= QGuiApplication::screens().count() - 1; ++i) {
connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] {
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED);
});
}
} else {
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_CAPTION);
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME);
}
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
connect(window(), &QQuickWindow::screenChanged, this, [hwnd] {
@ -146,22 +151,29 @@ void FluFrameless::componentComplete() {
return false;
} else if (uMsg == WM_NCCALCSIZE) {
const auto clientRect = ((wParam == FALSE) ? reinterpret_cast<LPRECT>(lParam) : &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(lParam))->rgrc[0]);
bool isMaximum = ::IsZoomed(hwnd);
if (!isMaximum){
if (clientRect->top != 0)
{
clientRect->top -= 1;
clientRect->bottom -= 1;
}
} else{
const LONG originalTop = clientRect->top;
const LRESULT hitTestResult = ::DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam);
if ((hitTestResult != HTERROR) && (hitTestResult != HTNOWHERE)) {
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult);
return true;
}
clientRect->top = originalTop-originalTop;
const LONG originalTop = clientRect->top;
const LONG originalLeft = clientRect->left;
const LONG originalRight = clientRect->right;
const LONG originalBottom = clientRect->bottom;
const LRESULT hitTestResult = ::DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam);
if ((hitTestResult != HTERROR) && (hitTestResult != HTNOWHERE)) {
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(hitTestResult);
return true;
}
int offsetSize;
bool isMaximum = ::IsZoomed(hwnd);
if (isMaximum || _isFullScreen()) {
offsetSize = 0;
} else {
offsetSize = 1;
}
if (!isCompositionEnabled()) {
offsetSize = 0;
}
clientRect->top = originalTop + offsetSize;
clientRect->bottom = originalBottom - offsetSize;
clientRect->left = originalLeft + offsetSize;
clientRect->right = originalRight - offsetSize;
_setMaximizeHovered(false);
*result = WVR_REDRAW;
return true;
@ -218,18 +230,6 @@ void FluFrameless::componentComplete() {
}
*result = HTCLIENT;
return true;
} else if (uMsg == WM_NCPAINT) {
if(isCompositionEnabled()){
return false;
}
*result = FALSE;
return true;
} else if (uMsg == WM_NCACTIVATE) {
if(isCompositionEnabled()){
return false;
}
*result = TRUE;
return true;
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) {
if (_hitMaximizeButton()) {
QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
@ -244,8 +244,23 @@ void FluFrameless::componentComplete() {
_setMaximizePressed(false);
return true;
}
} else if (uMsg == WM_ERASEBKGND) {
} else if (uMsg == WM_NCPAINT) {
*result = FALSE;
return true;
} else if (uMsg == WM_NCACTIVATE) {
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(::DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1));
return true;
} else if (uMsg == WM_GETMINMAXINFO) {
auto *minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam);
auto pixelRatio = window()->devicePixelRatio();
auto geometry = window()->screen()->availableGeometry();
RECT rect;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
minmaxInfo->ptMaxPosition.x = rect.left;
minmaxInfo->ptMaxPosition.y = rect.top;
minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio);
minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio);
return false;
} else if (uMsg == WM_NCRBUTTONDOWN) {
if (wParam == HTCAPTION) {
_showSystemMenu(QCursor::pos());
@ -343,27 +358,27 @@ void FluFrameless::_setMaximizeHovered(bool val) {
void FluFrameless::_updateCursor(int edges) {
switch (edges) {
case 0:
window()->setCursor(Qt::ArrowCursor);
break;
case Qt::LeftEdge:
case Qt::RightEdge:
window()->setCursor(Qt::SizeHorCursor);
break;
case Qt::TopEdge:
case Qt::BottomEdge:
window()->setCursor(Qt::SizeVerCursor);
break;
case Qt::LeftEdge | Qt::TopEdge:
case Qt::RightEdge | Qt::BottomEdge:
window()->setCursor(Qt::SizeFDiagCursor);
break;
case Qt::RightEdge | Qt::TopEdge:
case Qt::LeftEdge | Qt::BottomEdge:
window()->setCursor(Qt::SizeBDiagCursor);
break;
default:
break;
case 0:
window()->setCursor(Qt::ArrowCursor);
break;
case Qt::LeftEdge:
case Qt::RightEdge:
window()->setCursor(Qt::SizeHorCursor);
break;
case Qt::TopEdge:
case Qt::BottomEdge:
window()->setCursor(Qt::SizeVerCursor);
break;
case Qt::LeftEdge | Qt::TopEdge:
case Qt::RightEdge | Qt::BottomEdge:
window()->setCursor(Qt::SizeFDiagCursor);
break;
case Qt::RightEdge | Qt::TopEdge:
case Qt::LeftEdge | Qt::BottomEdge:
window()->setCursor(Qt::SizeBDiagCursor);
break;
default:
break;
}
}

View File

@ -18,23 +18,22 @@ FluObject {
if(screenLayout){
var last = screenLayout.getLastloader();
if(last.type === type && last.text === text && moremsg === last.moremsg){
last.duration = duration
if (duration > 0) last.restart();
return last;
last.restart();
return;
}
}
initScreenLayout();
return contentComponent.createObject(screenLayout,{
type:type,
text:text,
duration:duration,
moremsg:moremsg,
});
contentComponent.createObject(screenLayout,{
type:type,
text:text,
duration:duration,
moremsg:moremsg,
});
}
function createCustom(itemcomponent,duration){
initScreenLayout();
if(itemcomponent){
return contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
}
}
function initScreenLayout(){
@ -86,9 +85,7 @@ FluObject {
}
Timer {
id:delayTimer
interval: duration;
running: duration > 0;
repeat: duration > 0
interval: duration; running: duration > 0; repeat: duration > 0
onTriggered: content.close();
}
FluLoader{
@ -238,26 +235,18 @@ FluObject {
}
}
function showSuccess(text,duration=1000,moremsg){
return mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
}
function showInfo(text,duration=1000,moremsg){
return mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
}
function showWarning(text,duration=1000,moremsg){
return mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
}
function showError(text,duration=1000,moremsg){
return mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
}
function showCustom(itemcomponent,duration=1000){
return mcontrol.createCustom(itemcomponent,duration);
}
function clearAllInfo(){
if(mcontrol.screenLayout != null) {
mcontrol.screenLayout.destroy()
mcontrol.screenLayout = null
}
return true
mcontrol.createCustom(itemcomponent,duration);
}
}

View File

@ -48,6 +48,9 @@ T.MenuBarItem {
radius: 3
color: {
if(control.highlighted){
return FluTheme.itemCheckColor
}
if(control.hovered){
return FluTheme.itemHoverColor
}
return FluTheme.itemNormalColor

View File

@ -99,9 +99,9 @@ T.MenuItem {
anchors.fill: parent
anchors.margins: 3
radius: 4
color: {
color:{
if(control.highlighted){
return FluTheme.itemHoverColor
return FluTheme.itemCheckColor
}
return FluTheme.itemNormalColor
}

View File

@ -6,8 +6,6 @@ import FluentUI 1.0
ColumnLayout {
default property alias buttons: control.data
property int currentIndex : -1
property bool disabled: false
property bool manuallyDisabled: false
id:control
onCurrentIndexChanged: {
for(var i = 0;i<buttons.length;i++){
@ -18,12 +16,6 @@ ColumnLayout {
button.checked = true
}
}
onDisabledChanged: {
refreshButtonStatus()
}
onManuallyDisabledChanged: {
refreshButtonStatus()
}
Component.onCompleted: {
for(var i = 0;i<buttons.length;i++){
buttons[i].clickListener = function(){
@ -35,12 +27,6 @@ ColumnLayout {
}
}
}
refreshButtonStatus()
}
function refreshButtonStatus() {
for(var i = 0;i<buttons.length;i++){
if(!manuallyDisabled) buttons[i].enabled = !disabled
}
currentIndex = 0
}
}

View File

@ -279,7 +279,13 @@ Window {
id:loader_border
anchors.fill: parent
sourceComponent: {
if(window.useSystemAppBar || FluTools.isWin() || window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
if(window.useSystemAppBar){
return undefined
}
if(FluTools.isWindows10OrGreater()){
return undefined
}
if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
return undefined
}
return com_border
@ -289,19 +295,16 @@ Window {
loader_loading.sourceComponent = undefined
}
function showSuccess(text,duration,moremsg){
return info_bar.showSuccess(text,duration,moremsg)
info_bar.showSuccess(text,duration,moremsg)
}
function showInfo(text,duration,moremsg){
return info_bar.showInfo(text,duration,moremsg)
info_bar.showInfo(text,duration,moremsg)
}
function showWarning(text,duration,moremsg){
return info_bar.showWarning(text,duration,moremsg)
info_bar.showWarning(text,duration,moremsg)
}
function showError(text,duration,moremsg){
return info_bar.showError(text,duration,moremsg)
}
function clearAllInfo(){
return info_bar.clearAllInfo()
info_bar.showError(text,duration,moremsg)
}
function moveWindowToDesktopCenter(){
screen = Qt.application.screens[FluTools.cursorScreenIndex()]

View File

@ -1,6 +1,6 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import QtQuick
import QtQuick.Controls
import FluentUI
FluObject {
property var root;
@ -18,23 +18,22 @@ FluObject {
if(screenLayout){
var last = screenLayout.getLastloader();
if(last.type === type && last.text === text && moremsg === last.moremsg){
last.duration = duration
if (duration > 0) last.restart();
return last;
last.restart();
return;
}
}
initScreenLayout();
return contentComponent.createObject(screenLayout,{
type:type,
text:text,
duration:duration,
moremsg:moremsg,
});
contentComponent.createObject(screenLayout,{
type:type,
text:text,
duration:duration,
moremsg:moremsg,
});
}
function createCustom(itemcomponent,duration){
initScreenLayout();
if(itemcomponent){
return contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
}
}
function initScreenLayout(){
@ -86,9 +85,7 @@ FluObject {
}
Timer {
id:delayTimer
interval: duration;
running: duration > 0;
repeat: duration > 0
interval: duration; running: duration > 0; repeat: duration > 0
onTriggered: content.close();
}
FluLoader{
@ -238,26 +235,18 @@ FluObject {
}
}
function showSuccess(text,duration=1000,moremsg){
return mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
}
function showInfo(text,duration=1000,moremsg){
return mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
}
function showWarning(text,duration=1000,moremsg){
return mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
}
function showError(text,duration=1000,moremsg){
return mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
}
function showCustom(itemcomponent,duration=1000){
return mcontrol.createCustom(itemcomponent,duration);
}
function clearAllInfo(){
if(mcontrol.screenLayout != null) {
mcontrol.screenLayout.destroy()
mcontrol.screenLayout = null
}
return true
mcontrol.createCustom(itemcomponent,duration);
}
}

View File

@ -49,6 +49,9 @@ T.MenuBarItem {
radius: 3
color: {
if(control.highlighted){
return FluTheme.itemCheckColor
}
if(control.hovered){
return FluTheme.itemHoverColor
}
return FluTheme.itemNormalColor

View File

@ -100,9 +100,9 @@ T.MenuItem {
anchors.fill: parent
anchors.margins: 3
radius: 4
color: {
color:{
if(control.highlighted){
return FluTheme.itemHoverColor
return FluTheme.itemCheckColor
}
return FluTheme.itemNormalColor
}

View File

@ -7,8 +7,6 @@ import FluentUI
ColumnLayout {
default property alias buttons: control.data
property int currentIndex : -1
property bool disabled: false
property bool manuallyDisabled: false
id:control
onCurrentIndexChanged: {
for(var i = 0;i<buttons.length;i++){
@ -19,12 +17,6 @@ ColumnLayout {
button.checked = true
}
}
onDisabledChanged: {
refreshButtonStatus()
}
onManuallyDisabledChanged: {
refreshButtonStatus()
}
Component.onCompleted: {
for(var i = 0;i<buttons.length;i++){
buttons[i].clickListener = function(){
@ -36,12 +28,6 @@ ColumnLayout {
}
}
}
refreshButtonStatus()
}
function refreshButtonStatus() {
for(var i = 0;i<buttons.length;i++){
if(!manuallyDisabled) buttons[i].enabled = !disabled
}
currentIndex = 0
}
}

View File

@ -278,7 +278,13 @@ Window {
id:loader_border
anchors.fill: parent
sourceComponent: {
if(window.useSystemAppBar || FluTools.isWin() || window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
if(window.useSystemAppBar){
return undefined
}
if(FluTools.isWindows10OrGreater()){
return undefined
}
if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
return undefined
}
return com_border
@ -288,19 +294,16 @@ Window {
loader_loading.sourceComponent = undefined
}
function showSuccess(text,duration,moremsg){
return info_bar.showSuccess(text,duration,moremsg)
info_bar.showSuccess(text,duration,moremsg)
}
function showInfo(text,duration,moremsg){
return info_bar.showInfo(text,duration,moremsg)
info_bar.showInfo(text,duration,moremsg)
}
function showWarning(text,duration,moremsg){
return info_bar.showWarning(text,duration,moremsg)
info_bar.showWarning(text,duration,moremsg)
}
function showError(text,duration,moremsg){
return info_bar.showError(text,duration,moremsg)
}
function clearAllInfo(){
return info_bar.clearAllInfo()
info_bar.showError(text,duration,moremsg)
}
function moveWindowToDesktopCenter(){
screen = Qt.application.screens[FluTools.cursorScreenIndex()]