update
@ -35,8 +35,9 @@ FluScrollablePage{
|
|||||||
FluSlider{
|
FluSlider{
|
||||||
value:50
|
value:50
|
||||||
onValueChanged:{
|
onValueChanged:{
|
||||||
progress_bar.progress = value/100
|
var progress = value/100
|
||||||
progress_ring.progress = value/100
|
progress_bar.progress = progress
|
||||||
|
progress_ring.progress = progress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ FluScrollablePage{
|
|||||||
paddings: 10
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
FluSlider{
|
FluSlider{
|
||||||
value: 50
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,10 +33,8 @@ FluScrollablePage{
|
|||||||
paddings: 10
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
FluSlider{
|
FluSlider{
|
||||||
value: 50
|
orientation: Qt.Vertical
|
||||||
vertical:true
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 20
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,7 +42,7 @@ FluScrollablePage{
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: -1
|
Layout.topMargin: -1
|
||||||
code:'FluSlider{
|
code:'FluSlider{
|
||||||
vertical:true
|
orientation: Qt.Vertical
|
||||||
value:50
|
value:50
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,6 @@ FluContentPage {
|
|||||||
title: "Typography"
|
title: "Typography"
|
||||||
rightPadding: 10
|
rightPadding: 10
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
slider.seek(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
anchors{
|
anchors{
|
||||||
top:parent.top
|
top:parent.top
|
||||||
@ -73,7 +69,7 @@ FluContentPage {
|
|||||||
|
|
||||||
FluSlider{
|
FluSlider{
|
||||||
id:slider
|
id:slider
|
||||||
vertical:true
|
orientation: Qt.Vertical
|
||||||
anchors{
|
anchors{
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: 45
|
rightMargin: 45
|
||||||
|
@ -33,7 +33,7 @@ foreach(filepath ${QML_PATHS})
|
|||||||
endforeach(filepath)
|
endforeach(filepath)
|
||||||
|
|
||||||
#遍历所有资源文件
|
#遍历所有资源文件
|
||||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.qsb *.metainfo)
|
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp)
|
||||||
foreach(filepath ${RES_PATHS})
|
foreach(filepath ${RES_PATHS})
|
||||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
list(APPEND resource_files ${filename})
|
list(APPEND resource_files ${filename})
|
||||||
@ -58,8 +58,6 @@ qt_add_qml_module(fluentuiplugin
|
|||||||
SOURCES ${sources_files} fluentui.rc
|
SOURCES ${sources_files} fluentui.rc
|
||||||
QML_FILES ${qml_files}
|
QML_FILES ${qml_files}
|
||||||
RESOURCES ${resource_files}
|
RESOURCES ${resource_files}
|
||||||
#支持designer
|
|
||||||
DESIGNER_SUPPORTED
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#链接库
|
#链接库
|
||||||
@ -68,3 +66,6 @@ target_link_libraries(fluentuiplugin PUBLIC
|
|||||||
Qt::Quick
|
Qt::Quick
|
||||||
Qt::Qml
|
Qt::Qml
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#安装
|
||||||
|
install(DIRECTORY ${QML_PLUGIN_DIRECTORY} DESTINATION ${CMAKE_INSTALL_PREFIX}/imports)
|
||||||
|
@ -1,83 +1,40 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls.impl
|
||||||
import Qt5Compat.GraphicalEffects
|
import QtQuick.Templates as T
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Item{
|
T.Slider {
|
||||||
property int size: 180
|
|
||||||
property int dotSize: 24
|
|
||||||
property int value: 50
|
|
||||||
property int maxValue: 100
|
|
||||||
property bool vertical: false
|
|
||||||
property bool tipEnabled : true
|
|
||||||
property var onLineClickFunc
|
|
||||||
signal pressed
|
|
||||||
signal released
|
|
||||||
id:root
|
|
||||||
height: control.height
|
|
||||||
width: control.width
|
|
||||||
rotation: vertical ? 180 : 0
|
|
||||||
Component.onCompleted: {
|
|
||||||
seek(value)
|
|
||||||
}
|
|
||||||
MouseArea{
|
|
||||||
id:mouse_line
|
|
||||||
anchors.centerIn: control
|
|
||||||
width: vertical ? 10 : control.width
|
|
||||||
height: vertical ? control.height : 10
|
|
||||||
hoverEnabled: true
|
|
||||||
onClicked:
|
|
||||||
(mouse) => {
|
|
||||||
var val;
|
|
||||||
if(vertical){
|
|
||||||
val = mouse.y*maxValue/control.height
|
|
||||||
}else{
|
|
||||||
val = mouse.x*maxValue/control.width
|
|
||||||
}
|
|
||||||
if(onLineClickFunc){
|
|
||||||
onLineClickFunc(val)
|
|
||||||
}else{
|
|
||||||
seek(val)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
id: control
|
id: control
|
||||||
width: vertical ? 4 :size
|
to:100
|
||||||
height: vertical ? size : 4
|
stepSize:1
|
||||||
radius: 2
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
implicitHandleWidth + leftPadding + rightPadding)
|
||||||
color:FluTheme.dark ? Qt.rgba(162/255,162/255,162/255,1) : Qt.rgba(138/255,138/255,138/255,1)
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
Rectangle{
|
implicitHandleHeight + topPadding + bottomPadding)
|
||||||
id:rect
|
|
||||||
radius: 2.5
|
padding: 6
|
||||||
width: vertical ? 5 : control.width*(value/maxValue)
|
|
||||||
height: vertical ? control.height*(value/maxValue) : 5
|
handle: Rectangle {
|
||||||
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
|
||||||
}
|
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
|
||||||
}
|
implicitWidth: 24
|
||||||
Rectangle{
|
implicitHeight: 24
|
||||||
id:dot
|
radius: 12
|
||||||
width: dotSize
|
|
||||||
height: dotSize
|
|
||||||
FluShadow{
|
|
||||||
radius: dotSize/2
|
|
||||||
}
|
|
||||||
radius: dotSize/2
|
|
||||||
anchors.verticalCenter: vertical ? undefined : parent.verticalCenter
|
|
||||||
anchors.horizontalCenter: vertical ? parent.horizontalCenter : undefined
|
|
||||||
color:FluTheme.dark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
|
color:FluTheme.dark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
|
||||||
|
FluShadow{
|
||||||
|
radius: 12
|
||||||
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
width: dotSize
|
width: 24
|
||||||
height: dotSize
|
height: 24
|
||||||
radius: dotSize/2
|
radius: 12
|
||||||
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
scale: {
|
scale: {
|
||||||
if(control_mouse.pressed){
|
if(control.pressed){
|
||||||
return 4/10
|
return 4/10
|
||||||
}
|
}
|
||||||
return control_mouse.containsMouse || mouse_line.containsMouse ? 6/10 : 5/10
|
return control.hovered ? 6/10 : 5/10
|
||||||
}
|
}
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
@ -85,47 +42,24 @@ Item{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MouseArea{
|
|
||||||
id:control_mouse
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
drag {
|
|
||||||
target: dot
|
|
||||||
axis: vertical ? Drag.YAxis : Drag.XAxis
|
|
||||||
minimumX: vertical ? 0 : -dotSize/2
|
|
||||||
maximumX: vertical ? 0 : (control.width - dotSize/2)
|
|
||||||
minimumY: vertical ? -dotSize/2 : 0
|
|
||||||
maximumY: vertical ? (control.height - dotSize/2) : 0
|
|
||||||
}
|
|
||||||
onPressed: {
|
|
||||||
if(tipEnabled){
|
|
||||||
tool_tip.visible = true
|
|
||||||
}
|
|
||||||
root.pressed()
|
|
||||||
}
|
|
||||||
onReleased: {
|
|
||||||
tool_tip.visible = false
|
|
||||||
root.released()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluTooltip{
|
|
||||||
id:tool_tip
|
|
||||||
text:String(root.value)
|
|
||||||
y: vertical ? 32 : -40
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function seek(val){
|
|
||||||
if(vertical){
|
|
||||||
dot.y =val/maxValue*control.height - dotSize/2
|
|
||||||
root.value = Qt.binding(function(){
|
|
||||||
return (dot.y+dotSize/2)/control.height*maxValue
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
dot.x =val/maxValue*control.width - dotSize/2
|
|
||||||
root.value = Qt.binding(function(){
|
|
||||||
return (dot.x+dotSize/2)/control.width*maxValue
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2)
|
||||||
|
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0)
|
||||||
|
implicitWidth: control.horizontal ? 180 : 4
|
||||||
|
implicitHeight: control.horizontal ? 4 : 180
|
||||||
|
width: control.horizontal ? control.availableWidth : implicitWidth
|
||||||
|
height: control.horizontal ? implicitHeight : control.availableHeight
|
||||||
|
radius: 3
|
||||||
|
color:FluTheme.dark ? Qt.rgba(162/255,162/255,162/255,1) : Qt.rgba(138/255,138/255,138/255,1)
|
||||||
|
scale: control.horizontal && control.mirrored ? -1 : 1
|
||||||
|
Rectangle {
|
||||||
|
y: control.horizontal ? 0 : control.visualPosition * parent.height
|
||||||
|
width: control.horizontal ? control.position * parent.width : 4
|
||||||
|
height: control.horizontal ? 4 : control.position * parent.height
|
||||||
|
radius: 2
|
||||||
|
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,144 +0,0 @@
|
|||||||
MetaInfo {
|
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "FluentUI.Controls.FluTextButton"
|
|
||||||
icon: "images/button-icon16.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "FluTextButton"
|
|
||||||
category: "FluentUI - Controls"
|
|
||||||
libraryIcon: "images/button-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "FluentUI"
|
|
||||||
toolTip: qsTr("A button with text.")
|
|
||||||
|
|
||||||
Property { name: "text"; type: "binding"; value: "qsTr(\"Text Button\")" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "FluentUI.Controls.FluButton"
|
|
||||||
icon: "images/button-icon16.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "FluButton"
|
|
||||||
category: "FluentUI - Controls"
|
|
||||||
libraryIcon: "images/button-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "FluentUI"
|
|
||||||
toolTip: qsTr("A button with text.")
|
|
||||||
|
|
||||||
Property { name: "text"; type: "binding"; value: "qsTr(\"Standard Button\")" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "FluentUI.Controls.FluFilledButton"
|
|
||||||
icon: "images/button-icon16.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "FluFilledButton"
|
|
||||||
category: "FluentUI - Controls"
|
|
||||||
libraryIcon: "images/button-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "FluentUI"
|
|
||||||
toolTip: qsTr("A button with text.")
|
|
||||||
|
|
||||||
Property { name: "text"; type: "binding"; value: "qsTr(\"Filled Button\")" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "FluentUI.Controls.FluToggleButton"
|
|
||||||
icon: "images/button-icon16.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "FluToggleButton"
|
|
||||||
category: "FluentUI - Controls"
|
|
||||||
libraryIcon: "images/button-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "FluentUI"
|
|
||||||
toolTip: qsTr("A button with text.")
|
|
||||||
|
|
||||||
Property { name: "text"; type: "binding"; value: "qsTr(\"Toggle Button\")" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "FluentUI.Controls.FluIconButton"
|
|
||||||
icon: "images/button-icon16.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "FluIconButton"
|
|
||||||
category: "FluentUI - Controls"
|
|
||||||
libraryIcon: "images/button-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "FluentUI"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "FluentUI.Controls.FluDropDownButton"
|
|
||||||
icon: "images/button-icon16.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "FluDropDownButton"
|
|
||||||
category: "FluentUI - Controls"
|
|
||||||
libraryIcon: "images/button-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "FluentUI"
|
|
||||||
toolTip: qsTr("A button with text.")
|
|
||||||
|
|
||||||
Property { name: "text"; type: "binding"; value: "qsTr(\"DropDownButton\")" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "FluentUI.Controls.FluRadioButton"
|
|
||||||
icon: "images/button-icon16.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "FluRadioButton"
|
|
||||||
category: "FluentUI - Controls"
|
|
||||||
libraryIcon: "images/button-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "FluentUI"
|
|
||||||
toolTip: qsTr("A button with text.")
|
|
||||||
|
|
||||||
Property { name: "text"; type: "binding"; value: "qsTr(\"Radio Button\")" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "FluentUI.Controls.FluCheckBox"
|
|
||||||
icon: "images/button-icon16.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "FluCheckBox"
|
|
||||||
category: "FluentUI - Controls"
|
|
||||||
libraryIcon: "images/button-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "FluentUI"
|
|
||||||
toolTip: qsTr("A button with text.")
|
|
||||||
|
|
||||||
Property { name: "text"; type: "binding"; value: "qsTr(\"CheckBox\")" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Type {
|
|
||||||
name: "FluentUI.Controls.FluText"
|
|
||||||
icon: "images/label-icon16.png"
|
|
||||||
|
|
||||||
ItemLibraryEntry {
|
|
||||||
name: "FluText"
|
|
||||||
category: "FluentUI - Controls"
|
|
||||||
libraryIcon: "images/label-icon.png"
|
|
||||||
version: "1.0"
|
|
||||||
requiredImport: "FluentUI"
|
|
||||||
toolTip: qsTr("A text.")
|
|
||||||
|
|
||||||
Property { name: "text"; type: "binding"; value: "qsTr(\"Text\")" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Before Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 643 B |
Before Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 259 B |
Before Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 156 B |
Before Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 293 B |
Before Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 509 B |
Before Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 267 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 505 B |
Before Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 117 B |
Before Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 136 B |
Before Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 124 B |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 179 B |
Before Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 93 B |
Before Width: | Height: | Size: 92 B |
Before Width: | Height: | Size: 96 B |
Before Width: | Height: | Size: 101 B |
Before Width: | Height: | Size: 92 B |
Before Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 482 B |
Before Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 110 B |
Before Width: | Height: | Size: 116 B |
Before Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 156 B |
Before Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 114 B |
Before Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 111 B |
Before Width: | Height: | Size: 123 B |
Before Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 153 B |