update
parent
52174b7e24
commit
5f2f127623
|
@ -30,17 +30,14 @@ FluScrollablePage{
|
|||
Repeater{
|
||||
model: [{title:"System",mode:FluDarkMode.System},{title:"Light",mode:FluDarkMode.Light},{title:"Dark",mode:FluDarkMode.Dark}]
|
||||
delegate: FluRadioButton{
|
||||
selected : FluTheme.darkMode === modelData.mode
|
||||
checked : FluTheme.darkMode === modelData.mode
|
||||
text:modelData.title
|
||||
onClicked:{
|
||||
clickListener:function(){
|
||||
FluTheme.darkMode = modelData.mode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FluArea{
|
||||
|
@ -63,10 +60,10 @@ FluScrollablePage{
|
|||
}
|
||||
Repeater{
|
||||
model: [{title:"Open",mode:FluNavigationView.Open},{title:"Compact",mode:FluNavigationView.Compact},{title:"Minimal",mode:FluNavigationView.Minimal},{title:"Auto",mode:FluNavigationView.Auto}]
|
||||
delegate: FluRadioButton{
|
||||
selected : MainEvent.displayMode===modelData.mode
|
||||
delegate: FluRadioButton{
|
||||
checked : MainEvent.displayMode===modelData.mode
|
||||
text:modelData.title
|
||||
onClicked:{
|
||||
clickListener:function(){
|
||||
MainEvent.displayMode = modelData.mode
|
||||
}
|
||||
}
|
||||
|
@ -97,10 +94,10 @@ FluScrollablePage{
|
|||
spacing: 5
|
||||
Repeater{
|
||||
model: ["Zh","En"]
|
||||
delegate: FluRadioButton{
|
||||
selected : appInfo.lang.objectName === modelData
|
||||
delegate: FluRadioButton{
|
||||
checked: appInfo.lang.objectName === modelData
|
||||
text:modelData
|
||||
onClicked:{
|
||||
clickListener:function(){
|
||||
appInfo.changeLang(modelData)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,4 +63,6 @@ bool FluTools::isWin(){
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void FluTools::setQuitOnLastWindowClosed(bool val){
|
||||
qApp->setQuitOnLastWindowClosed(val);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ public:
|
|||
|
||||
Q_INVOKABLE bool isWin();
|
||||
|
||||
Q_INVOKABLE void setQuitOnLastWindowClosed(bool val);
|
||||
|
||||
};
|
||||
|
||||
#endif // FLUTOOLS_H
|
||||
|
|
|
@ -8,6 +8,25 @@ Button {
|
|||
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
||||
property color textColor: {
|
||||
if(FluTheme.dark){
|
||||
if(disabled){
|
||||
return Qt.rgba(131/255,131/255,131/255,1)
|
||||
}
|
||||
if(pressed){
|
||||
return Qt.rgba(162/255,162/255,162/255,1)
|
||||
}
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}else{
|
||||
if(disabled){
|
||||
return Qt.rgba(160/255,160/255,160/255,1)
|
||||
}
|
||||
if(pressed){
|
||||
return Qt.rgba(96/255,96/255,96/255,1)
|
||||
}
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}
|
||||
}
|
||||
id: control
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
|
@ -36,24 +55,6 @@ Button {
|
|||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font: control.font
|
||||
color: {
|
||||
if(FluTheme.dark){
|
||||
if(disabled){
|
||||
return Qt.rgba(131/255,131/255,131/255,1)
|
||||
}
|
||||
if(pressed){
|
||||
return Qt.rgba(162/255,162/255,162/255,1)
|
||||
}
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}else{
|
||||
if(disabled){
|
||||
return Qt.rgba(160/255,160/255,160/255,1)
|
||||
}
|
||||
if(pressed){
|
||||
return Qt.rgba(96/255,96/255,96/255,1)
|
||||
}
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}
|
||||
}
|
||||
color: control.textColor
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,25 @@ Button {
|
|||
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
||||
property color textColor: {
|
||||
if(FluTheme.dark){
|
||||
if(disabled){
|
||||
return Qt.rgba(131/255,131/255,131/255,1)
|
||||
}
|
||||
if(pressed){
|
||||
return Qt.rgba(162/255,162/255,162/255,1)
|
||||
}
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}else{
|
||||
if(disabled){
|
||||
return Qt.rgba(160/255,160/255,160/255,1)
|
||||
}
|
||||
if(pressed){
|
||||
return Qt.rgba(96/255,96/255,96/255,1)
|
||||
}
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}
|
||||
}
|
||||
property var window : Window.window
|
||||
property alias items: menu.content
|
||||
id: control
|
||||
|
@ -49,25 +68,7 @@ Button {
|
|||
text: control.text
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: {
|
||||
if(FluTheme.dark){
|
||||
if(disabled){
|
||||
return Qt.rgba(131/255,131/255,131/255,1)
|
||||
}
|
||||
if(pressed){
|
||||
return Qt.rgba(162/255,162/255,162/255,1)
|
||||
}
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}else{
|
||||
if(disabled){
|
||||
return Qt.rgba(160/255,160/255,160/255,1)
|
||||
}
|
||||
if(pressed){
|
||||
return Qt.rgba(96/255,96/255,96/255,1)
|
||||
}
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}
|
||||
}
|
||||
color: control.textColor
|
||||
}
|
||||
onClicked: {
|
||||
if(items && menu.getContainerCount()!==0){
|
||||
|
|
|
@ -9,6 +9,16 @@ Button {
|
|||
property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.1) : Qt.lighter(normalColor,1.1)
|
||||
property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2)
|
||||
property color textColor: {
|
||||
if(FluTheme.dark){
|
||||
if(disabled){
|
||||
return Qt.rgba(173/255,173/255,173/255,1)
|
||||
}
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}else{
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}
|
||||
id: control
|
||||
enabled: !disabled
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
|
@ -38,15 +48,6 @@ Button {
|
|||
font: control.font
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: {
|
||||
if(FluTheme.dark){
|
||||
if(disabled){
|
||||
return Qt.rgba(173/255,173/255,173/255,1)
|
||||
}
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}else{
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}
|
||||
color: control.textColor
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,8 +352,6 @@ Item {
|
|||
if(model.tapFunc){
|
||||
model.tapFunc()
|
||||
}else{
|
||||
model.tap()
|
||||
d.stackItems.push(model)
|
||||
nav_list.currentIndex = nav_list.count-layout_footer.count+idx
|
||||
layout_footer.currentIndex = idx
|
||||
if(d.isMinimal || d.isCompact){
|
||||
|
@ -769,6 +767,15 @@ Item {
|
|||
return footerItems.children
|
||||
}
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
if(d.enableStack){
|
||||
var item = model[currentIndex]
|
||||
if(item instanceof FluPaneItem){
|
||||
item.tap()
|
||||
d.stackItems.push(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
highlightMoveDuration: 150
|
||||
highlight: Item{
|
||||
clip: true
|
||||
|
|
|
@ -11,6 +11,7 @@ Button {
|
|||
property color normalColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1)
|
||||
property color hoverColor: checked ? FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1)
|
||||
property color disableColor: checked ? FluTheme.dark ? Qt.rgba(159/255,159/255,159/255,1) : Qt.rgba(159/255,159/255,159/255,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1)
|
||||
property alias textColor: btn_text.textColor
|
||||
property var clickListener : function(){
|
||||
checked = !checked
|
||||
}
|
||||
|
@ -34,7 +35,7 @@ Button {
|
|||
radius: 10
|
||||
border.width: {
|
||||
if(checked&&disabled){
|
||||
return 3
|
||||
return 4
|
||||
}
|
||||
if(pressed){
|
||||
if(checked){
|
||||
|
@ -44,7 +45,7 @@ Button {
|
|||
}
|
||||
if(hovered){
|
||||
if(checked){
|
||||
return 3
|
||||
return 4
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
@ -74,6 +75,7 @@ Button {
|
|||
}
|
||||
}
|
||||
FluText{
|
||||
id:btn_text
|
||||
text: control.text
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
font: control.font
|
||||
|
|
|
@ -1,235 +0,0 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
property var columns : []
|
||||
property var dataSource : []
|
||||
property int pageCurrent: 1
|
||||
property int itemCount: 1000
|
||||
property int pageCount: 10
|
||||
property int itemHeight: 56
|
||||
property bool pageVisible: true
|
||||
signal requestPage(int page,int count)
|
||||
id:control
|
||||
implicitHeight: layout_table.height
|
||||
QtObject{
|
||||
id:d
|
||||
property int coumnsWidth: parent.width
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
preventStealing: true
|
||||
}
|
||||
ListModel{
|
||||
id:model_coumns
|
||||
}
|
||||
ListModel{
|
||||
id:model_data_source
|
||||
}
|
||||
onColumnsChanged: {
|
||||
model_coumns.clear()
|
||||
model_coumns.append(columns)
|
||||
var w = 0
|
||||
for(var i=0;i<model_coumns.count;i++){
|
||||
var item = model_coumns.get(i)
|
||||
w=w+item.width
|
||||
}
|
||||
d.coumnsWidth = w
|
||||
}
|
||||
onDataSourceChanged: {
|
||||
model_data_source.clear()
|
||||
model_data_source.append(dataSource)
|
||||
}
|
||||
Flickable{
|
||||
id:layout_flickable
|
||||
height: layout_table.height
|
||||
anchors{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
contentWidth: layout_table.width
|
||||
clip:true
|
||||
ScrollBar.horizontal: FluScrollBar {
|
||||
}
|
||||
Rectangle{
|
||||
anchors.fill: layout_table
|
||||
radius: 5
|
||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||
}
|
||||
ListView{
|
||||
id:layout_table
|
||||
height: contentHeight
|
||||
width: Math.max(layout_flickable.width,d.coumnsWidth)
|
||||
clip:true
|
||||
interactive: false
|
||||
header: FluRectangle{
|
||||
id:layout_coumns
|
||||
height: control.itemHeight
|
||||
width: parent.width
|
||||
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||
radius: [5,5,0,0]
|
||||
Row{
|
||||
id:list_coumns
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
Repeater{
|
||||
model: model_coumns
|
||||
delegate: Item{
|
||||
height: list_coumns.height
|
||||
width: model.width
|
||||
FluText{
|
||||
text:model.title
|
||||
wrapMode: Text.WordWrap
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 14
|
||||
}
|
||||
font: FluTextStyle.BodyStrong
|
||||
}
|
||||
FluDivider{
|
||||
width: 1
|
||||
height: 40
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: index !== model_coumns.count-1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
footer: Item{
|
||||
height: pageVisible ? 50 : 0
|
||||
clip: true
|
||||
width: layout_table.width
|
||||
FluPagination{
|
||||
id:pagination
|
||||
height: 40
|
||||
pageCurrent: control.pageCurrent
|
||||
onPageCurrentChanged: control.pageCurrent = pageCurrent
|
||||
itemCount: control.itemCount
|
||||
pageCount: control.pageCount
|
||||
onRequestPage:
|
||||
(page,count)=> {
|
||||
control.requestPage(page,count)
|
||||
}
|
||||
anchors{
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
Connections{
|
||||
target: control
|
||||
function onPageCurrentChanged(){
|
||||
if (control.pageCurrent!==pagination.pageCurrent)
|
||||
{
|
||||
pagination.calcNewPage(control.pageCurrent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
model:model_data_source
|
||||
delegate: Control{
|
||||
id:item_control
|
||||
height: table_row.maxHeight
|
||||
width: layout_table.width
|
||||
property var model_values : getObjectValues(index)
|
||||
property var itemObject: getObject(index)
|
||||
property var listModel: model
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color: {
|
||||
if(item_control.hovered){
|
||||
return FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
}
|
||||
return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}
|
||||
Row{
|
||||
id: table_row
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
property int maxHeight: itemHeight
|
||||
Repeater{
|
||||
model: model_values
|
||||
delegate:Item{
|
||||
height: table_row.maxHeight
|
||||
width: modelData.width
|
||||
Loader{
|
||||
property var model : modelData
|
||||
property var dataModel : listModel
|
||||
property var dataObject : itemObject
|
||||
anchors.fill: parent
|
||||
sourceComponent: {
|
||||
if(model.itemData instanceof Component){
|
||||
return model.itemData
|
||||
}
|
||||
return com_text
|
||||
}
|
||||
onHeightChanged:
|
||||
{
|
||||
table_row.maxHeight = Math.max(table_row.maxHeight,height,itemHeight)
|
||||
parent.height = table_row.maxHeight
|
||||
table_row.parent.height = table_row.maxHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FluDivider{
|
||||
width: parent.width
|
||||
height: 1
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component{
|
||||
id:com_text
|
||||
Item{
|
||||
FluCopyableText{
|
||||
id:table_value
|
||||
text:String(model.itemData)
|
||||
width: Math.min(parent.width - 14,implicitWidth)
|
||||
wrapMode: Text.WordWrap
|
||||
onImplicitHeightChanged: parent.parent.parent.height = Math.max(implicitHeight + 20,itemHeight)
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 14
|
||||
}
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.IBeamCursor
|
||||
acceptedButtons: Qt.NoButton
|
||||
}
|
||||
FluTooltip{
|
||||
visible: item_mouse.containsMouse
|
||||
text:parent.text
|
||||
delay: 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function getObject(index){
|
||||
return model_data_source.get(index)
|
||||
}
|
||||
function getObjectValues(index) {
|
||||
var obj = model_data_source.get(index)
|
||||
if(!obj)
|
||||
return
|
||||
var data = []
|
||||
for(var i=0;i<model_coumns.count;i++){
|
||||
var item = model_coumns.get(i)
|
||||
data.push({itemData:obj[item.dataIndex],width:item.width})
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,15 @@ Button {
|
|||
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.3) : Qt.lighter(normalColor,1.3)
|
||||
property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
property bool textBold: true
|
||||
property color textColor: {
|
||||
if(disabled){
|
||||
return disableColor
|
||||
}
|
||||
if(pressed){
|
||||
return pressedColor
|
||||
}
|
||||
return hovered ? hoverColor :normalColor
|
||||
}
|
||||
id: control
|
||||
topPadding:0
|
||||
bottomPadding:0
|
||||
|
@ -25,20 +34,11 @@ Button {
|
|||
}
|
||||
}
|
||||
contentItem: FluText {
|
||||
id:btn_text
|
||||
text: control.text
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.bold: control.textBold
|
||||
color: {
|
||||
color:{
|
||||
if(disabled){
|
||||
return disableColor
|
||||
}
|
||||
if(pressed){
|
||||
return pressedColor
|
||||
}
|
||||
return hovered ? hoverColor :normalColor
|
||||
}
|
||||
}
|
||||
color: control.textColor
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue