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>
<message>
<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="31"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="32"/>
<source>FluentUI Initalizr</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="52"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="52"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="53"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="53"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="60"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="60"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="61"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="61"/>
<source>Create In</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="67"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="67"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="65"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="65"/>
<source>Browse</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="98"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="98"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="95"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="95"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="106"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="106"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="103"/>
<location filename="qml-Qt6/window/FluentInitalizrWindow.qml" line="103"/>
<source>Create</source>
<translation type="unfinished"></translation>
</message>
@ -102,22 +102,22 @@
<context>
<name>InitalizrHelper</name>
<message>
<location filename="src/helper/InitalizrHelper.cpp" line="48"/>
<location filename="src/helper/InitalizrHelper.cpp" line="73"/>
<source>The name cannot be empty</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/helper/InitalizrHelper.cpp" line="63"/>
<location filename="src/helper/InitalizrHelper.cpp" line="88"/>
<source>%1 folder already exists</source>
<translation type="unfinished"></translation>
</message>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@ set(CMAKE_CXX_STANDARD 17)
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)
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)

View File

@ -4,12 +4,13 @@ import QtQuick.Window 2.15
import FluentUI 1.0
Rectangle {
default property alias content: container.data
default property list<QtObject> contentData
property int paddings : 0
property int leftPadding : 0
property int rightPadding : 0
property int topPadding : 0
property int bottomPadding : 0
id:control
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)
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
implicitWidth: width
Item {
id: container
data: control.contentData
anchors.fill: parent
anchors.leftMargin: Math.max(paddings,leftPadding)
anchors.rightMargin: Math.max(paddings,rightPadding)

View File

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

View File

@ -13,7 +13,4 @@ Text {
verticalAlignment: Text.AlignVCenter
color: iconColor
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
Popup {
id: popup
id: control
padding: 0
modal:true
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
x: Math.round((d.parentWidth - width) / 2)
y: Math.round((d.parentHeight - height) / 2)
closePolicy: Popup.CloseOnEscape
enter: Transition {
NumberAnimation {
@ -20,7 +20,7 @@ Popup {
to:1
}
}
height:Math.min(implicitHeight,parent.height)
height:Math.min(implicitHeight,d.parentHeight)
exit:Transition {
NumberAnimation {
property: "opacity"
@ -36,5 +36,19 @@ Popup {
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++){
buttons[i].checked = false
}
buttons[currentIndex].checked = true
var button = buttons[currentIndex]
if(button){
button.checked = true
}
}
Component.onCompleted: {
for(var i = 0;i<buttons.length;i++){

View File

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

View File

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

View File

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

View File

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

View File

@ -16,8 +16,8 @@ Popup{
id:control
padding: 0
parent: Overlay.overlay
width: parent.width
height: parent.height
width: d.parentWidth
height: d.parentHeight
background: Item{}
contentItem: Item{}
onVisibleChanged: {
@ -55,7 +55,24 @@ Popup{
property var window: Window.window
property point pos: Qt.point(0,0)
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{
target: d.window
@ -118,19 +135,32 @@ Popup{
return 1
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: {
var ty=d.pos.y+d.target.height+control.targetMargins + 15
if((ty+height)>control.height)
return d.pos.y-height-control.targetMargins - 15
return ty
if(d.target){
var ty=d.pos.y+d.target.height+control.targetMargins + 15
if((ty+height)>control.height)
return d.pos.y-height-control.targetMargins - 15
return ty
}
return 0
}
border.width: 0
FluShadow{
radius: 5
}
FluText{
text: d.step.title
text: {
if(d.step){
return d.step.title
}
return ""
}
font: FluTextStyle.BodyStrong
elide: Text.ElideRight
anchors{
@ -148,7 +178,12 @@ Popup{
wrapMode: Text.WrapAnywhere
maximumLineCount: 4
elide: Text.ElideRight
text: d.step.description
text: {
if(d.step){
return d.step.description
}
return ""
}
anchors{
top: parent.top
left: parent.left
@ -199,7 +234,17 @@ Popup{
FluIcon{
iconSource: layout_panne.dir?FluentIcons.FlickUp:FluentIcons.FlickDown
color: layout_panne.color
x: d.pos.x+d.target.width/2-10
y: d.pos.y+(layout_panne.dir?-height:d.target.height)
x: {
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
Window {
default property alias content: layout_content.data
default property list<QtObject> contentData
property string windowIcon: FluApp.windowIcon
property int launchMode: FluWindowType.Standard
property var argument:({})
@ -101,6 +101,9 @@ Window {
}
lifecycle.onVisible(visible)
}
onWidthChanged: {
window.appBar.width = width
}
QtObject{
id:d
property bool isFirstVisible: true
@ -204,71 +207,62 @@ Window {
FluLoader{
id:loader_frameless_helper
}
FluLoader{
anchors.fill: parent
sourceComponent: background
}
FluLoader{
id:loader_app_bar
anchors {
top: parent.top
left: parent.left
right: parent.right
}
height: {
if(window.useSystemAppBar){
return 0
}
return window.fitsAppBarWindows ? 0 : window.appBar.height
}
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
}
Item{
id:layout_container
data: window.contentData
anchors{
fill:parent
top: loader_app_bar.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
onWidthChanged: {
window.appBar.width = width
}
FluLoader{
anchors.fill: parent
sourceComponent: background
}
FluLoader{
id:loader_app_bar
anchors {
top: parent.top
left: parent.left
right: parent.right
clip: true
}
FluLoader{
property string loadingText: "加载中..."
property bool cancel: false
id:loader_loading
anchors.fill: parent
}
FluInfoBar{
id:infoBar
root: window
}
FluWindowLifecycle{
id:lifecycle
}
FluLoader{
id:loader_border
anchors.fill: parent
sourceComponent: {
if(window.useSystemAppBar){
return undefined
}
height: {
if(window.useSystemAppBar){
return 0
}
return window.fitsAppBarWindows ? 0 : window.appBar.height
if(FluTools.isWindows10OrGreater()){
return undefined
}
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
}
Item{
id:layout_content
anchors{
top: loader_app_bar.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
clip: true
}
FluLoader{
property string loadingText: "加载中..."
property bool cancel: false
id:loader_loading
anchors.fill: layout_content
}
FluInfoBar{
id:infoBar
root: window
}
FluWindowLifecycle{
id:lifecycle
}
FluLoader{
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){
return undefined
}
return com_border
if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
return undefined
}
return com_border
}
}
function destoryOnClose(){
@ -315,12 +309,6 @@ Window {
_windowRegister.onResult(data)
}
}
function layoutContainer(){
return layout_container
}
function layoutContent(){
return layout_content
}
function showMaximized(){
if(FluTools.isWin()){
if(loader_frameless_helper.item){

View File

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

View File

@ -4,12 +4,13 @@ import QtQuick.Window
import FluentUI
Rectangle {
default property alias content: container.data
default property list<QtObject> contentData
property int paddings : 0
property int leftPadding : 0
property int rightPadding : 0
property int topPadding : 0
property int bottomPadding : 0
id:control
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)
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
implicitWidth: width
Item {
id: container
data: control.contentData
anchors.fill: parent
anchors.leftMargin: Math.max(paddings,leftPadding)
anchors.rightMargin: Math.max(paddings,rightPadding)

View File

@ -7,20 +7,28 @@ Item {
property int orientation: Qt.Horizontal
property int spacing:0
property int size: 1
QtObject{
id:d
property bool isVertical : orientation === Qt.Vertical
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
}
}
width: d.isVertical ? spacing*2+size : parent.width
height: d.isVertical ? parent.height : spacing*2+size
width: d.isVertical ? spacing*2+size : d.parentWidth
height: d.isVertical ? d.parentHeight : spacing*2+size
FluRectangle{
color: FluTheme.dividerColor
width: d.isVertical ? size : parent.width
height: d.isVertical ? parent.height : size
width: d.isVertical ? size : d.parentWidth
height: d.isVertical ? d.parentHeight : size
anchors.centerIn: parent
}
}

View File

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

View File

@ -5,12 +5,12 @@ import QtQuick.Window
import FluentUI
Popup {
id: popup
id: control
padding: 0
modal:true
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
x: Math.round((d.parentWidth - width) / 2)
y: Math.round((d.parentHeight - height) / 2)
closePolicy: Popup.CloseOnEscape
enter: Transition {
NumberAnimation {
@ -20,7 +20,7 @@ Popup {
to:1
}
}
height:Math.min(implicitHeight,parent.height)
height:Math.min(implicitHeight,d.parentHeight)
exit:Transition {
NumberAnimation {
property: "opacity"
@ -36,4 +36,19 @@ Popup {
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++){
buttons[i].checked = false
}
buttons[currentIndex].checked = true
var button = buttons[currentIndex]
if(button){
button.checked = true
}
}
Component.onCompleted: {
for(var i = 0;i<buttons.length;i++){

View File

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

View File

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

View File

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

View File

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

View File

@ -16,8 +16,8 @@ Popup{
id:control
padding: 0
parent: Overlay.overlay
width: parent.width
height: parent.height
width: d.parentWidth
height: d.parentHeight
background: Item{}
contentItem: Item{}
onVisibleChanged: {
@ -55,7 +55,24 @@ Popup{
property var window: Window.window
property point pos: Qt.point(0,0)
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{
target: d.window
@ -118,19 +135,32 @@ Popup{
return 1
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: {
var ty=d.pos.y+d.target.height+control.targetMargins + 15
if((ty+height)>control.height)
return d.pos.y-height-control.targetMargins - 15
return ty
if(d.target){
var ty=d.pos.y+d.target.height+control.targetMargins + 15
if((ty+height)>control.height)
return d.pos.y-height-control.targetMargins - 15
return ty
}
return 0
}
border.width: 0
FluShadow{
radius: 5
}
FluText{
text: d.step.title
text: {
if(d.step){
return d.step.title
}
return ""
}
font: FluTextStyle.BodyStrong
elide: Text.ElideRight
anchors{
@ -148,7 +178,12 @@ Popup{
wrapMode: Text.WrapAnywhere
maximumLineCount: 4
elide: Text.ElideRight
text: d.step.description
text: {
if(d.step){
return d.step.description
}
return ""
}
anchors{
top: parent.top
left: parent.left
@ -199,7 +234,17 @@ Popup{
FluIcon{
iconSource: layout_panne.dir?FluentIcons.FlickUp:FluentIcons.FlickDown
color: layout_panne.color
x: d.pos.x+d.target.width/2-10
y: d.pos.y+(layout_panne.dir?-height:d.target.height)
x: {
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
Window {
default property alias content: layout_content.data
default property list<QtObject> contentData
property string windowIcon: FluApp.windowIcon
property int launchMode: FluWindowType.Standard
property var argument:({})
@ -100,6 +100,9 @@ Window {
}
lifecycle.onVisible(visible)
}
onWidthChanged: {
window.appBar.width = width
}
QtObject{
id:d
property bool isFirstVisible: true
@ -203,71 +206,62 @@ Window {
FluLoader{
id:loader_frameless_helper
}
FluLoader{
anchors.fill: parent
sourceComponent: background
}
FluLoader{
id:loader_app_bar
anchors {
top: parent.top
left: parent.left
right: parent.right
}
height: {
if(window.useSystemAppBar){
return 0
}
return window.fitsAppBarWindows ? 0 : window.appBar.height
}
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
}
Item{
id:layout_container
data: window.contentData
anchors{
fill:parent
top: loader_app_bar.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
onWidthChanged: {
window.appBar.width = width
}
FluLoader{
anchors.fill: parent
sourceComponent: background
}
FluLoader{
id:loader_app_bar
anchors {
top: parent.top
left: parent.left
right: parent.right
clip: true
}
FluLoader{
property string loadingText: "加载中..."
property bool cancel: false
id:loader_loading
anchors.fill: parent
}
FluInfoBar{
id:infoBar
root: window
}
FluWindowLifecycle{
id:lifecycle
}
FluLoader{
id:loader_border
anchors.fill: parent
sourceComponent: {
if(window.useSystemAppBar){
return undefined
}
height: {
if(window.useSystemAppBar){
return 0
}
return window.fitsAppBarWindows ? 0 : window.appBar.height
if(FluTools.isWindows10OrGreater()){
return undefined
}
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
}
Item{
id:layout_content
anchors{
top: loader_app_bar.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
clip: true
}
FluLoader{
property string loadingText: "加载中..."
property bool cancel: false
id:loader_loading
anchors.fill: layout_content
}
FluInfoBar{
id:infoBar
root: window
}
FluWindowLifecycle{
id:lifecycle
}
FluLoader{
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){
return undefined
}
return com_border
if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
return undefined
}
return com_border
}
}
function destoryOnClose(){
@ -314,12 +308,6 @@ Window {
_windowRegister.onResult(data)
}
}
function layoutContainer(){
return layout_container
}
function layoutContent(){
return layout_content
}
function showMaximized(){
if(FluTools.isWin()){
if(loader_frameless_helper.item){