This commit is contained in:
朱子楚\zhuzi 2024-03-11 18:55:33 +08:00
parent 38a277801d
commit 463aa38bc2
31 changed files with 506 additions and 313 deletions

View File

@ -47,39 +47,39 @@
<name>FluentInitalizrWindow</name> <name>FluentInitalizrWindow</name>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="11"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="11"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="31"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="32"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="11"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="11"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="31"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="32"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initalizr</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="52"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="53"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="52"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="53"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="60"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="61"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="60"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="61"/>
<source>Create In</source> <source>Create In</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="67"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="65"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="67"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="65"/>
<source>Browse</source> <source>Browse</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="98"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="95"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="98"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="95"/>
<source>Cancel</source> <source>Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="106"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="103"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="106"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="103"/>
<source>Create</source> <source>Create</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -102,22 +102,22 @@
<context> <context>
<name>InitalizrHelper</name> <name>InitalizrHelper</name>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="48"/> <location filename="src/helper/InitalizrHelper.cpp" line="73"/>
<source>The name cannot be empty</source> <source>The name cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="52"/> <location filename="src/helper/InitalizrHelper.cpp" line="77"/>
<source>The creation path cannot be empty</source> <source>The creation path cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="57"/> <location filename="src/helper/InitalizrHelper.cpp" line="82"/>
<source>The path does not exist</source> <source>The path does not exist</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="63"/> <location filename="src/helper/InitalizrHelper.cpp" line="88"/>
<source>%1 folder already exists</source> <source>%1 folder already exists</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -47,39 +47,39 @@
<name>FluentInitalizrWindow</name> <name>FluentInitalizrWindow</name>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="11"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="11"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="31"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="32"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="11"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="11"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="31"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="32"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initalizr</source>
<translation type="unfinished">FluentUI脚手架</translation> <translation type="unfinished">FluentUI脚手架</translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="52"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="53"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="52"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="53"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="60"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="61"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="60"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="61"/>
<source>Create In</source> <source>Create In</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="67"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="65"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="67"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="65"/>
<source>Browse</source> <source>Browse</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="98"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="95"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="98"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="95"/>
<source>Cancel</source> <source>Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="106"/> <location filename="qml/window/FluentInitalizrWindow.qml" line="103"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="106"/> <location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="103"/>
<source>Create</source> <source>Create</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -102,22 +102,22 @@
<context> <context>
<name>InitalizrHelper</name> <name>InitalizrHelper</name>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="48"/> <location filename="src/helper/InitalizrHelper.cpp" line="73"/>
<source>The name cannot be empty</source> <source>The name cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="52"/> <location filename="src/helper/InitalizrHelper.cpp" line="77"/>
<source>The creation path cannot be empty</source> <source>The creation path cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="57"/> <location filename="src/helper/InitalizrHelper.cpp" line="82"/>
<source>The path does not exist</source> <source>The path does not exist</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="63"/> <location filename="src/helper/InitalizrHelper.cpp" line="88"/>
<source>%1 folder already exists</source> <source>%1 folder already exists</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -60,9 +60,6 @@ FluWindow {
width: 300 width: 300
placeholderText: qsTr("Create In") placeholderText: qsTr("Create In")
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Component.onCompleted: {
text = FluTools.toLocalPath(StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0])
}
} }
FluButton{ FluButton{
text:qsTr("Browse") text:qsTr("Browse")
@ -76,7 +73,6 @@ FluWindow {
FolderDialog{ FolderDialog{
id:folder_dialog id:folder_dialog
folder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
onAccepted: { onAccepted: {
text_box_path.text = FluTools.toLocalPath(currentFolder) text_box_path.text = FluTools.toLocalPath(currentFolder)
} }

View File

@ -245,7 +245,7 @@ FluWindow {
id:com_reveal id:com_reveal
CircularReveal{ CircularReveal{
id:reveal id:reveal
target:window.layoutContainer() target:window.contentItem
anchors.fill: parent anchors.fill: parent
onAnimationFinished:{ onAnimationFinished:{
// //
@ -274,7 +274,7 @@ FluWindow {
return return
} }
loader_reveal.sourceComponent = com_reveal loader_reveal.sourceComponent = com_reveal
var target = window.layoutContainer() var target = window.contentItem
var pos = button.mapToItem(target,0,0) var pos = button.mapToItem(target,0,0)
var mouseX = pos.x var mouseX = pos.x
var mouseY = pos.y var mouseY = pos.y

View File

@ -60,9 +60,6 @@ FluWindow {
width: 300 width: 300
placeholderText: qsTr("Create In") placeholderText: qsTr("Create In")
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Component.onCompleted: {
text = FluTools.toLocalPath(StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0])
}
} }
FluButton{ FluButton{
text:qsTr("Browse") text:qsTr("Browse")
@ -76,7 +73,6 @@ FluWindow {
FolderDialog{ FolderDialog{
id:folder_dialog id:folder_dialog
folder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
onAccepted: { onAccepted: {
text_box_path.text = FluTools.toLocalPath(currentFolder) text_box_path.text = FluTools.toLocalPath(currentFolder)
} }

View File

@ -245,7 +245,7 @@ FluWindow {
id: com_reveal id: com_reveal
CircularReveal{ CircularReveal{
id: reveal id: reveal
target:window.layoutContainer() target: window.contentItem
anchors.fill: parent anchors.fill: parent
onAnimationFinished:{ onAnimationFinished:{
// //
@ -274,7 +274,7 @@ FluWindow {
return return
} }
loader_reveal.sourceComponent = com_reveal loader_reveal.sourceComponent = com_reveal
var target = window.layoutContainer() var target = window.contentItem
var pos = button.mapToItem(target,0,0) var pos = button.mapToItem(target,0,0)
var mouseX = pos.x var mouseX = pos.x
var mouseY = pos.y var mouseY = pos.y

View File

@ -19,6 +19,7 @@ void TranslateHelper::init(QQmlEngine* engine){
_translator = new QTranslator(this); _translator = new QTranslator(this);
qApp->installTranslator(_translator); qApp->installTranslator(_translator);
QString translatorPath = QGuiApplication::applicationDirPath()+"/i18n"; QString translatorPath = QGuiApplication::applicationDirPath()+"/i18n";
_translator->load(QString::fromStdString("%1/example_%2.qm").arg(translatorPath,_current)); if(_translator->load(QString::fromStdString("%1/example_%2.qm").arg(translatorPath,_current))){
_engine->retranslate(); _engine->retranslate();
} }
}

View File

@ -13,7 +13,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# #
add_definitions(-DFLUENTUI_VERSION=1,6,9,0) add_definitions(-DFLUENTUI_VERSION=1,7,0,0)
if (FLUENTUI_BUILD_STATIC_LIB) if (FLUENTUI_BUILD_STATIC_LIB)
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB) add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)

View File

@ -4,12 +4,13 @@ import QtQuick.Window 2.15
import FluentUI 1.0 import FluentUI 1.0
Rectangle { Rectangle {
default property alias content: container.data default property list<QtObject> contentData
property int paddings : 0 property int paddings : 0
property int leftPadding : 0 property int leftPadding : 0
property int rightPadding : 0 property int rightPadding : 0
property int topPadding : 0 property int topPadding : 0
property int bottomPadding : 0 property int bottomPadding : 0
id:control
radius: 4 radius: 4
color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
@ -17,7 +18,7 @@ Rectangle {
implicitHeight: height implicitHeight: height
implicitWidth: width implicitWidth: width
Item { Item {
id: container data: control.contentData
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Math.max(paddings,leftPadding) anchors.leftMargin: Math.max(paddings,leftPadding)
anchors.rightMargin: Math.max(paddings,rightPadding) anchors.rightMargin: Math.max(paddings,rightPadding)

View File

@ -2,26 +2,33 @@ import QtQuick 2.15
import QtQuick.Window 2.15 import QtQuick.Window 2.15
import FluentUI 1.0 import FluentUI 1.0
Item { Item {
id:control id:control
property int orientation: Qt.Horizontal property int orientation: Qt.Horizontal
property int spacing:0 property int spacing:0
property int size: 1 property int size: 1
QtObject{ QtObject{
id:d id:d
property bool isVertical : orientation === Qt.Vertical property bool isVertical : orientation === Qt.Vertical
property int parentHeight: {
if(control.parent){
return control.parent.height
} }
return control.height
width: d.isVertical ? spacing*2+size : parent.width }
height: d.isVertical ? parent.height : spacing*2+size property int parentWidth: {
if(control.parent){
return control.parent.width
}
return control.width
}
}
width: d.isVertical ? spacing*2+size : d.parentWidth
height: d.isVertical ? d.parentHeight : spacing*2+size
FluRectangle{ FluRectangle{
color: FluTheme.dividerColor color: FluTheme.dividerColor
width: d.isVertical ? size : parent.width width: d.isVertical ? size : d.parentWidth
height: d.isVertical ? parent.height : size height: d.isVertical ? d.parentHeight : size
anchors.centerIn: parent anchors.centerIn: parent
} }
} }

View File

@ -13,7 +13,4 @@ Text {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: iconColor color: iconColor
text: (String.fromCharCode(iconSource).toString(16)) text: (String.fromCharCode(iconSource).toString(16))
FontLoader{
source: "../Font/Segoe_Fluent_Icons.ttf"
}
} }

View File

@ -5,12 +5,12 @@ import QtQuick.Window 2.15
import FluentUI 1.0 import FluentUI 1.0
Popup { Popup {
id: popup id: control
padding: 0 padding: 0
modal:true modal:true
parent: Overlay.overlay parent: Overlay.overlay
x: Math.round((parent.width - width) / 2) x: Math.round((d.parentWidth - width) / 2)
y: Math.round((parent.height - height) / 2) y: Math.round((d.parentHeight - height) / 2)
closePolicy: Popup.CloseOnEscape closePolicy: Popup.CloseOnEscape
enter: Transition { enter: Transition {
NumberAnimation { NumberAnimation {
@ -20,7 +20,7 @@ Popup {
to:1 to:1
} }
} }
height:Math.min(implicitHeight,parent.height) height:Math.min(implicitHeight,d.parentHeight)
exit:Transition { exit:Transition {
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
@ -36,5 +36,19 @@ Popup {
radius: 5 radius: 5
} }
} }
QtObject{
id:d
property int parentHeight: {
if(control.parent){
return control.parent.height
}
return control.height
}
property int parentWidth: {
if(control.parent){
return control.parent.width
}
return control.width
}
}
} }

View File

@ -11,7 +11,10 @@ ColumnLayout {
for(var i = 0;i<buttons.length;i++){ for(var i = 0;i<buttons.length;i++){
buttons[i].checked = false buttons[i].checked = false
} }
buttons[currentIndex].checked = true var button = buttons[currentIndex]
if(button){
button.checked = true
}
} }
Component.onCompleted: { Component.onCompleted: {
for(var i = 0;i<buttons.length;i++){ for(var i = 0;i<buttons.length;i++){

View File

@ -58,6 +58,7 @@ Rectangle {
} }
TableModel { TableModel {
id:table_model id:table_model
TableModelColumn {}
} }
FluTableSortProxyModel{ FluTableSortProxyModel{
id:table_sort_model id:table_sort_model
@ -433,12 +434,14 @@ Rectangle {
right: layout_mouse_table.right right: layout_mouse_table.right
} }
} }
TableView { TableModel{
id: header_horizontal
model: TableModel{
id:header_model id:header_model
rows: d.header_rows rows: d.header_rows
TableModelColumn {}
} }
TableView {
id: header_horizontal
model: header_model
syncDirection: Qt.Horizontal syncDirection: Qt.Horizontal
anchors{ anchors{
left: header_vertical.right left: header_vertical.right
@ -597,6 +600,10 @@ Rectangle {
} }
} }
} }
TableModel{
id:model_rows
TableModelColumn { display: "rowIndex" }
}
TableView { TableView {
id: header_vertical id: header_vertical
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
@ -608,10 +615,7 @@ Rectangle {
syncDirection: Qt.Vertical syncDirection: Qt.Vertical
syncView: table_view syncView: table_view
clip: true clip: true
model: TableModel{ model: model_rows
id:model_rows
TableModelColumn { display: "rowIndex" }
}
Connections{ Connections{
target: table_model target: table_model
function onRowCountChanged(){ function onRowCountChanged(){

View File

@ -11,20 +11,20 @@ FluClip{
radius: 4 radius: 4
anchors.fill: parent anchors.fill: parent
color: { color: {
if(inputItem.disabled){ if(inputItem && inputItem.disabled){
return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1) return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
} }
if(inputItem.activeFocus){ if(inputItem && inputItem.activeFocus){
return FluTheme.dark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1) return FluTheme.dark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1)
} }
if(inputItem.hovered){ if(inputItem && inputItem.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(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) return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
} }
border.width: control.borderWidth border.width: control.borderWidth
border.color: { border.color: {
if(inputItem.disabled){ if(inputItem && inputItem.disabled){
return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(237/255,237/255,237/255,1) return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(237/255,237/255,237/255,1)
} }
return FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1) return FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1)
@ -32,11 +32,11 @@ FluClip{
} }
Rectangle{ Rectangle{
width: parent.width width: parent.width
height: inputItem.activeFocus ? 2 : 1 height: inputItem && inputItem.activeFocus ? 2 : 1
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: !inputItem.disabled visible: !(inputItem && inputItem.disabled)
color: { color: {
if(inputItem.activeFocus){ if(inputItem && inputItem.activeFocus){
return FluTheme.primaryColor return FluTheme.primaryColor
} }
if(FluTheme.dark){ if(FluTheme.dark){

View File

@ -13,10 +13,17 @@ FluMenu{
width: 120 width: 120
focus: false focus: false
onVisibleChanged: { onVisibleChanged: {
if(inputItem){
inputItem.forceActiveFocus() inputItem.forceActiveFocus()
} }
}
Connections{ Connections{
target: inputItem target: {
if(inputItem){
return inputItem
}
return null
}
function onTextChanged() { function onTextChanged() {
menu.close() menu.close()
} }
@ -32,7 +39,12 @@ FluMenu{
focus: false focus: false
padding: 0 padding: 0
height: visible ? 36 : 0 height: visible ? 36 : 0
visible: inputItem.selectedText !== "" && !inputItem.readOnly visible: {
if(inputItem){
return inputItem.selectedText !== "" && !inputItem.readOnly
}
return false
}
onClicked: { onClicked: {
inputItem.cut() inputItem.cut()
menu.close() menu.close()
@ -44,7 +56,12 @@ FluMenu{
focus: false focus: false
padding: 0 padding: 0
height: visible ? 36 : 0 height: visible ? 36 : 0
visible: inputItem.selectedText !== "" visible: {
if(inputItem){
return inputItem.selectedText !== ""
}
return false
}
onClicked: { onClicked: {
inputItem.copy() inputItem.copy()
menu.close() menu.close()
@ -55,7 +72,12 @@ FluMenu{
text:pasteText text:pasteText
focus: false focus: false
padding: 0 padding: 0
visible: !inputItem.readOnly visible: {
if(inputItem){
return !inputItem.readOnly
}
return false
}
height: visible ? 36 : 0 height: visible ? 36 : 0
onClicked: { onClicked: {
inputItem.paste() inputItem.paste()
@ -68,7 +90,12 @@ FluMenu{
focus: false focus: false
padding: 0 padding: 0
height: visible ? 36 : 0 height: visible ? 36 : 0
visible: inputItem.text !== "" visible: {
if(inputItem){
return inputItem.text !== ""
}
return false
}
onClicked: { onClicked: {
inputItem.selectAll() inputItem.selectAll()
menu.close() menu.close()

View File

@ -15,6 +15,9 @@ Item{
property bool isRight: control.mode === FluTimelineType.Right property bool isRight: control.mode === FluTimelineType.Right
property bool isAlternate: control.mode === FluTimelineType.Alternate property bool isAlternate: control.mode === FluTimelineType.Alternate
property bool hasLable: { property bool hasLable: {
if(!model){
return false
}
for(var i=0;i<model.count;i++){ for(var i=0;i<model.count;i++){
var lable = model.get(i).lable var lable = model.get(i).lable
if(lable !== undefined && undefined !== ""){ if(lable !== undefined && undefined !== ""){

View File

@ -16,8 +16,8 @@ Popup{
id:control id:control
padding: 0 padding: 0
parent: Overlay.overlay parent: Overlay.overlay
width: parent.width width: d.parentWidth
height: parent.height height: d.parentHeight
background: Item{} background: Item{}
contentItem: Item{} contentItem: Item{}
onVisibleChanged: { onVisibleChanged: {
@ -55,7 +55,24 @@ Popup{
property var window: Window.window property var window: Window.window
property point pos: Qt.point(0,0) property point pos: Qt.point(0,0)
property var step: steps[index] property var step: steps[index]
property var target: step.target() property var target: {
if(steps[index]){
return steps[index].target()
}
return undefined
}
property int parentHeight: {
if(control.parent){
return control.parent.height
}
return control.height
}
property int parentWidth: {
if(control.parent){
return control.parent.width
}
return control.width
}
} }
Connections{ Connections{
target: d.window target: d.window
@ -118,19 +135,32 @@ Popup{
return 1 return 1
return 0 return 0
} }
x: Math.min(Math.max(0,d.pos.x+d.target.width/2-width/2),control.width-width) x: {
if(d.target){
return Math.min(Math.max(0,d.pos.x+d.target.width/2-width/2),control.width-width)
}
return 0
}
y: { y: {
if(d.target){
var ty=d.pos.y+d.target.height+control.targetMargins + 15 var ty=d.pos.y+d.target.height+control.targetMargins + 15
if((ty+height)>control.height) if((ty+height)>control.height)
return d.pos.y-height-control.targetMargins - 15 return d.pos.y-height-control.targetMargins - 15
return ty return ty
} }
return 0
}
border.width: 0 border.width: 0
FluShadow{ FluShadow{
radius: 5 radius: 5
} }
FluText{ FluText{
text: d.step.title text: {
if(d.step){
return d.step.title
}
return ""
}
font: FluTextStyle.BodyStrong font: FluTextStyle.BodyStrong
elide: Text.ElideRight elide: Text.ElideRight
anchors{ anchors{
@ -148,7 +178,12 @@ Popup{
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
maximumLineCount: 4 maximumLineCount: 4
elide: Text.ElideRight elide: Text.ElideRight
text: d.step.description text: {
if(d.step){
return d.step.description
}
return ""
}
anchors{ anchors{
top: parent.top top: parent.top
left: parent.left left: parent.left
@ -199,7 +234,17 @@ Popup{
FluIcon{ FluIcon{
iconSource: layout_panne.dir?FluentIcons.FlickUp:FluentIcons.FlickDown iconSource: layout_panne.dir?FluentIcons.FlickUp:FluentIcons.FlickDown
color: layout_panne.color color: layout_panne.color
x: d.pos.x+d.target.width/2-10 x: {
y: d.pos.y+(layout_panne.dir?-height:d.target.height) if(d.target){
return d.pos.x+d.target.width/2-10
}
return 0
}
y: {
if(d.target){
return d.pos.y+(layout_panne.dir?-height:d.target.height)
}
return 0
}
} }
} }

View File

@ -5,7 +5,7 @@ import QtQuick.Layouts 1.15
import FluentUI 1.0 import FluentUI 1.0
Window { Window {
default property alias content: layout_content.data default property list<QtObject> contentData
property string windowIcon: FluApp.windowIcon property string windowIcon: FluApp.windowIcon
property int launchMode: FluWindowType.Standard property int launchMode: FluWindowType.Standard
property var argument:({}) property var argument:({})
@ -101,6 +101,9 @@ Window {
} }
lifecycle.onVisible(visible) lifecycle.onVisible(visible)
} }
onWidthChanged: {
window.appBar.width = width
}
QtObject{ QtObject{
id:d id:d
property bool isFirstVisible: true property bool isFirstVisible: true
@ -204,14 +207,6 @@ Window {
FluLoader{ FluLoader{
id:loader_frameless_helper id:loader_frameless_helper
} }
Item{
id:layout_container
anchors{
fill:parent
}
onWidthChanged: {
window.appBar.width = width
}
FluLoader{ FluLoader{
anchors.fill: parent anchors.fill: parent
sourceComponent: background sourceComponent: background
@ -232,7 +227,7 @@ Window {
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
} }
Item{ Item{
id:layout_content data: window.contentData
anchors{ anchors{
top: loader_app_bar.bottom top: loader_app_bar.bottom
left: parent.left left: parent.left
@ -245,7 +240,7 @@ Window {
property string loadingText: "加载中..." property string loadingText: "加载中..."
property bool cancel: false property bool cancel: false
id:loader_loading id:loader_loading
anchors.fill: layout_content anchors.fill: parent
} }
FluInfoBar{ FluInfoBar{
id:infoBar id:infoBar
@ -270,7 +265,6 @@ Window {
return com_border return com_border
} }
} }
}
function destoryOnClose(){ function destoryOnClose(){
lifecycle.onDestoryOnClose() lifecycle.onDestoryOnClose()
} }
@ -315,12 +309,6 @@ Window {
_windowRegister.onResult(data) _windowRegister.onResult(data)
} }
} }
function layoutContainer(){
return layout_container
}
function layoutContent(){
return layout_content
}
function showMaximized(){ function showMaximized(){
if(FluTools.isWin()){ if(FluTools.isWin()){
if(loader_frameless_helper.item){ if(loader_frameless_helper.item){

View File

@ -8,6 +8,19 @@ import QtQuick.tooling 1.2
Module { Module {
dependencies: ["QtQuick 2.0"] dependencies: ["QtQuick 2.0"]
Component {
name: "FluAccentColor"
prototype: "QObject"
exports: ["FluentUI/FluAccentColor 1.0"]
exportMetaObjectRevisions: [0]
Property { name: "darkest"; type: "QColor" }
Property { name: "darker"; type: "QColor" }
Property { name: "dark"; type: "QColor" }
Property { name: "normal"; type: "QColor" }
Property { name: "light"; type: "QColor" }
Property { name: "lighter"; type: "QColor" }
Property { name: "lightest"; type: "QColor" }
}
Component { Component {
name: "FluCalendarViewType" name: "FluCalendarViewType"
exports: ["FluentUI/FluCalendarViewType 1.0"] exports: ["FluentUI/FluCalendarViewType 1.0"]
@ -37,19 +50,6 @@ Module {
Parameter { name: "code"; type: "string" } Parameter { name: "code"; type: "string" }
} }
} }
Component {
name: "FluColorSet"
prototype: "QObject"
exports: ["FluentUI/FluColorSet 1.0"]
exportMetaObjectRevisions: [0]
Property { name: "darkest"; type: "string" }
Property { name: "darker"; type: "string" }
Property { name: "dark"; type: "string" }
Property { name: "normal"; type: "string" }
Property { name: "light"; type: "string" }
Property { name: "lighter"; type: "string" }
Property { name: "lightest"; type: "string" }
}
Component { Component {
name: "FluContentDialogType" name: "FluContentDialogType"
exports: ["FluentUI/FluContentDialogType 1.0"] exports: ["FluentUI/FluContentDialogType 1.0"]
@ -85,6 +85,7 @@ Module {
name: "showSystemMenu" name: "showSystemMenu"
Parameter { name: "point"; type: "QPoint" } Parameter { name: "point"; type: "QPoint" }
} }
Method { name: "showMaximized" }
} }
Component { Component {
name: "FluNavigationViewType" name: "FluNavigationViewType"
@ -2380,7 +2381,7 @@ Module {
} }
Property { Property {
name: "buttonDark" name: "buttonDark"
type: "FluToggleSwitch_QMLTYPE_21" type: "FluToggleSwitch_QMLTYPE_22"
isReadonly: true isReadonly: true
isPointer: true isPointer: true
} }
@ -2398,13 +2399,13 @@ Module {
exports: ["FluentUI/FluArea 1.0"] exports: ["FluentUI/FluArea 1.0"]
exportMetaObjectRevisions: [0] exportMetaObjectRevisions: [0]
isComposite: true isComposite: true
defaultProperty: "content" defaultProperty: "contentData"
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "paddings"; type: "int" } Property { name: "paddings"; type: "int" }
Property { name: "leftPadding"; type: "int" } Property { name: "leftPadding"; type: "int" }
Property { name: "rightPadding"; type: "int" } Property { name: "rightPadding"; type: "int" }
Property { name: "topPadding"; type: "int" } Property { name: "topPadding"; type: "int" }
Property { name: "bottomPadding"; type: "int" } Property { name: "bottomPadding"; type: "int" }
Property { name: "content"; type: "QObject"; isList: true; isReadonly: true }
} }
Component { Component {
prototype: "QQuickTextField" prototype: "QQuickTextField"
@ -2650,6 +2651,14 @@ Module {
defaultProperty: "data" defaultProperty: "data"
Property { name: "current"; type: "QColor" } Property { name: "current"; type: "QColor" }
Property { name: "colorHandleRadius"; type: "int" } Property { name: "colorHandleRadius"; type: "int" }
Property { name: "cancelText"; type: "string" }
Property { name: "okText"; type: "string" }
Property { name: "titleText"; type: "string" }
Property { name: "editText"; type: "string" }
Property { name: "redText"; type: "string" }
Property { name: "greenText"; type: "string" }
Property { name: "blueText"; type: "string" }
Property { name: "opacityText"; type: "string" }
Signal { name: "accepted" } Signal { name: "accepted" }
} }
Component { Component {
@ -2748,6 +2757,11 @@ Module {
Property { name: "normalColor"; type: "QColor" } Property { name: "normalColor"; type: "QColor" }
Property { name: "showYear"; type: "bool" } Property { name: "showYear"; type: "bool" }
Property { name: "current"; type: "QVariant" } Property { name: "current"; type: "QVariant" }
Property { name: "yearText"; type: "string" }
Property { name: "monthText"; type: "string" }
Property { name: "dayText"; type: "string" }
Property { name: "cancelText"; type: "string" }
Property { name: "okText"; type: "string" }
Signal { name: "accepted" } Signal { name: "accepted" }
Method { Method {
name: "generateYearArray" name: "generateYearArray"
@ -3038,15 +3052,15 @@ Module {
defaultProperty: "data" defaultProperty: "data"
Property { name: "logo"; type: "QUrl" } Property { name: "logo"; type: "QUrl" }
Property { name: "title"; type: "string" } Property { name: "title"; type: "string" }
Property { name: "items"; type: "FluObject_QMLTYPE_156"; isPointer: true } Property { name: "items"; type: "FluObject_QMLTYPE_157"; isPointer: true }
Property { name: "footerItems"; type: "FluObject_QMLTYPE_156"; isPointer: true } Property { name: "footerItems"; type: "FluObject_QMLTYPE_157"; isPointer: true }
Property { name: "displayMode"; type: "int" } Property { name: "displayMode"; type: "int" }
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true } Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true } Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
Property { name: "topPadding"; type: "int" } Property { name: "topPadding"; type: "int" }
Property { name: "pageMode"; type: "int" } Property { name: "pageMode"; type: "int" }
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_33"; isPointer: true } Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true }
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_33"; isPointer: true } Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true }
Property { name: "navCompactWidth"; type: "int" } Property { name: "navCompactWidth"; type: "int" }
Property { name: "navTopMargin"; type: "int" } Property { name: "navTopMargin"; type: "int" }
Property { name: "cellHeight"; type: "int" } Property { name: "cellHeight"; type: "int" }
@ -3735,6 +3749,12 @@ Module {
Property { name: "hourFormat"; type: "int" } Property { name: "hourFormat"; type: "int" }
Property { name: "isH"; type: "int" } Property { name: "isH"; type: "int" }
Property { name: "current"; type: "QVariant" } Property { name: "current"; type: "QVariant" }
Property { name: "amText"; type: "string" }
Property { name: "pmText"; type: "string" }
Property { name: "hourText"; type: "string" }
Property { name: "minuteText"; type: "string" }
Property { name: "cancelText"; type: "string" }
Property { name: "okText"; type: "string" }
Signal { name: "accepted" } Signal { name: "accepted" }
Method { Method {
name: "generateArray" name: "generateArray"
@ -3813,6 +3833,9 @@ Module {
Property { name: "nextButton"; type: "QQmlComponent"; isPointer: true } Property { name: "nextButton"; type: "QQmlComponent"; isPointer: true }
Property { name: "prevButton"; type: "QQmlComponent"; isPointer: true } Property { name: "prevButton"; type: "QQmlComponent"; isPointer: true }
Property { name: "index"; type: "int" } Property { name: "index"; type: "int" }
Property { name: "finishText"; type: "string" }
Property { name: "nextText"; type: "string" }
Property { name: "previousText"; type: "string" }
} }
Component { Component {
prototype: "QQuickItem" prototype: "QQuickItem"
@ -3851,9 +3874,9 @@ Module {
exports: ["FluentUI/FluWindow 1.0"] exports: ["FluentUI/FluWindow 1.0"]
exportMetaObjectRevisions: [0] exportMetaObjectRevisions: [0]
isComposite: true isComposite: true
defaultProperty: "content" defaultProperty: "contentData"
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "windowIcon"; type: "string" } Property { name: "windowIcon"; type: "string" }
Property { name: "closeDestory"; type: "bool" }
Property { name: "launchMode"; type: "int" } Property { name: "launchMode"; type: "int" }
Property { name: "argument"; type: "QVariant" } Property { name: "argument"; type: "QVariant" }
Property { name: "background"; type: "QVariant" } Property { name: "background"; type: "QVariant" }
@ -3871,18 +3894,16 @@ Module {
Property { name: "autoMaximize"; type: "bool" } Property { name: "autoMaximize"; type: "bool" }
Property { name: "autoVisible"; type: "bool" } Property { name: "autoVisible"; type: "bool" }
Property { name: "autoCenter"; type: "bool" } Property { name: "autoCenter"; type: "bool" }
Property { name: "autoDestory"; type: "bool" }
Property { name: "useSystemAppBar"; type: "bool" } Property { name: "useSystemAppBar"; type: "bool" }
Property { name: "resizeBorderColor"; type: "QColor" } Property { name: "resizeBorderColor"; type: "QColor" }
Property { name: "resizeBorderWidth"; type: "int" } Property { name: "resizeBorderWidth"; type: "int" }
Property { name: "closeListener"; type: "QVariant" } Property { name: "closeListener"; type: "QVariant" }
Property { name: "_offsetXY"; type: "QPointF" }
Property { name: "_originalPos"; type: "QVariant" }
Property { name: "_realHeight"; type: "int" } Property { name: "_realHeight"; type: "int" }
Property { name: "_realWidth"; type: "int" } Property { name: "_realWidth"; type: "int" }
Property { name: "_appBarHeight"; type: "int" } Property { name: "_appBarHeight"; type: "int" }
Property { name: "_windowRegister"; type: "QVariant" } Property { name: "_windowRegister"; type: "QVariant" }
Property { name: "_route"; type: "string" } Property { name: "_route"; type: "string" }
Property { name: "content"; type: "QObject"; isList: true; isReadonly: true }
Signal { name: "showSystemMenu" } Signal { name: "showSystemMenu" }
Signal { Signal {
name: "initArgument" name: "initArgument"
@ -3937,7 +3958,6 @@ Module {
type: "QVariant" type: "QVariant"
Parameter { name: "data"; type: "QVariant" } Parameter { name: "data"; type: "QVariant" }
} }
Method { name: "layoutContainer"; type: "QVariant" } Method { name: "showMaximized"; type: "QVariant" }
Method { name: "layoutContent"; type: "QVariant" }
} }
} }

View File

@ -4,12 +4,13 @@ import QtQuick.Window
import FluentUI import FluentUI
Rectangle { Rectangle {
default property alias content: container.data default property list<QtObject> contentData
property int paddings : 0 property int paddings : 0
property int leftPadding : 0 property int leftPadding : 0
property int rightPadding : 0 property int rightPadding : 0
property int topPadding : 0 property int topPadding : 0
property int bottomPadding : 0 property int bottomPadding : 0
id:control
radius: 4 radius: 4
color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
@ -17,7 +18,7 @@ Rectangle {
implicitHeight: height implicitHeight: height
implicitWidth: width implicitWidth: width
Item { Item {
id: container data: control.contentData
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Math.max(paddings,leftPadding) anchors.leftMargin: Math.max(paddings,leftPadding)
anchors.rightMargin: Math.max(paddings,rightPadding) anchors.rightMargin: Math.max(paddings,rightPadding)

View File

@ -7,20 +7,28 @@ Item {
property int orientation: Qt.Horizontal property int orientation: Qt.Horizontal
property int spacing:0 property int spacing:0
property int size: 1 property int size: 1
QtObject{ QtObject{
id:d id:d
property bool isVertical : orientation === Qt.Vertical property bool isVertical : orientation === Qt.Vertical
property int parentHeight: {
if(control.parent){
return control.parent.height
} }
return control.height
width: d.isVertical ? spacing*2+size : parent.width }
height: d.isVertical ? parent.height : spacing*2+size property int parentWidth: {
if(control.parent){
return control.parent.width
}
return control.width
}
}
width: d.isVertical ? spacing*2+size : d.parentWidth
height: d.isVertical ? d.parentHeight : spacing*2+size
FluRectangle{ FluRectangle{
color: FluTheme.dividerColor color: FluTheme.dividerColor
width: d.isVertical ? size : parent.width width: d.isVertical ? size : d.parentWidth
height: d.isVertical ? parent.height : size height: d.isVertical ? d.parentHeight : size
anchors.centerIn: parent anchors.centerIn: parent
} }
} }

View File

@ -13,7 +13,4 @@ Text {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: iconColor color: iconColor
text: (String.fromCharCode(iconSource).toString(16)) text: (String.fromCharCode(iconSource).toString(16))
FontLoader{
source: "../Font/Segoe_Fluent_Icons.ttf"
}
} }

View File

@ -5,12 +5,12 @@ import QtQuick.Window
import FluentUI import FluentUI
Popup { Popup {
id: popup id: control
padding: 0 padding: 0
modal:true modal:true
parent: Overlay.overlay parent: Overlay.overlay
x: Math.round((parent.width - width) / 2) x: Math.round((d.parentWidth - width) / 2)
y: Math.round((parent.height - height) / 2) y: Math.round((d.parentHeight - height) / 2)
closePolicy: Popup.CloseOnEscape closePolicy: Popup.CloseOnEscape
enter: Transition { enter: Transition {
NumberAnimation { NumberAnimation {
@ -20,7 +20,7 @@ Popup {
to:1 to:1
} }
} }
height:Math.min(implicitHeight,parent.height) height:Math.min(implicitHeight,d.parentHeight)
exit:Transition { exit:Transition {
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
@ -36,4 +36,19 @@ Popup {
radius: 5 radius: 5
} }
} }
QtObject{
id:d
property int parentHeight: {
if(control.parent){
return control.parent.height
}
return control.height
}
property int parentWidth: {
if(control.parent){
return control.parent.width
}
return control.width
}
}
} }

View File

@ -12,7 +12,10 @@ ColumnLayout {
for(var i = 0;i<buttons.length;i++){ for(var i = 0;i<buttons.length;i++){
buttons[i].checked = false buttons[i].checked = false
} }
buttons[currentIndex].checked = true var button = buttons[currentIndex]
if(button){
button.checked = true
}
} }
Component.onCompleted: { Component.onCompleted: {
for(var i = 0;i<buttons.length;i++){ for(var i = 0;i<buttons.length;i++){

View File

@ -5,6 +5,7 @@ import QtQuick.Layouts
import Qt.labs.qmlmodels import Qt.labs.qmlmodels
import FluentUI import FluentUI
Rectangle { Rectangle {
property var columnSource property var columnSource
property var dataSource property var dataSource
@ -59,6 +60,7 @@ Rectangle {
} }
TableModel { TableModel {
id:table_model id:table_model
TableModelColumn {}
} }
FluTableSortProxyModel{ FluTableSortProxyModel{
id:table_sort_model id:table_sort_model
@ -434,12 +436,14 @@ Rectangle {
right: layout_mouse_table.right right: layout_mouse_table.right
} }
} }
TableView { TableModel{
id: header_horizontal
model: TableModel{
id:header_model id:header_model
rows: d.header_rows rows: d.header_rows
TableModelColumn {}
} }
TableView {
id: header_horizontal
model: header_model
syncDirection: Qt.Horizontal syncDirection: Qt.Horizontal
anchors{ anchors{
left: header_vertical.right left: header_vertical.right
@ -598,6 +602,10 @@ Rectangle {
} }
} }
} }
TableModel{
id:model_rows
TableModelColumn { display: "rowIndex" }
}
TableView { TableView {
id: header_vertical id: header_vertical
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
@ -609,10 +617,7 @@ Rectangle {
syncDirection: Qt.Vertical syncDirection: Qt.Vertical
syncView: table_view syncView: table_view
clip: true clip: true
model: TableModel{ model: model_rows
id:model_rows
TableModelColumn { display: "rowIndex" }
}
Connections{ Connections{
target: table_model target: table_model
function onRowCountChanged(){ function onRowCountChanged(){

View File

@ -11,20 +11,20 @@ FluClip{
radius: 4 radius: 4
anchors.fill: parent anchors.fill: parent
color: { color: {
if(inputItem.disabled){ if(inputItem && inputItem.disabled){
return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1) return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
} }
if(inputItem.activeFocus){ if(inputItem && inputItem.activeFocus){
return FluTheme.dark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1) return FluTheme.dark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1)
} }
if(inputItem.hovered){ if(inputItem && inputItem.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(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) return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
} }
border.width: control.borderWidth border.width: control.borderWidth
border.color: { border.color: {
if(inputItem.disabled){ if(inputItem && inputItem.disabled){
return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(237/255,237/255,237/255,1) return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(237/255,237/255,237/255,1)
} }
return FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1) return FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1)
@ -32,11 +32,11 @@ FluClip{
} }
Rectangle{ Rectangle{
width: parent.width width: parent.width
height: inputItem.activeFocus ? 2 : 1 height: inputItem && inputItem.activeFocus ? 2 : 1
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: !inputItem.disabled visible: !(inputItem && inputItem.disabled)
color: { color: {
if(inputItem.activeFocus){ if(inputItem && inputItem.activeFocus){
return FluTheme.primaryColor return FluTheme.primaryColor
} }
if(FluTheme.dark){ if(FluTheme.dark){

View File

@ -13,10 +13,17 @@ FluMenu{
width: 120 width: 120
focus: false focus: false
onVisibleChanged: { onVisibleChanged: {
if(inputItem){
inputItem.forceActiveFocus() inputItem.forceActiveFocus()
} }
}
Connections{ Connections{
target: inputItem target: {
if(inputItem){
return inputItem
}
return null
}
function onTextChanged() { function onTextChanged() {
menu.close() menu.close()
} }
@ -32,7 +39,12 @@ FluMenu{
focus: false focus: false
padding: 0 padding: 0
height: visible ? 36 : 0 height: visible ? 36 : 0
visible: inputItem.selectedText !== "" && !inputItem.readOnly visible: {
if(inputItem){
return inputItem.selectedText !== "" && !inputItem.readOnly
}
return false
}
onClicked: { onClicked: {
inputItem.cut() inputItem.cut()
menu.close() menu.close()
@ -44,7 +56,12 @@ FluMenu{
focus: false focus: false
padding: 0 padding: 0
height: visible ? 36 : 0 height: visible ? 36 : 0
visible: inputItem.selectedText !== "" visible: {
if(inputItem){
return inputItem.selectedText !== ""
}
return false
}
onClicked: { onClicked: {
inputItem.copy() inputItem.copy()
menu.close() menu.close()
@ -55,7 +72,12 @@ FluMenu{
text:pasteText text:pasteText
focus: false focus: false
padding: 0 padding: 0
visible: !inputItem.readOnly visible: {
if(inputItem){
return !inputItem.readOnly
}
return false
}
height: visible ? 36 : 0 height: visible ? 36 : 0
onClicked: { onClicked: {
inputItem.paste() inputItem.paste()
@ -68,11 +90,15 @@ FluMenu{
focus: false focus: false
padding: 0 padding: 0
height: visible ? 36 : 0 height: visible ? 36 : 0
visible: inputItem.text !== "" visible: {
if(inputItem){
return inputItem.text !== ""
}
return false
}
onClicked: { onClicked: {
inputItem.selectAll() inputItem.selectAll()
menu.close() menu.close()
} }
} }
} }

View File

@ -15,6 +15,9 @@ Item{
property bool isRight: control.mode === FluTimelineType.Right property bool isRight: control.mode === FluTimelineType.Right
property bool isAlternate: control.mode === FluTimelineType.Alternate property bool isAlternate: control.mode === FluTimelineType.Alternate
property bool hasLable: { property bool hasLable: {
if(!model){
return false
}
for(var i=0;i<model.count;i++){ for(var i=0;i<model.count;i++){
var lable = model.get(i).lable var lable = model.get(i).lable
if(lable !== undefined && undefined !== ""){ if(lable !== undefined && undefined !== ""){

View File

@ -16,8 +16,8 @@ Popup{
id:control id:control
padding: 0 padding: 0
parent: Overlay.overlay parent: Overlay.overlay
width: parent.width width: d.parentWidth
height: parent.height height: d.parentHeight
background: Item{} background: Item{}
contentItem: Item{} contentItem: Item{}
onVisibleChanged: { onVisibleChanged: {
@ -55,7 +55,24 @@ Popup{
property var window: Window.window property var window: Window.window
property point pos: Qt.point(0,0) property point pos: Qt.point(0,0)
property var step: steps[index] property var step: steps[index]
property var target: step.target() property var target: {
if(steps[index]){
return steps[index].target()
}
return undefined
}
property int parentHeight: {
if(control.parent){
return control.parent.height
}
return control.height
}
property int parentWidth: {
if(control.parent){
return control.parent.width
}
return control.width
}
} }
Connections{ Connections{
target: d.window target: d.window
@ -118,19 +135,32 @@ Popup{
return 1 return 1
return 0 return 0
} }
x: Math.min(Math.max(0,d.pos.x+d.target.width/2-width/2),control.width-width) x: {
if(d.target){
return Math.min(Math.max(0,d.pos.x+d.target.width/2-width/2),control.width-width)
}
return 0
}
y: { y: {
if(d.target){
var ty=d.pos.y+d.target.height+control.targetMargins + 15 var ty=d.pos.y+d.target.height+control.targetMargins + 15
if((ty+height)>control.height) if((ty+height)>control.height)
return d.pos.y-height-control.targetMargins - 15 return d.pos.y-height-control.targetMargins - 15
return ty return ty
} }
return 0
}
border.width: 0 border.width: 0
FluShadow{ FluShadow{
radius: 5 radius: 5
} }
FluText{ FluText{
text: d.step.title text: {
if(d.step){
return d.step.title
}
return ""
}
font: FluTextStyle.BodyStrong font: FluTextStyle.BodyStrong
elide: Text.ElideRight elide: Text.ElideRight
anchors{ anchors{
@ -148,7 +178,12 @@ Popup{
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
maximumLineCount: 4 maximumLineCount: 4
elide: Text.ElideRight elide: Text.ElideRight
text: d.step.description text: {
if(d.step){
return d.step.description
}
return ""
}
anchors{ anchors{
top: parent.top top: parent.top
left: parent.left left: parent.left
@ -199,7 +234,17 @@ Popup{
FluIcon{ FluIcon{
iconSource: layout_panne.dir?FluentIcons.FlickUp:FluentIcons.FlickDown iconSource: layout_panne.dir?FluentIcons.FlickUp:FluentIcons.FlickDown
color: layout_panne.color color: layout_panne.color
x: d.pos.x+d.target.width/2-10 x: {
y: d.pos.y+(layout_panne.dir?-height:d.target.height) if(d.target){
return d.pos.x+d.target.width/2-10
}
return 0
}
y: {
if(d.target){
return d.pos.y+(layout_panne.dir?-height:d.target.height)
}
return 0
}
} }
} }

View File

@ -4,7 +4,7 @@ import QtQuick.Layouts
import FluentUI import FluentUI
Window { Window {
default property alias content: layout_content.data default property list<QtObject> contentData
property string windowIcon: FluApp.windowIcon property string windowIcon: FluApp.windowIcon
property int launchMode: FluWindowType.Standard property int launchMode: FluWindowType.Standard
property var argument:({}) property var argument:({})
@ -100,6 +100,9 @@ Window {
} }
lifecycle.onVisible(visible) lifecycle.onVisible(visible)
} }
onWidthChanged: {
window.appBar.width = width
}
QtObject{ QtObject{
id:d id:d
property bool isFirstVisible: true property bool isFirstVisible: true
@ -203,14 +206,6 @@ Window {
FluLoader{ FluLoader{
id:loader_frameless_helper id:loader_frameless_helper
} }
Item{
id:layout_container
anchors{
fill:parent
}
onWidthChanged: {
window.appBar.width = width
}
FluLoader{ FluLoader{
anchors.fill: parent anchors.fill: parent
sourceComponent: background sourceComponent: background
@ -231,7 +226,7 @@ Window {
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
} }
Item{ Item{
id:layout_content data: window.contentData
anchors{ anchors{
top: loader_app_bar.bottom top: loader_app_bar.bottom
left: parent.left left: parent.left
@ -244,7 +239,7 @@ Window {
property string loadingText: "加载中..." property string loadingText: "加载中..."
property bool cancel: false property bool cancel: false
id:loader_loading id:loader_loading
anchors.fill: layout_content anchors.fill: parent
} }
FluInfoBar{ FluInfoBar{
id:infoBar id:infoBar
@ -269,7 +264,6 @@ Window {
return com_border return com_border
} }
} }
}
function destoryOnClose(){ function destoryOnClose(){
lifecycle.onDestoryOnClose() lifecycle.onDestoryOnClose()
} }
@ -314,12 +308,6 @@ Window {
_windowRegister.onResult(data) _windowRegister.onResult(data)
} }
} }
function layoutContainer(){
return layout_container
}
function layoutContent(){
return layout_content
}
function showMaximized(){ function showMaximized(){
if(FluTools.isWin()){ if(FluTools.isWin()){
if(loader_frameless_helper.item){ if(loader_frameless_helper.item){