Compare commits

...

17 Commits

Author SHA1 Message Date
f830d5a9bf Merge branch 'main' of https://github.com/zhuzichu520/FluentUI 2024-05-09 19:41:15 +08:00
ed49e3f6af Merge pull request #499 from gao-xiangyang/main
info提示语支持主动调用函数关闭,支持关闭所有info框的函数
2024-05-09 17:10:34 +05:30
9aa6615189 FluRadioButtons 组件支持 disabled、manuallyDisabled选项
disabled: true // 禁用所有FluRadioButton子组件
        manuallyDisabled: true // 是否指定每个FluRadioButton上的disabled选项
2024-05-08 21:10:00 +08:00
c36515f19c info提示语支持主动调用函数关闭,支持关闭所有info框的函数 2024-05-08 20:35:31 +08:00
5f6745b630 udpate 2024-04-28 13:03:20 +08:00
4f202831b8 Merge branch 'main' of https://github.com/zhuzichu520/FluentUI 2024-04-28 10:51:29 +08:00
29cee84edd update 2024-04-28 10:51:13 +08:00
2d4e61445e Merge pull request #488 from yanhuacuo/path-for-insertRow
Add the functionality to insert new rows into the table
2024-04-28 10:47:28 +08:00
cc79854191 Merge pull request #489 from w-jt/main
FluPagination.qml 添加自定义控件,通过header和footer属性添加控件
2024-04-28 10:46:47 +08:00
500efa6298 添加自定义控件,通过header和footer属性添加控件
添加自定义控件,通过header和footer属性添加控件
2024-04-27 11:54:42 +08:00
355332da96 添加自定义控件,通过header和footer属性添加控件
添加自定义控件,通过header和footer属性添加控件
2024-04-27 11:53:57 +08:00
a0d662a8a5 添加自定义控件,通过header和footer属性添加控件
添加自定义控件,通过header和footer属性添加控件
2024-04-27 11:49:29 +08:00
aecc3fe3b4 添加自定义控件,通过header和footer属性添加控件
添加自定义控件,通过header和footer属性添加控件
2024-04-27 11:48:19 +08:00
3554fb99cd Add the functionality to insert new rows into the table 2024-04-27 09:40:37 +08:00
24fdff7e35 fix bug 2024-04-25 00:08:18 +08:00
d2fdd08604 update 2024-04-24 17:24:31 +08:00
1f5d6ce1aa update 2024-04-24 17:12:00 +08:00
24 changed files with 590 additions and 416 deletions

View File

@ -1968,7 +1968,7 @@ Some contents...</source>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="177"/>
<location filename="qml/page/T_TableView.qml" line="478"/>
<location filename="qml/page/T_TableView.qml" line="513"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
@ -1988,57 +1988,67 @@ Some contents...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="337"/>
<location filename="qml/page/T_TableView.qml" line="358"/>
<source>Age</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="412"/>
<location filename="qml/page/T_TableView.qml" line="433"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="473"/>
<location filename="qml/page/T_TableView.qml" line="470"/>
<source>Insert a Row</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="478"/>
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="508"/>
<source>Avatar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="491"/>
<location filename="qml/page/T_TableView.qml" line="526"/>
<source>Address</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="498"/>
<location filename="qml/page/T_TableView.qml" line="534"/>
<source>Nickname</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="505"/>
<location filename="qml/page/T_TableView.qml" line="541"/>
<source>Long String</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="513"/>
<location filename="qml/page/T_TableView.qml" line="549"/>
<source>Options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="532"/>
<location filename="qml/page/T_TableView.qml" line="568"/>
<source>&lt;Previous</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="533"/>
<location filename="qml/page/T_TableView.qml" line="569"/>
<source>Next&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="419"/>
<location filename="qml/page/T_TableView.qml" line="440"/>
<source>Delete Selection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="443"/>
<location filename="qml/page/T_TableView.qml" line="464"/>
<source>Add a row of Data</source>
<translation type="unfinished"></translation>
</message>

View File

@ -2110,7 +2110,7 @@ Some contents...</source>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="177"/>
<location filename="qml/page/T_TableView.qml" line="478"/>
<location filename="qml/page/T_TableView.qml" line="513"/>
<source>Name</source>
<translation type="unfinished">名称</translation>
</message>
@ -2130,57 +2130,67 @@ Some contents...</source>
<translation type="unfinished">全选</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="337"/>
<location filename="qml/page/T_TableView.qml" line="358"/>
<source>Age</source>
<translation type="unfinished">年龄</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="412"/>
<location filename="qml/page/T_TableView.qml" line="433"/>
<source>Clear All</source>
<translation type="unfinished">清除所有</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="473"/>
<location filename="qml/page/T_TableView.qml" line="470"/>
<source>Insert a Row</source>
<translation type="unfinished">插入一行</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="478"/>
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
<translation type="unfinished">焦点未获取:请点击表格中的任意一项,作为插入的靶点!</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="508"/>
<source>Avatar</source>
<translation type="unfinished">头像</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="491"/>
<location filename="qml/page/T_TableView.qml" line="526"/>
<source>Address</source>
<translation type="unfinished">地址</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="498"/>
<location filename="qml/page/T_TableView.qml" line="534"/>
<source>Nickname</source>
<translation type="unfinished">昵称</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="505"/>
<location filename="qml/page/T_TableView.qml" line="541"/>
<source>Long String</source>
<translation type="unfinished">长字符串</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="513"/>
<location filename="qml/page/T_TableView.qml" line="549"/>
<source>Options</source>
<translation type="unfinished">操作</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="532"/>
<location filename="qml/page/T_TableView.qml" line="568"/>
<source>&lt;Previous</source>
<translation type="unfinished">&lt;上一页</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="533"/>
<location filename="qml/page/T_TableView.qml" line="569"/>
<source>Next&gt;</source>
<translation type="unfinished">下一页&gt;</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="419"/>
<location filename="qml/page/T_TableView.qml" line="440"/>
<source>Delete Selection</source>
<translation type="unfinished">删除选中</translation>
</message>
<message>
<location filename="qml/page/T_TableView.qml" line="443"/>
<location filename="qml/page/T_TableView.qml" line="464"/>
<source>Add a row of Data</source>
<translation type="unfinished">添加一行数据</translation>
</message>

View File

@ -22,18 +22,37 @@ 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
@ -42,7 +61,20 @@ FluScrollablePage{
FluCheckBox { text: qsTr("Calendar") }
FluCheckBox { text: qsTr("Contacts") }
}
}'
}
FluGroupBox {
title: qsTr("RadioButton Group")
FluRadioButtons {
spacing: 10
disabled: true // 禁用所有FluRadioButton子组件
manuallyDisabled: true // 是否指定每个FluRadioButton上的disabled选项
FluRadioButton { text: qsTr("E-mail") }
FluRadioButton { text: qsTr("Calendar") }
FluRadioButton { text: qsTr("Contacts") }
}
}
`
}
}

View File

@ -9,9 +9,13 @@ FluScrollablePage{
title: qsTr("InfoBar")
property var info1
property var info2
property var info3
FluFrame{
Layout.fillWidth: true
Layout.preferredHeight: 270
Layout.preferredHeight: 350
padding: 10
ColumnLayout{
spacing: 14
@ -49,6 +53,51 @@ 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: {
@ -60,12 +109,17 @@ 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"))'
showSuccess(qsTr("This is an InfoBar in the Success Style"))
var info1 = showInfo(qsTr("This is an 'Info1'"), 0)
info1.close()
`
}
}

View File

@ -13,7 +13,7 @@ FluContentPage{
property var dataSource : []
property int sortType: 0
property bool seletedAll: true
property bool selectedAll: true
property string nameKeyword: ""
onNameKeywordChanged: {
@ -32,11 +32,11 @@ FluContentPage{
onCheckBoxChanged: {
for(var i =0;i< table_view.rows ;i++){
if(false === table_view.getRow(i).checkbox.options.checked){
root.seletedAll = false
root.selectedAll = false
return
}
}
root.seletedAll = true
root.selectedAll = true
}
onSortTypeChanged: {
@ -238,12 +238,12 @@ FluContentPage{
Layout.alignment: Qt.AlignVCenter
}
FluCheckBox{
checked: true === root.seletedAll
checked: true === root.selectedAll
animationEnabled: false
Layout.alignment: Qt.AlignVCenter
clickListener: function(){
root.seletedAll = !root.seletedAll
var checked = root.seletedAll
root.selectedAll = !root.selectedAll
var checked = root.selectedAll
itemModel.display = table_view.customItem(com_column_checbox,{"checked":checked})
for(var i =0;i< table_view.rows ;i++){
var rowData = table_view.getRow(i)
@ -280,6 +280,27 @@ FluContentPage{
}
}
Component{
id:com_auto_suggestbox
FluAutoSuggestBox {
id: textbox
anchors.fill: parent
focus: true
Component.onCompleted: {
var data = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"]
var result = data.map(function(item) {
return {title: item};
});
items = result
textbox.text= String(display)
}
onCommit: {
editTextChaged(textbox.text)
tableView.closeEditor()
}
}
}
Component{
id:com_avatar
Item{
@ -445,6 +466,20 @@ FluContentPage{
table_view.appendRow(genTestObject())
}
}
FluButton{
text: qsTr("Insert a Row")
onClicked: {
if(typeof table_view.current !== 'undefined'){
var newLine = genTestObject()
var currentLine = dataSource.findIndex(obj => obj._key === table_view.current._key)
root.dataSource.splice(currentLine, 0, newLine);
table_view.dataSource = root.dataSource
}else{
showWarning(qsTr("Focus not acquired: Please click any item in the form as the target for insertion!"))
}
}
}
}
}
@ -490,6 +525,7 @@ FluContentPage{
{
title: qsTr("Address"),
dataIndex: 'address',
editDelegate: com_auto_suggestbox,
width:200,
minimumWidth:100,
maximumWidth:250
@ -566,7 +602,7 @@ FluContentPage{
return avatars[randomIndex];
}
return {
checkbox: table_view.customItem(com_checbox,{checked:root.seletedAll}),
checkbox: table_view.customItem(com_checbox,{checked:root.selectedAll}),
avatar:table_view.customItem(com_avatar,{avatar:getAvatar()}),
name: getRandomName(),
age:getRandomAge(),
@ -579,7 +615,7 @@ FluContentPage{
}
}
function loadData(page,count){
root.seletedAll = true
root.selectedAll = true
const dataSource = []
for(var i=0;i<count;i++){
dataSource.push(genTestObject())

View File

@ -15,7 +15,7 @@ FluWindow {
title: "FluentUI"
width: 1000
height: 680
minimumWidth: 1000
minimumWidth: 680
minimumHeight: 200
launchMode: FluWindowType.SingleTask
fitsAppBarWindows: true

View File

@ -73,12 +73,7 @@ void FluFrameless::componentComplete() {
int w = window()->width();
int h = window()->height();
_current = window()->winId();
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
window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint);
if (!_fixSize) {
window()->setFlag(Qt::WindowMaximizeButtonHint);
}
@ -97,14 +92,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_THICKFRAME);
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_CAPTION);
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_THICKFRAME);
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_CAPTION);
}
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
connect(window(), &QQuickWindow::screenChanged, this, [hwnd] {
@ -141,7 +136,6 @@ void FluFrameless::componentComplete() {
const auto uMsg = msg->message;
const auto wParam = msg->wParam;
const auto lParam = msg->lParam;
static QPoint offsetXY;
if (uMsg == WM_WINDOWPOSCHANGING) {
auto *wp = reinterpret_cast<WINDOWPOS *>(lParam);
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) {
@ -152,42 +146,22 @@ 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]);
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);
auto _offsetXY = QPoint(abs(clientRect->left - originalLeft), abs(clientRect->top - originalTop));
if (_offsetXY.x() != 0) {
offsetXY = _offsetXY;
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;
}
if (isMaximum || _isFullScreen()) {
offsetSize = 0;
} else {
offsetSize = 1;
}
if (!isCompositionEnabled()) {
offsetSize = 0;
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
clientRect->top = originalTop + offsetSize;
clientRect->bottom = originalBottom - offsetSize;
clientRect->left = originalLeft + offsetSize;
clientRect->right = originalRight - offsetSize;
#else
if (!isMaximum) {
clientRect->top = originalTop + offsetSize;
clientRect->bottom = originalBottom - offsetSize;
clientRect->left = originalLeft + offsetSize;
clientRect->right = originalRight - offsetSize;
}
#endif
_setMaximizeHovered(false);
*result = WVR_REDRAW;
return true;
@ -244,6 +218,18 @@ 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);
@ -258,35 +244,8 @@ void FluFrameless::componentComplete() {
_setMaximizePressed(false);
return true;
}
} else if (uMsg == WM_NCPAINT) {
*result = FALSE;
} else if (uMsg == WM_ERASEBKGND) {
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);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
minmaxInfo->ptMaxPosition.x = 0;
minmaxInfo->ptMaxPosition.y = 0;
minmaxInfo->ptMaxSize.x = 0;
minmaxInfo->ptMaxSize.y = 0;
return false;
#else
auto pixelRatio = window()->devicePixelRatio();
auto geometry = window()->screen()->availableGeometry();
RECT rect;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
if (!_fixSize) {
minmaxInfo->ptMinTrackSize.x = qRound(window()->minimumWidth() * pixelRatio + offsetXY.x());
minmaxInfo->ptMinTrackSize.y = qRound(window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio);
}
minmaxInfo->ptMaxPosition.x = rect.left - offsetXY.x();
minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x();
minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio) + offsetXY.x() * 2;
minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio) + offsetXY.y() * 2;
return true;
#endif
} else if (uMsg == WM_NCRBUTTONDOWN) {
if (wParam == HTCAPTION) {
_showSystemMenu(QCursor::pos());
@ -384,27 +343,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

@ -7,6 +7,7 @@ FluTextBox{
property var items:[]
property string emptyText: qsTr("No results found")
property int autoSuggestBoxReplacement: FluentIcons.Search
property string textRole: "title"
property var filter: function(item){
if(item.title.indexOf(control.text)!==-1){
return true
@ -25,7 +26,7 @@ FluTextBox{
function handleClick(modelData){
control_popup.visible = false
control.itemClicked(modelData)
control.updateText(modelData.title)
control.updateText(modelData[textRole])
}
function loadData(){
var result = []
@ -48,7 +49,6 @@ FluTextBox{
}
Popup{
id:control_popup
y:control.height
focus: false
padding: 0
enter: Transition {
@ -62,7 +62,7 @@ FluTextBox{
contentItem: FluClip{
radius: [5,5,5,5]
ListView{
id:list_view
id: list_view
anchors.fill: parent
clip: true
boundsBehavior: ListView.StopAtBounds
@ -72,7 +72,7 @@ FluTextBox{
height: visible ? 38 : 0
visible: list_view.count === 0
FluText{
text:emptyText
text: emptyText
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
@ -81,10 +81,10 @@ FluTextBox{
}
}
delegate:FluControl{
id:item_control
id: item_control
height: 38
width: control.width
onClicked:{
onClicked: {
d.handleClick(modelData)
}
background: Rectangle{
@ -103,7 +103,7 @@ FluTextBox{
}
}
contentItem: FluText{
text:modelData.title
text: modelData[textRole]
leftPadding: 10
rightPadding: 10
verticalAlignment : Qt.AlignVCenter
@ -128,7 +128,7 @@ FluTextBox{
if(d.flagVisible){
var pos = control.mapToItem(null, 0, 0)
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
control_popup.y = control.height
control_popup.y = Qt.binding(function(){return control.height})
} else if(pos.y>rect_background.implicitHeight){
control_popup.y = -rect_background.implicitHeight
} else {

View File

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

View File

@ -48,9 +48,6 @@ 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.itemCheckColor
return FluTheme.itemHoverColor
}
return FluTheme.itemNormalColor
}

View File

@ -1,100 +1,112 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import FluentUI 1.0
Item {
signal requestPage(int page,int count)
property string previousText: qsTr("<Previous")
property string nextText: qsTr("Next>")
property int pageCurrent: 0
property int itemCount: 0
property int pageButtonCount: 5
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
property int __itemPerPage: 10
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
id: control
implicitHeight: 40
implicitWidth: content.width
Row{
id: content
height: control.height
spacing: 10
padding: 10
FluToggleButton{
visible: control.pageCount>1
disabled: control.pageCurrent<=1
text:control.previousText
clickListener:function() {
control.calcNewPage(control.pageCurrent-1);
}
}
Row{
spacing: 5
FluToggleButton{
property int pageNumber:1
visible: control.pageCount>0
checked: pageNumber === control.pageCurrent
text:String(pageNumber)
clickListener:function() {
control.calcNewPage(pageNumber);
}
}
FluText{
visible: (control.pageCount>control.pageButtonCount&&
control.pageCurrent>control.__pageButtonHalf)
text: "..."
}
Repeater{
id: button_repeator
model: (control.pageCount<2)?0:(control.pageCount>=control.pageButtonCount)?(control.pageButtonCount-2):(control.pageCount-2)
delegate:FluToggleButton{
property int pageNumber: {
return (control.pageCurrent<=control.__pageButtonHalf)
?(2+index)
:(control.pageCount-control.pageCurrent<=control.pageButtonCount-control.__pageButtonHalf)
?(control.pageCount-button_repeator.count+index)
:(control.pageCurrent+2+index-control.__pageButtonHalf)
}
text:String(pageNumber)
checked: pageNumber === control.pageCurrent
clickListener:function(){
control.calcNewPage(pageNumber);
}
}
}
FluText{
visible: (control.pageCount>control.pageButtonCount&&
control.pageCount-control.pageCurrent>control.pageButtonCount-control.__pageButtonHalf)
text: "..."
}
FluToggleButton{
property int pageNumber:control.pageCount
visible: control.pageCount>1
checked: pageNumber === control.pageCurrent
text:String(pageNumber)
clickListener:function(){
control.calcNewPage(pageNumber);
}
}
}
FluToggleButton{
visible: control.pageCount>1
disabled: control.pageCurrent>=control.pageCount
text:control.nextText
clickListener:function() {
control.calcNewPage(control.pageCurrent+1);
}
}
}
function calcNewPage(page)
{
if(!page)
return
let page_num=Number(page)
if(page_num<1||page_num>control.pageCount||page_num===control.pageCurrent)
return
control.pageCurrent=page_num
control.requestPage(page_num,control.__itemPerPage)
}
}
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import FluentUI 1.0
Item {
signal requestPage(int page, int count)
property string previousText: qsTr("<Previous")
property string nextText: qsTr("Next>")
property int pageCurrent: 0
property int itemCount: 0
property int pageButtonCount: 5
property int pageCount: itemCount > 0 ? Math.ceil(itemCount / __itemPerPage) : 0
property int __itemPerPage: 10
property int __pageButtonHalf: Math.floor(pageButtonCount / 2) + 1
property Component header: null
property Component footer: null
id: control
implicitHeight: 40
implicitWidth: content.width
Row {
id: content
height: control.height
spacing: 10
padding: 10
Loader {
sourceComponent: header
}
FluToggleButton {
visible: control.pageCount > 1
disabled: control.pageCurrent <= 1
text: control.previousText
clickListener: function () {
control.calcNewPage(control.pageCurrent - 1);
}
}
Row {
spacing: 5
FluToggleButton {
property int pageNumber: 1
visible: control.pageCount > 0
checked: pageNumber === control.pageCurrent
text: String(pageNumber)
clickListener: function () {
control.calcNewPage(pageNumber);
}
}
FluText {
visible: (control.pageCount > control.pageButtonCount &&
control.pageCurrent > control.__pageButtonHalf)
text: "..."
}
Repeater {
id: button_repeator
model: (control.pageCount < 2) ? 0 : (control.pageCount >= control.pageButtonCount) ? (control.pageButtonCount - 2) : (control.pageCount - 2)
delegate: FluToggleButton {
property int pageNumber: {
return (control.pageCurrent <= control.__pageButtonHalf)
? (2 + index)
: (control.pageCount - control.pageCurrent <= control.pageButtonCount - control.__pageButtonHalf)
? (control.pageCount - button_repeator.count + index)
: (control.pageCurrent + 2 + index - control.__pageButtonHalf)
}
text: String(pageNumber)
checked: pageNumber === control.pageCurrent
clickListener: function () {
control.calcNewPage(pageNumber);
}
}
}
FluText {
visible: (control.pageCount > control.pageButtonCount &&
control.pageCount - control.pageCurrent > control.pageButtonCount - control.__pageButtonHalf)
text: "..."
}
FluToggleButton {
property int pageNumber: control.pageCount
visible: control.pageCount > 1
checked: pageNumber === control.pageCurrent
text: String(pageNumber)
clickListener: function () {
control.calcNewPage(pageNumber);
}
}
}
FluToggleButton {
visible: control.pageCount > 1
disabled: control.pageCurrent >= control.pageCount
text: control.nextText
clickListener: function () {
control.calcNewPage(control.pageCurrent + 1);
}
}
Loader {
sourceComponent: footer
}
}
function calcNewPage(page) {
if (!page)
return
let page_num = Number(page)
if (page_num < 1 || page_num > control.pageCount || page_num === control.pageCurrent)
return
control.pageCurrent = page_num
control.requestPage(page_num, control.__itemPerPage)
}
}

View File

@ -6,6 +6,8 @@ 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++){
@ -16,6 +18,12 @@ ColumnLayout {
button.checked = true
}
}
onDisabledChanged: {
refreshButtonStatus()
}
onManuallyDisabledChanged: {
refreshButtonStatus()
}
Component.onCompleted: {
for(var i = 0;i<buttons.length;i++){
buttons[i].clickListener = function(){
@ -27,6 +35,12 @@ ColumnLayout {
}
}
}
currentIndex = 0
refreshButtonStatus()
}
function refreshButtonStatus() {
for(var i = 0;i<buttons.length;i++){
if(!manuallyDisabled) buttons[i].enabled = !disabled
}
}
}

View File

@ -196,6 +196,11 @@ Rectangle {
id:com_table_delegate
MouseArea{
id:item_table_mouse
TableView.onPooled: {
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
control.closeEditor()
}
}
property var rowObject : control.getRow(row)
property var itemModel: model
property bool editVisible: {
@ -274,9 +279,9 @@ Rectangle {
if(typeof(display) == "object"){
return
}
loader_edit.display = display
d.editDelegate = d.getEditDelegate(column)
updateEditPosition()
loader_edit.display = display
}
onClicked:
(event)=>{

View File

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

View File

@ -6,6 +6,7 @@ FluTextBox{
property var items:[]
property string emptyText: qsTr("No results found")
property int autoSuggestBoxReplacement: FluentIcons.Search
property string textRole: "title"
property var filter: function(item){
if(item.title.indexOf(control.text)!==-1){
return true
@ -24,7 +25,7 @@ FluTextBox{
function handleClick(modelData){
control_popup.visible = false
control.itemClicked(modelData)
control.updateText(modelData.title)
control.updateText(modelData[textRole])
}
function loadData(){
var result = []
@ -47,7 +48,6 @@ FluTextBox{
}
Popup{
id:control_popup
y:control.height
focus: false
padding: 0
enter: Transition {
@ -61,7 +61,7 @@ FluTextBox{
contentItem: FluClip{
radius: [5,5,5,5]
ListView{
id:list_view
id: list_view
anchors.fill: parent
clip: true
boundsBehavior: ListView.StopAtBounds
@ -71,7 +71,7 @@ FluTextBox{
height: visible ? 38 : 0
visible: list_view.count === 0
FluText{
text:emptyText
text: emptyText
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
@ -80,10 +80,10 @@ FluTextBox{
}
}
delegate:FluControl{
id:item_control
id: item_control
height: 38
width: control.width
onClicked:{
onClicked: {
d.handleClick(modelData)
}
background: Rectangle{
@ -102,7 +102,7 @@ FluTextBox{
}
}
contentItem: FluText{
text:modelData.title
text: modelData[textRole]
leftPadding: 10
rightPadding: 10
verticalAlignment : Qt.AlignVCenter
@ -127,7 +127,7 @@ FluTextBox{
if(d.flagVisible){
var pos = control.mapToItem(null, 0, 0)
if(d.window.height>pos.y+control.height+rect_background.implicitHeight){
control_popup.y = control.height
control_popup.y = Qt.binding(function(){return control.height})
} else if(pos.y>rect_background.implicitHeight){
control_popup.y = -rect_background.implicitHeight
} else {

View File

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

View File

@ -49,9 +49,6 @@ 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.itemCheckColor
return FluTheme.itemHoverColor
}
return FluTheme.itemNormalColor
}

View File

@ -1,100 +1,111 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import FluentUI
Item {
signal requestPage(int page,int count)
property string previousText: qsTr("<Previous")
property string nextText: qsTr("Next>")
property int pageCurrent: 0
property int itemCount: 0
property int pageButtonCount: 5
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
property int __itemPerPage: 10
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
id: control
implicitHeight: 40
implicitWidth: content.width
Row{
id: content
height: control.height
spacing: 10
padding: 10
FluToggleButton{
visible: control.pageCount>1
disabled: control.pageCurrent<=1
text:control.previousText
clickListener:function() {
control.calcNewPage(control.pageCurrent-1);
}
}
Row{
spacing: 5
FluToggleButton{
property int pageNumber:1
visible: control.pageCount>0
checked: pageNumber === control.pageCurrent
text:String(pageNumber)
clickListener:function() {
control.calcNewPage(pageNumber);
}
}
FluText{
visible: (control.pageCount>control.pageButtonCount&&
control.pageCurrent>control.__pageButtonHalf)
text: "..."
}
Repeater{
id: button_repeator
model: (control.pageCount<2)?0:(control.pageCount>=control.pageButtonCount)?(control.pageButtonCount-2):(control.pageCount-2)
delegate:FluToggleButton{
property int pageNumber: {
return (control.pageCurrent<=control.__pageButtonHalf)
?(2+index)
:(control.pageCount-control.pageCurrent<=control.pageButtonCount-control.__pageButtonHalf)
?(control.pageCount-button_repeator.count+index)
:(control.pageCurrent+2+index-control.__pageButtonHalf)
}
text:String(pageNumber)
checked: pageNumber === control.pageCurrent
clickListener:function(){
control.calcNewPage(pageNumber);
}
}
}
FluText{
visible: (control.pageCount>control.pageButtonCount&&
control.pageCount-control.pageCurrent>control.pageButtonCount-control.__pageButtonHalf)
text: "..."
}
FluToggleButton{
property int pageNumber:control.pageCount
visible: control.pageCount>1
checked: pageNumber === control.pageCurrent
text:String(pageNumber)
clickListener:function(){
control.calcNewPage(pageNumber);
}
}
}
FluToggleButton{
visible: control.pageCount>1
disabled: control.pageCurrent>=control.pageCount
text:control.nextText
clickListener:function() {
control.calcNewPage(control.pageCurrent+1);
}
}
}
function calcNewPage(page)
{
if(!page)
return
let page_num=Number(page)
if(page_num<1||page_num>control.pageCount||page_num===control.pageCurrent)
return
control.pageCurrent=page_num
control.requestPage(page_num,control.__itemPerPage)
}
}
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import FluentUI 1.0
Item {
signal requestPage(int page, int count)
property string previousText: qsTr("<Previous")
property string nextText: qsTr("Next>")
property int pageCurrent: 0
property int itemCount: 0
property int pageButtonCount: 5
property int pageCount: itemCount > 0 ? Math.ceil(itemCount / __itemPerPage) : 0
property int __itemPerPage: 10
property int __pageButtonHalf: Math.floor(pageButtonCount / 2) + 1
property Component header: null
property Component footer: null
id: control
implicitHeight: 40
implicitWidth: content.width
Row {
id: content
height: control.height
spacing: 10
padding: 10
Loader {
sourceComponent: header
}
FluToggleButton {
visible: control.pageCount > 1
disabled: control.pageCurrent <= 1
text: control.previousText
clickListener: function () {
control.calcNewPage(control.pageCurrent - 1);
}
}
Row {
spacing: 5
FluToggleButton {
property int pageNumber: 1
visible: control.pageCount > 0
checked: pageNumber === control.pageCurrent
text: String(pageNumber)
clickListener: function () {
control.calcNewPage(pageNumber);
}
}
FluText {
visible: (control.pageCount > control.pageButtonCount &&
control.pageCurrent > control.__pageButtonHalf)
text: "..."
}
Repeater {
id: button_repeator
model: (control.pageCount < 2) ? 0 : (control.pageCount >= control.pageButtonCount) ? (control.pageButtonCount - 2) : (control.pageCount - 2)
delegate: FluToggleButton {
property int pageNumber: {
return (control.pageCurrent <= control.__pageButtonHalf)
? (2 + index)
: (control.pageCount - control.pageCurrent <= control.pageButtonCount - control.__pageButtonHalf)
? (control.pageCount - button_repeator.count + index)
: (control.pageCurrent + 2 + index - control.__pageButtonHalf)
}
text: String(pageNumber)
checked: pageNumber === control.pageCurrent
clickListener: function () {
control.calcNewPage(pageNumber);
}
}
}
FluText {
visible: (control.pageCount > control.pageButtonCount &&
control.pageCount - control.pageCurrent > control.pageButtonCount - control.__pageButtonHalf)
text: "..."
}
FluToggleButton {
property int pageNumber: control.pageCount
visible: control.pageCount > 1
checked: pageNumber === control.pageCurrent
text: String(pageNumber)
clickListener: function () {
control.calcNewPage(pageNumber);
}
}
}
FluToggleButton {
visible: control.pageCount > 1
disabled: control.pageCurrent >= control.pageCount
text: control.nextText
clickListener: function () {
control.calcNewPage(control.pageCurrent + 1);
}
}
Loader {
sourceComponent: footer
}
}
function calcNewPage(page) {
if (!page)
return
let page_num = Number(page)
if (page_num < 1 || page_num > control.pageCount || page_num === control.pageCurrent)
return
control.pageCurrent = page_num
control.requestPage(page_num, control.__itemPerPage)
}
}

View File

@ -7,6 +7,8 @@ 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++){
@ -17,6 +19,12 @@ ColumnLayout {
button.checked = true
}
}
onDisabledChanged: {
refreshButtonStatus()
}
onManuallyDisabledChanged: {
refreshButtonStatus()
}
Component.onCompleted: {
for(var i = 0;i<buttons.length;i++){
buttons[i].clickListener = function(){
@ -28,6 +36,12 @@ ColumnLayout {
}
}
}
currentIndex = 0
refreshButtonStatus()
}
function refreshButtonStatus() {
for(var i = 0;i<buttons.length;i++){
if(!manuallyDisabled) buttons[i].enabled = !disabled
}
}
}

View File

@ -56,7 +56,9 @@ QtObject {
var launchMode = win.launchMode
if(launchMode === 1){
win.argument = argument
win.show()
if(!win.visible){
win.visible = true
}
win.raise()
win.requestActivate()
return

View File

@ -196,6 +196,11 @@ Rectangle {
id:com_table_delegate
MouseArea{
id:item_table_mouse
TableView.onPooled: {
if(d.editPosition && d.editPosition.row === row && d.editPosition.column === column){
control.closeEditor()
}
}
property var rowObject : control.getRow(row)
property var itemModel: model
property bool editVisible: {
@ -274,9 +279,9 @@ Rectangle {
if(typeof(display) == "object"){
return
}
loader_edit.display = display
d.editDelegate = d.getEditDelegate(column)
updateEditPosition()
loader_edit.display = display
}
onClicked:
(event)=>{

View File

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