mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-01 23:51:48 +08:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
7276eb5f2f | |||
b6c689e0ec | |||
a48bc51edc | |||
b2d0975ed7 | |||
7dea573069 | |||
0d4dd483da | |||
d1656cfb63 | |||
73cc5bccc8 | |||
9ff81251c8 | |||
74940665ae | |||
21ddc79f3f | |||
64bbae9266 | |||
bbb6fe9329 | |||
c42f3ef70f | |||
f13f1727af | |||
9f9e48659b | |||
294606d019 | |||
bfa5c93d40 | |||
9656b3dd95 | |||
8a52f143d7 | |||
dc3b1acaa5 | |||
1a8d06331f | |||
d09414db1b |
@ -19,7 +19,7 @@ endif()
|
|||||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,7,0)
|
add_definitions(-DVERSION=1,3,7,3)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
||||||
|
|
||||||
|
@ -37,11 +37,6 @@ FluExpander{
|
|||||||
rightMargin: 5
|
rightMargin: 5
|
||||||
topMargin: 5
|
topMargin: 5
|
||||||
}
|
}
|
||||||
onActiveFocusChanged: {
|
|
||||||
if(activeFocus){
|
|
||||||
control.expand = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onClicked:{
|
onClicked:{
|
||||||
FluTools.clipText(content.text)
|
FluTools.clipText(content.text)
|
||||||
showSuccess("复制成功")
|
showSuccess("复制成功")
|
||||||
@ -133,13 +128,12 @@ FluExpander{
|
|||||||
"FluRemoteLoader",
|
"FluRemoteLoader",
|
||||||
"FluMenuBar",
|
"FluMenuBar",
|
||||||
"FluPagination",
|
"FluPagination",
|
||||||
"FluRadioButtons"
|
"FluRadioButtons",
|
||||||
|
"FluImage",
|
||||||
|
"FluSpinBox"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
||||||
return code.replace(RegExp("\\b(" + qmlKeywords.join("|") + ")\\b", "g"), "<span style='color: #c23a80'>$1</span>");
|
return code.replace(RegExp("\\b(" + qmlKeywords.join("|") + ")\\b", "g"), "<span style='color: #c23a80'>$1</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,12 @@ FluObject{
|
|||||||
navigationView.push("qrc:/example/qml/page/T_Text.qml")
|
navigationView.push("qrc:/example/qml/page/T_Text.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"Image"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/example/qml/page/T_Image.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Slider"
|
title:"Slider"
|
||||||
image:"qrc:/example/res/image/control/Slider.png"
|
image:"qrc:/example/res/image/control/Slider.png"
|
||||||
|
@ -76,7 +76,6 @@ FluScrollablePage{
|
|||||||
Image{
|
Image{
|
||||||
source: "qrc:/example/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
sourceSize: Qt.size(400,300)
|
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
|
@ -8,6 +8,7 @@ import FluentUI
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
pageMode: FluNavigationView.SingleTask
|
pageMode: FluNavigationView.SingleTask
|
||||||
|
animDisabled: true
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id:model_header
|
id:model_header
|
||||||
|
48
example/qml/page/T_Image.qml
Normal file
48
example/qml/page/T_Image.qml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Image"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 260
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
Column{
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left:parent.left
|
||||||
|
}
|
||||||
|
FluImage{
|
||||||
|
width: 384
|
||||||
|
height: 240
|
||||||
|
source: "https://gitee.com/zhu-zichu/zhu-zichu/raw/74f075efe2f8d3c3bb7ba3c2259e403450e4050b/image/banner_4.jpg"
|
||||||
|
onStatusChanged:{
|
||||||
|
if(status === Image.Error){
|
||||||
|
showError("图片加载失败,请重新加载")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clickErrorListener: function(){
|
||||||
|
source = "https://gitee.com/zhu-zichu/zhu-zichu/raw/74f075efe2f8d3c3bb7ba3c2259e403450e4050b/image/banner_1.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluImage{
|
||||||
|
width: 400
|
||||||
|
height: 300
|
||||||
|
source: "https://gitee.com/zhu-zichu/zhu-zichu/raw/74f075efe2f8d3c3bb7ba3c2259e403450e4050b/image/banner_1.jpg"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -12,32 +12,71 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 260
|
height: 110
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 20
|
spacing: 10
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
FluText{
|
||||||
|
text: "indeterminate = true"
|
||||||
|
}
|
||||||
FluProgressBar{
|
FluProgressBar{
|
||||||
}
|
}
|
||||||
FluProgressRing{
|
FluProgressRing{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluProgressBar{
|
||||||
|
|
||||||
|
}
|
||||||
|
FluProgressRing{
|
||||||
|
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 230
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 10
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluText{
|
||||||
|
text: "indeterminate = false"
|
||||||
|
}
|
||||||
FluProgressBar{
|
FluProgressBar{
|
||||||
id:progress_bar
|
|
||||||
indeterminate: false
|
indeterminate: false
|
||||||
|
progress: slider.value/100
|
||||||
}
|
}
|
||||||
FluProgressRing{
|
FluProgressRing{
|
||||||
id:progress_ring
|
|
||||||
indeterminate: false
|
indeterminate: false
|
||||||
|
progress: slider.value/100
|
||||||
|
}
|
||||||
|
FluProgressBar{
|
||||||
|
indeterminate: false
|
||||||
|
progressVisible: true
|
||||||
|
progress: slider.value/100
|
||||||
|
}
|
||||||
|
FluProgressRing{
|
||||||
|
indeterminate: false
|
||||||
|
progressVisible: true
|
||||||
|
progress: slider.value/100
|
||||||
}
|
}
|
||||||
FluSlider{
|
FluSlider{
|
||||||
onValueChanged:{
|
id:slider
|
||||||
var progress = value/100
|
|
||||||
progress_bar.progress = progress
|
|
||||||
progress_ring.progress = progress
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
value = 50
|
value = 50
|
||||||
}
|
}
|
||||||
@ -48,22 +87,14 @@ FluScrollablePage{
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: -1
|
Layout.topMargin: -1
|
||||||
code:'FluProgressBar{
|
code:'FluProgressBar{
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FluProgressRing{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FluProgressBar{
|
|
||||||
indeterminate: false
|
indeterminate: false
|
||||||
}
|
}
|
||||||
|
|
||||||
FluProgressRing{
|
FluProgressRing{
|
||||||
indeterminate: false
|
indeterminate: false
|
||||||
}'
|
progressVisible: true
|
||||||
|
}
|
||||||
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 480
|
height: 460
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
Column{
|
Column{
|
||||||
|
@ -5,8 +5,10 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///example/qml/component"
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
FluRemoteLoader{
|
FluPage{
|
||||||
property int pageMode: FluNavigationView.SingleTop
|
pageMode: FluNavigationView.SingleTop
|
||||||
property string url: ''
|
FluRemoteLoader{
|
||||||
source: "https://zhu-zichu.gitee.io/T_RemoteLoader.qml"
|
anchors.fill: parent
|
||||||
|
source: "https://zhu-zichu.gitee.io/T_RemoteLoader.qml"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,10 @@ FluContentPage{
|
|||||||
age:getRandomAge(),
|
age:getRandomAge(),
|
||||||
address: getRandomAddresses(),
|
address: getRandomAddresses(),
|
||||||
nickname: getRandomNickname(),
|
nickname: getRandomNickname(),
|
||||||
height:40,
|
longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好",
|
||||||
minimumHeight:40,
|
height:42,
|
||||||
maximumHeight:200,
|
minimumHeight:42,
|
||||||
|
maximumHeight:300,
|
||||||
action:com_action
|
action:com_action
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -136,6 +137,13 @@ FluContentPage{
|
|||||||
minimumWidth:80,
|
minimumWidth:80,
|
||||||
maximumWidth:200
|
maximumWidth:200
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '长字符串',
|
||||||
|
dataIndex: 'longstring',
|
||||||
|
width:200,
|
||||||
|
minimumWidth:100,
|
||||||
|
maximumWidth:300
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
|
@ -166,6 +166,41 @@ FluScrollablePage{
|
|||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
FluSpinBox{
|
||||||
|
Layout.topMargin: 20
|
||||||
|
disabled: spin_box_switch.checked
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row{
|
||||||
|
spacing: 5
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:spin_box_switch
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluSpinBox{
|
||||||
|
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
function generateRandomNames(numNames) {
|
function generateRandomNames(numNames) {
|
||||||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
@ -4,6 +4,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Qt.labs.platform
|
import Qt.labs.platform
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import example
|
||||||
import "qrc:///example/qml/component"
|
import "qrc:///example/qml/component"
|
||||||
import "qrc:///example/qml/global"
|
import "qrc:///example/qml/global"
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ CustomWindow {
|
|||||||
height: 640
|
height: 640
|
||||||
closeDestory:false
|
closeDestory:false
|
||||||
minimumWidth: 520
|
minimumWidth: 520
|
||||||
minimumHeight: 460
|
minimumHeight: 200
|
||||||
appBarVisible: false
|
appBarVisible: false
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ CustomWindow {
|
|||||||
when: flipable.flipped
|
when: flipable.flipped
|
||||||
}
|
}
|
||||||
transitions: Transition {
|
transitions: Transition {
|
||||||
NumberAnimation { target: flipable; property: "flipAngle"; duration: 1000 ; easing.type: Easing.OutQuad}
|
NumberAnimation { target: flipable; property: "flipAngle"; duration: 1000 ; easing.type: Easing.OutCubic}
|
||||||
}
|
}
|
||||||
back: Item{
|
back: Item{
|
||||||
anchors.fill: flipable
|
anchors.fill: flipable
|
||||||
@ -179,7 +180,7 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
transformOrigin: Item.Center
|
transformOrigin: Item.Center
|
||||||
onLoginClicked:{
|
onLogoClicked:{
|
||||||
clickCount += 1
|
clickCount += 1
|
||||||
if(clickCount === 1){
|
if(clickCount === 1){
|
||||||
loader.reload()
|
loader.reload()
|
||||||
@ -207,55 +208,12 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Image{
|
CircularReveal{
|
||||||
id:img_cache
|
id:reveal
|
||||||
visible: false
|
target:window.contentItem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
onImageChanged: {
|
||||||
|
changeDark()
|
||||||
Canvas{
|
|
||||||
id:canvas
|
|
||||||
anchors.fill: parent
|
|
||||||
property int centerX: canvas.width / 2
|
|
||||||
property int centerY: canvas.height / 2
|
|
||||||
property real radius: 0
|
|
||||||
property int maxRadius: 0
|
|
||||||
property url imageUrl
|
|
||||||
Behavior on radius{
|
|
||||||
id:anim_radius
|
|
||||||
NumberAnimation {
|
|
||||||
target: canvas
|
|
||||||
property: "radius"
|
|
||||||
duration: 333
|
|
||||||
easing.type: Easing.OutCubic
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onRadiusChanged: {
|
|
||||||
canvas.requestPaint()
|
|
||||||
}
|
|
||||||
onPaint: {
|
|
||||||
var ctx = canvas.getContext("2d");
|
|
||||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
||||||
ctx.clearRect(0, 0, canvasSize.width, canvasSize.height);
|
|
||||||
ctx.save()
|
|
||||||
if(img_cache.source.toString().length!==0){
|
|
||||||
try{
|
|
||||||
ctx.drawImage(img_cache.source, 0, 0, canvasSize.width, canvasSize.height, 0, 0, canvasSize.width, canvasSize.height)
|
|
||||||
}catch(e){
|
|
||||||
img_cache.source = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
clearArc(ctx, centerX, centerY, radius)
|
|
||||||
canvas.unloadImage(img_cache.source)
|
|
||||||
ctx.restore()
|
|
||||||
}
|
|
||||||
function clearArc(ctx,x, y, radius, startAngle, endAngle) {
|
|
||||||
ctx.beginPath()
|
|
||||||
ctx.globalCompositeOperation = 'destination-out'
|
|
||||||
ctx.fillStyle = 'black'
|
|
||||||
ctx.arc(x, y, radius, 0, 2*Math.PI);
|
|
||||||
ctx.fill();
|
|
||||||
ctx.closePath();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,32 +222,23 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDarkChanged(button){
|
function handleDarkChanged(button){
|
||||||
var changeDark = function(){
|
if(FluTools.isMacos()){
|
||||||
if(FluTheme.dark){
|
changeDark()
|
||||||
FluTheme.darkMode = FluDarkMode.Light
|
}else{
|
||||||
}else{
|
|
||||||
FluTheme.darkMode = FluDarkMode.Dark
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(FluTools.isWin()){
|
|
||||||
var target = window.contentItem
|
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
|
||||||
canvas.maxRadius = Math.max(distance(mouseX,mouseY,0,0),distance(mouseX,mouseY,target.width,0),distance(mouseX,mouseY,0,target.height),distance(mouseX,mouseY,target.width,target.height))
|
var radius = Math.max(distance(mouseX,mouseY,0,0),distance(mouseX,mouseY,target.width,0),distance(mouseX,mouseY,0,target.height),distance(mouseX,mouseY,target.width,target.height))
|
||||||
target.grabToImage(function(result) {
|
reveal.start(reveal.width*Screen.devicePixelRatio,reveal.height*Screen.devicePixelRatio,Qt.point(mouseX,mouseY),radius)
|
||||||
img_cache.source = result.url
|
}
|
||||||
canvas.requestPaint()
|
}
|
||||||
changeDark()
|
|
||||||
canvas.centerX = mouseX
|
function changeDark(){
|
||||||
canvas.centerY = mouseY
|
if(FluTheme.dark){
|
||||||
anim_radius.enabled = false
|
FluTheme.darkMode = FluDarkMode.Light
|
||||||
canvas.radius = 0
|
|
||||||
anim_radius.enabled = true
|
|
||||||
canvas.radius = canvas.maxRadius
|
|
||||||
},canvas.canvasSize)
|
|
||||||
}else{
|
}else{
|
||||||
changeDark()
|
FluTheme.darkMode = FluDarkMode.Dark
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
45
example/src/component/CircularReveal.cpp
Normal file
45
example/src/component/CircularReveal.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include "CircularReveal.h"
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QQuickItemGrabResult>
|
||||||
|
#include <QPainterPath>
|
||||||
|
|
||||||
|
CircularReveal::CircularReveal(QQuickItem* parent) : QQuickPaintedItem(parent)
|
||||||
|
{
|
||||||
|
_anim = new QPropertyAnimation(this, "radius", this);
|
||||||
|
_anim->setDuration(333);
|
||||||
|
_anim->setEasingCurve(QEasingCurve::OutCubic);
|
||||||
|
connect(_anim, &QPropertyAnimation::finished,this,[=](){
|
||||||
|
setVisible(false);
|
||||||
|
});
|
||||||
|
connect(this,&CircularReveal::radiusChanged,this,[=](){
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void CircularReveal::paint(QPainter* painter)
|
||||||
|
{
|
||||||
|
painter->save();
|
||||||
|
painter->drawImage(QRect(0, 0, static_cast<int>(width()), static_cast<int>(height())), _source);
|
||||||
|
QPainterPath path;
|
||||||
|
path.moveTo(_center.x(),_center.y());
|
||||||
|
path.addEllipse(QPointF(_center.x(),_center.y()), _radius, _radius);
|
||||||
|
painter->setCompositionMode(QPainter::CompositionMode_Clear);
|
||||||
|
painter->fillPath(path, Qt::black);
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CircularReveal::start(int w,int h,const QPoint& center,int radius){
|
||||||
|
_anim->setStartValue(0);
|
||||||
|
_anim->setEndValue(radius);
|
||||||
|
_center = center;
|
||||||
|
_grabResult = _target->grabToImage(QSize(w,h));
|
||||||
|
connect(_grabResult.data(), &QQuickItemGrabResult::ready, this, &CircularReveal::handleGrabResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CircularReveal::handleGrabResult(){
|
||||||
|
_grabResult.data()->image().swap(_source);
|
||||||
|
update();
|
||||||
|
setVisible(true);
|
||||||
|
Q_EMIT imageChanged();
|
||||||
|
_anim->start();
|
||||||
|
}
|
28
example/src/component/CircularReveal.h
Normal file
28
example/src/component/CircularReveal.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef CIRCULARREVEAL_H
|
||||||
|
#define CIRCULARREVEAL_H
|
||||||
|
|
||||||
|
#include <QQuickItem>
|
||||||
|
#include <QQuickPaintedItem>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPropertyAnimation>
|
||||||
|
#include "src/stdafx.h"
|
||||||
|
|
||||||
|
class CircularReveal : public QQuickPaintedItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY_AUTO(QQuickItem*,target)
|
||||||
|
Q_PROPERTY_AUTO(int,radius)
|
||||||
|
public:
|
||||||
|
CircularReveal(QQuickItem* parent = nullptr);
|
||||||
|
void paint(QPainter* painter) override;
|
||||||
|
Q_INVOKABLE void start(int w,int h,const QPoint& center,int radius);
|
||||||
|
Q_SIGNAL void imageChanged();
|
||||||
|
Q_SLOT void handleGrabResult();
|
||||||
|
private:
|
||||||
|
QImage _source;
|
||||||
|
QPropertyAnimation* _anim;
|
||||||
|
QPoint _center;
|
||||||
|
QSharedPointer<QQuickItemGrabResult> _grabResult;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CIRCULARREVEAL_H
|
@ -6,6 +6,7 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||||
|
#include "src/component/CircularReveal.h"
|
||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
|
|
||||||
FRAMELESSHELPER_USE_NAMESPACE
|
FRAMELESSHELPER_USE_NAMESPACE
|
||||||
@ -37,6 +38,8 @@ int main(int argc, char *argv[])
|
|||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
FramelessHelper::Quick::registerTypes(&engine);
|
FramelessHelper::Quick::registerTypes(&engine);
|
||||||
|
qmlRegisterType<CircularReveal>("example", 1, 0, "CircularReveal");
|
||||||
|
|
||||||
appInfo->init(&engine);
|
appInfo->init(&engine);
|
||||||
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||||
|
@ -12,7 +12,7 @@ endif()
|
|||||||
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,7,0)
|
add_definitions(-DVERSION=1,3,7,3)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
||||||
|
|
||||||
|
@ -39,13 +39,13 @@ ComboBox {
|
|||||||
}
|
}
|
||||||
contentItem: T.TextField {
|
contentItem: T.TextField {
|
||||||
property bool disabled: !control.editable
|
property bool disabled: !control.editable
|
||||||
leftPadding: !control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
|
leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
|
||||||
rightPadding: control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
|
rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
|
||||||
topPadding: 6 - control.padding
|
topPadding: 6 - control.padding
|
||||||
bottomPadding: 6 - control.padding
|
bottomPadding: 6 - control.padding
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
selectedTextColor: control.palette.highlightedText
|
selectedTextColor: color
|
||||||
text: control.editable ? control.editText : control.displayText
|
text: control.editable ? control.editText : control.displayText
|
||||||
enabled: control.editable
|
enabled: control.editable
|
||||||
autoScroll: control.editable
|
autoScroll: control.editable
|
||||||
@ -67,17 +67,16 @@ ComboBox {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
}
|
}
|
||||||
Keys.onEnterPressed: {
|
Keys.onEnterPressed: (event)=> handleCommit(event)
|
||||||
control.commit()
|
Keys.onReturnPressed:(event)=> handleCommit(event)
|
||||||
}
|
function handleCommit(event){
|
||||||
Keys.onReturnPressed: {
|
|
||||||
control.commit()
|
control.commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 140
|
implicitWidth: 140
|
||||||
implicitHeight: 28
|
implicitHeight: 32
|
||||||
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
visible: !control.flat || control.down
|
visible: !control.flat || control.down
|
||||||
|
@ -15,9 +15,9 @@ TextEdit {
|
|||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
selectedTextColor: FluColors.Grey220
|
selectedTextColor: color
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
onSelectedTextChanged: {
|
onSelectedTextChanged: {
|
||||||
control.forceActiveFocus()
|
control.forceActiveFocus()
|
||||||
|
@ -9,10 +9,8 @@ Item {
|
|||||||
property int contentHeight : 300
|
property int contentHeight : 300
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
id:control
|
id:control
|
||||||
height: layout_header.height + container.height
|
implicitHeight: Math.max((layout_header.height + container.height),layout_header.height)
|
||||||
width: 400
|
implicitWidth: 400
|
||||||
implicitWidth: width
|
|
||||||
implicitHeight: height
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:layout_header
|
id:layout_header
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -58,29 +56,66 @@ Item {
|
|||||||
Behavior on rotation {
|
Behavior on rotation {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle{
|
Item{
|
||||||
id:container
|
|
||||||
width: parent.width
|
|
||||||
clip: true
|
|
||||||
anchors{
|
anchors{
|
||||||
top: layout_header.bottom
|
top: layout_header.bottom
|
||||||
topMargin: -1
|
topMargin: -1
|
||||||
left: layout_header.left
|
left: layout_header.left
|
||||||
}
|
}
|
||||||
radius: 4
|
width: parent.width
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
clip: true
|
||||||
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
visible: contentHeight+container.y !== 0
|
||||||
height: expand ? contentHeight : 0
|
height: contentHeight+container.y
|
||||||
Behavior on height {
|
Rectangle{
|
||||||
NumberAnimation{
|
id:container
|
||||||
duration: 167
|
width: parent.width
|
||||||
easing.type: Easing.InCubic
|
height: parent.height
|
||||||
}
|
radius: 4
|
||||||
|
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||||
|
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
|
y: -contentHeight
|
||||||
|
states: [
|
||||||
|
State{
|
||||||
|
name:"expand"
|
||||||
|
when: control.expand
|
||||||
|
PropertyChanges {
|
||||||
|
target: container
|
||||||
|
y:0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State{
|
||||||
|
name:"collapsed"
|
||||||
|
when: !control.expand
|
||||||
|
PropertyChanges {
|
||||||
|
target: container
|
||||||
|
y:-contentHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
to:"expand"
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "y"
|
||||||
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
to:"collapsed"
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "y"
|
||||||
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
44
src/imports/FluentUI/Controls/FluImage.qml
Normal file
44
src/imports/FluentUI/Controls/FluImage.qml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Item {
|
||||||
|
property alias sourceSize : image.sourceSize
|
||||||
|
property alias fillMode : image.fillMode
|
||||||
|
property url source
|
||||||
|
property string errorButtonText: "重新加载"
|
||||||
|
property var status
|
||||||
|
property var clickErrorListener : function(){
|
||||||
|
image.source = ""
|
||||||
|
image.source = control.source
|
||||||
|
}
|
||||||
|
id: control
|
||||||
|
Image{
|
||||||
|
id:image
|
||||||
|
anchors.fill: parent
|
||||||
|
source: control.source
|
||||||
|
opacity: control.status === Image.Ready
|
||||||
|
onStatusChanged:{
|
||||||
|
control.status = image.status
|
||||||
|
}
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation{
|
||||||
|
duration: 83
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rectangle{
|
||||||
|
anchors.fill: parent
|
||||||
|
color: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||||
|
FluProgressRing{
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: control.status === Image.Loading
|
||||||
|
}
|
||||||
|
FluFilledButton{
|
||||||
|
text: control.errorButtonText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: control.status === Image.Error
|
||||||
|
onClicked: clickErrorListener()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -22,8 +22,11 @@ TextArea{
|
|||||||
}
|
}
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
|
padding: 8
|
||||||
|
leftPadding: padding+2
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectedTextColor: color
|
||||||
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
placeholderTextColor: {
|
placeholderTextColor: {
|
||||||
if(!enabled){
|
if(!enabled){
|
||||||
return placeholderDisableColor
|
return placeholderDisableColor
|
||||||
@ -35,11 +38,17 @@ TextArea{
|
|||||||
}
|
}
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
background: FluTextBoxBackground{ inputItem: control }
|
background: FluTextBoxBackground{ inputItem: control }
|
||||||
Keys.onEnterPressed: {
|
Keys.onEnterPressed: (event)=> d.handleCommit(event)
|
||||||
control.commit()
|
Keys.onReturnPressed:(event)=> d.handleCommit(event)
|
||||||
}
|
QtObject{
|
||||||
Keys.onBackPressed: {
|
id:d
|
||||||
control.commit()
|
function handleCommit(event){
|
||||||
|
if(event.modifiers & Qt.ControlModifier){
|
||||||
|
insert(control.cursorPosition, "\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -27,7 +27,7 @@ Item {
|
|||||||
property Component autoSuggestBox
|
property Component autoSuggestBox
|
||||||
property Component actionItem
|
property Component actionItem
|
||||||
property int topPadding: 0
|
property int topPadding: 0
|
||||||
signal loginClicked
|
signal logoClicked
|
||||||
id:control
|
id:control
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
@ -118,11 +118,6 @@ Item {
|
|||||||
}
|
}
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
Behavior on height {
|
|
||||||
NumberAnimation{
|
|
||||||
duration: 83
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
@ -242,7 +237,8 @@ Item {
|
|||||||
}
|
}
|
||||||
Behavior on rotation {
|
Behavior on rotation {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 83
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -564,7 +560,7 @@ Item {
|
|||||||
Behavior on Layout.preferredWidth {
|
Behavior on Layout.preferredWidth {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.InCubic
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -584,7 +580,7 @@ Item {
|
|||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
loginClicked()
|
logoClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -630,7 +626,7 @@ Item {
|
|||||||
Behavior on anchors.leftMargin {
|
Behavior on anchors.leftMargin {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.InCubic
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StackView{
|
StackView{
|
||||||
@ -685,13 +681,13 @@ Item {
|
|||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.InCubic
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on x {
|
Behavior on x {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.InCubic
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visible: {
|
visible: {
|
||||||
@ -751,27 +747,8 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListView{
|
Flickable{
|
||||||
id:nav_list
|
id:layout_flickable
|
||||||
clip: true
|
|
||||||
ScrollBar.vertical: FluScrollBar {}
|
|
||||||
model:d.handleItems()
|
|
||||||
highlightMoveDuration: 167
|
|
||||||
highlight: Item{
|
|
||||||
clip: true
|
|
||||||
Rectangle{
|
|
||||||
height: 18
|
|
||||||
radius: 1.5
|
|
||||||
color: FluTheme.primaryColor.dark
|
|
||||||
width: 3
|
|
||||||
anchors{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: 6
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
currentIndex: -1
|
|
||||||
anchors{
|
anchors{
|
||||||
top: layout_header.bottom
|
top: layout_header.bottom
|
||||||
topMargin: 6
|
topMargin: 6
|
||||||
@ -779,29 +756,58 @@ Item {
|
|||||||
right: parent.right
|
right: parent.right
|
||||||
bottom: layout_footer.top
|
bottom: layout_footer.top
|
||||||
}
|
}
|
||||||
delegate: Loader{
|
boundsBehavior: ListView.StopAtBounds
|
||||||
property var model: modelData
|
clip: true
|
||||||
property var idx: index
|
contentHeight: nav_list.contentHeight
|
||||||
property int type: 0
|
ScrollBar.vertical: FluScrollBar {}
|
||||||
sourceComponent: {
|
ListView{
|
||||||
if(modelData instanceof FluPaneItem){
|
id:nav_list
|
||||||
return com_panel_item
|
clip: true
|
||||||
|
anchors.fill: parent
|
||||||
|
model:d.handleItems()
|
||||||
|
boundsBehavior: ListView.StopAtBounds
|
||||||
|
highlightMoveDuration: 167
|
||||||
|
highlight: Item{
|
||||||
|
clip: true
|
||||||
|
Rectangle{
|
||||||
|
height: 18
|
||||||
|
radius: 1.5
|
||||||
|
color: FluTheme.primaryColor.dark
|
||||||
|
width: 3
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: 6
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(modelData instanceof FluPaneItemHeader){
|
}
|
||||||
return com_panel_item_header
|
currentIndex: -1
|
||||||
}
|
|
||||||
if(modelData instanceof FluPaneItemSeparator){
|
delegate: Loader{
|
||||||
return com_panel_item_separatorr
|
property var model: modelData
|
||||||
}
|
property var idx: index
|
||||||
if(modelData instanceof FluPaneItemExpander){
|
property int type: 0
|
||||||
return com_panel_item_expander
|
sourceComponent: {
|
||||||
}
|
if(modelData instanceof FluPaneItem){
|
||||||
if(modelData instanceof FluPaneItemEmpty){
|
return com_panel_item
|
||||||
return com_panel_item_empty
|
}
|
||||||
|
if(modelData instanceof FluPaneItemHeader){
|
||||||
|
return com_panel_item_header
|
||||||
|
}
|
||||||
|
if(modelData instanceof FluPaneItemSeparator){
|
||||||
|
return com_panel_item_separatorr
|
||||||
|
}
|
||||||
|
if(modelData instanceof FluPaneItemExpander){
|
||||||
|
return com_panel_item_expander
|
||||||
|
}
|
||||||
|
if(modelData instanceof FluPaneItemEmpty){
|
||||||
|
return com_panel_item_empty
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView{
|
ListView{
|
||||||
id:layout_footer
|
id:layout_footer
|
||||||
clip: true
|
clip: true
|
||||||
@ -809,6 +815,7 @@ Item {
|
|||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
interactive: false
|
interactive: false
|
||||||
|
boundsBehavior: ListView.StopAtBounds
|
||||||
currentIndex: -1
|
currentIndex: -1
|
||||||
model: {
|
model: {
|
||||||
if(footerItems){
|
if(footerItems){
|
||||||
@ -958,6 +965,13 @@ Item {
|
|||||||
control_popup.open()
|
control_popup.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Component{
|
||||||
|
id:com_placeholder
|
||||||
|
Item{
|
||||||
|
property int pageMode: FluNavigationView.SingleInstance
|
||||||
|
property string url
|
||||||
|
}
|
||||||
|
}
|
||||||
function collapseAll(){
|
function collapseAll(){
|
||||||
for(var i=0;i<nav_list.model.length;i++){
|
for(var i=0;i<nav_list.model.length;i++){
|
||||||
var item = nav_list.model[i]
|
var item = nav_list.model[i]
|
||||||
@ -976,18 +990,8 @@ Item {
|
|||||||
function getItems(){
|
function getItems(){
|
||||||
return nav_list.model
|
return nav_list.model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_placeholder
|
|
||||||
Item{
|
|
||||||
property int pageMode: FluNavigationView.SingleInstance
|
|
||||||
property string url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function push(url,argument={}){
|
function push(url,argument={}){
|
||||||
let page = nav_swipe.find(function(item) {
|
var page = nav_swipe.find(function(item) {
|
||||||
return item.url === url;
|
return item.url === url;
|
||||||
})
|
})
|
||||||
if(page){
|
if(page){
|
||||||
@ -1009,22 +1013,22 @@ Item {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var comp = Qt.createComponent(url)
|
|
||||||
if (comp.status === Component.Ready) {
|
var pageIndex = -1
|
||||||
//先判断nav_swipe2中是否有当前url数据
|
for(var i=0;i<nav_swipe2.children.length;i++){
|
||||||
var pageIndex = -1
|
var item = nav_swipe2.children[i]
|
||||||
for(var i=0;i<nav_swipe2.children.length;i++){
|
if(item.url === url){
|
||||||
var item = nav_swipe2.children[i]
|
pageIndex = i
|
||||||
if(item.url === url){
|
break
|
||||||
pageIndex = i
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var options = Object.assign(argument,{url:url})
|
}
|
||||||
if(pageIndex!==-1){
|
var options = Object.assign(argument,{url:url})
|
||||||
nav_swipe2.currentIndex = pageIndex
|
if(pageIndex!==-1){
|
||||||
nav_swipe.push(com_placeholder,options)
|
nav_swipe2.currentIndex = pageIndex
|
||||||
}else{
|
nav_swipe.push(com_placeholder,options)
|
||||||
|
}else{
|
||||||
|
var comp = Qt.createComponent(url)
|
||||||
|
if (comp.status === Component.Ready) {
|
||||||
var obj = comp.createObject(nav_swipe,options)
|
var obj = comp.createObject(nav_swipe,options)
|
||||||
if(obj.pageMode === FluNavigationView.SingleInstance){
|
if(obj.pageMode === FluNavigationView.SingleInstance){
|
||||||
nav_swipe.push(com_placeholder,options)
|
nav_swipe.push(com_placeholder,options)
|
||||||
@ -1033,11 +1037,11 @@ Item {
|
|||||||
}else{
|
}else{
|
||||||
nav_swipe.push(obj)
|
nav_swipe.push(obj)
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
console.error(comp.errorString())
|
||||||
}
|
}
|
||||||
d.stackItems.push(nav_list.model[nav_list.currentIndex])
|
|
||||||
}else{
|
|
||||||
console.error(comp.errorString())
|
|
||||||
}
|
}
|
||||||
|
d.stackItems.push(nav_list.model[nav_list.currentIndex])
|
||||||
}
|
}
|
||||||
function getCurrentIndex(){
|
function getCurrentIndex(){
|
||||||
return nav_list.currentIndex
|
return nav_list.currentIndex
|
||||||
|
@ -6,17 +6,28 @@ import FluentUI
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
property int pageMode: FluNavigationView.SingleTop
|
property int pageMode: FluNavigationView.SingleTop
|
||||||
|
property bool animDisabled: false
|
||||||
property string url : ""
|
property string url : ""
|
||||||
id: control
|
id: control
|
||||||
opacity: visible
|
opacity: visible
|
||||||
visible: false
|
visible: false
|
||||||
Behavior on opacity{
|
Behavior on opacity{
|
||||||
|
enabled: !animDisabled
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 83
|
duration: 167
|
||||||
|
}
|
||||||
|
}
|
||||||
|
transform: Translate {
|
||||||
|
y: control.visible ? 0 : 80
|
||||||
|
Behavior on y{
|
||||||
|
enabled: !animDisabled
|
||||||
|
NumberAnimation{
|
||||||
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
visible = true
|
visible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,12 @@ TextField{
|
|||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
|
padding: 8
|
||||||
|
leftPadding: padding+2
|
||||||
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
|
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
|
selectedTextColor: color
|
||||||
placeholderTextColor: {
|
placeholderTextColor: {
|
||||||
if(!enabled){
|
if(!enabled){
|
||||||
return placeholderDisableColor
|
return placeholderDisableColor
|
||||||
@ -51,11 +54,13 @@ TextField{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Keys.onEnterPressed: {
|
Keys.onEnterPressed: (event)=> d.handleCommit(event)
|
||||||
control.commit()
|
Keys.onReturnPressed:(event)=> d.handleCommit(event)
|
||||||
}
|
QtObject{
|
||||||
Keys.onBackPressed: {
|
id:d
|
||||||
control.commit()
|
function handleCommit(event){
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
id:btn_reveal
|
id:btn_reveal
|
||||||
|
@ -40,7 +40,7 @@ Item {
|
|||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.InCubic
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ Popup {
|
|||||||
from:1.2
|
from:1.2
|
||||||
to:1
|
to:1
|
||||||
duration: 83
|
duration: 83
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
@ -35,6 +36,7 @@ Popup {
|
|||||||
from:1
|
from:1
|
||||||
to:1.2
|
to:1.2
|
||||||
duration: 83
|
duration: 83
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
|
@ -2,44 +2,67 @@ import QtQuick
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluRectangle {
|
Item{
|
||||||
|
|
||||||
property real progress: 0.5
|
property real progress: 0.5
|
||||||
property bool indeterminate: true
|
property bool indeterminate: true
|
||||||
|
property bool progressVisible: false
|
||||||
id: control
|
id: control
|
||||||
width: 150
|
width: 150
|
||||||
height: 5
|
height: 5
|
||||||
radius: [3,3,3,3]
|
|
||||||
clip: true
|
FluRectangle {
|
||||||
color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
shadow: false
|
||||||
Component.onCompleted: {
|
radius: [3,3,3,3]
|
||||||
if(indeterminate){
|
anchors.fill: parent
|
||||||
bar.x = -control.width*0.5
|
color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
||||||
behavior.enabled = true
|
Component.onCompleted: {
|
||||||
bar.x = control.width
|
if(indeterminate){
|
||||||
}else{
|
bar.x = -control.width*0.5
|
||||||
bar.x = 0
|
behavior.enabled = true
|
||||||
|
bar.x = control.width
|
||||||
|
}else{
|
||||||
|
bar.x = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
Rectangle{
|
||||||
Rectangle{
|
id:bar
|
||||||
id:bar
|
radius: 3
|
||||||
radius: 3
|
width: control.width*progress
|
||||||
width: control.width*progress
|
height: control.height
|
||||||
height: control.height
|
color:FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
color:FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
Behavior on x{
|
||||||
Behavior on x{
|
id:behavior
|
||||||
id:behavior
|
enabled: false
|
||||||
enabled: false
|
NumberAnimation{
|
||||||
NumberAnimation{
|
duration: 1000
|
||||||
duration: 1000
|
onRunningChanged: {
|
||||||
onRunningChanged: {
|
if(!running){
|
||||||
if(!running){
|
behavior.enabled = false
|
||||||
behavior.enabled = false
|
bar.x = -control.width*0.5
|
||||||
bar.x = -control.width*0.5
|
behavior.enabled = true
|
||||||
behavior.enabled = true
|
bar.x = control.width
|
||||||
bar.x = control.width
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
text:(control.progress * 100).toFixed(0) + "%"
|
||||||
|
font.pixelSize: 10
|
||||||
|
visible: {
|
||||||
|
if(control.indeterminate){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return control.progressVisible
|
||||||
|
}
|
||||||
|
anchors{
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: control.width+5
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property real linWidth : width/8
|
property real linWidth : 5
|
||||||
property real progress: 0.25
|
property real progress: 0.25
|
||||||
property bool indeterminate: true
|
property bool indeterminate: true
|
||||||
readonly property real radius2 : radius - linWidth/2
|
|
||||||
property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
|
property bool progressVisible: false
|
||||||
id: control
|
id: control
|
||||||
width: 44
|
width: 44
|
||||||
height: 44
|
height: 44
|
||||||
@ -24,6 +24,10 @@ Rectangle {
|
|||||||
control.rotation = 360
|
control.rotation = 360
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
QtObject{
|
||||||
|
id:d
|
||||||
|
property real _radius: control.radius-control.linWidth/2
|
||||||
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target: FluTheme
|
target: FluTheme
|
||||||
function onDarkChanged(){
|
function onDarkChanged(){
|
||||||
@ -35,8 +39,6 @@ Rectangle {
|
|||||||
enabled: false
|
enabled: false
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 999
|
duration: 999
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [0.55,0.55,0,1]
|
|
||||||
onRunningChanged: {
|
onRunningChanged: {
|
||||||
if(!running){
|
if(!running){
|
||||||
behavior.enabled = false
|
behavior.enabled = false
|
||||||
@ -53,18 +55,29 @@ Rectangle {
|
|||||||
antialiasing: true
|
antialiasing: true
|
||||||
renderTarget: Canvas.Image
|
renderTarget: Canvas.Image
|
||||||
onPaint: {
|
onPaint: {
|
||||||
var ctx = canvas.getContext("2d");
|
var ctx = canvas.getContext("2d")
|
||||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
ctx.setTransform(1, 0, 0, 1, 0, 0)
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
||||||
ctx.save();
|
ctx.save()
|
||||||
ctx.lineWidth = linWidth;
|
ctx.lineWidth = linWidth
|
||||||
ctx.strokeStyle = primaryColor;
|
ctx.strokeStyle = primaryColor
|
||||||
ctx.fillStyle = primaryColor;
|
ctx.fillStyle = primaryColor
|
||||||
ctx.beginPath();
|
ctx.beginPath()
|
||||||
ctx.arc(width/2, height/2, radius2 ,-0.5 * Math.PI,-0.5 * Math.PI + progress * 2 * Math.PI);
|
ctx.arc(width/2, height/2, d._radius ,-0.5 * Math.PI,-0.5 * Math.PI + progress * 2 * Math.PI)
|
||||||
ctx.stroke();
|
ctx.stroke()
|
||||||
ctx.closePath();
|
ctx.closePath()
|
||||||
ctx.restore();
|
ctx.restore()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluText{
|
||||||
|
text:(control.progress * 100).toFixed(0) + "%"
|
||||||
|
font.pixelSize: 10
|
||||||
|
visible: {
|
||||||
|
if(control.indeterminate){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return control.progressVisible
|
||||||
|
}
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,7 @@ Button {
|
|||||||
Behavior on border.width {
|
Behavior on border.width {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.OutCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
border.color: {
|
border.color: {
|
||||||
|
@ -1,189 +1,89 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls.Basic
|
import QtQuick.Controls.impl
|
||||||
|
import QtQuick.Templates as T
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
ScrollBar {
|
T.ScrollBar {
|
||||||
property color handleNormalColor: Qt.rgba(134/255,134/255,134/255,1)
|
|
||||||
property color handleHoverColor: Qt.lighter(handleNormalColor)
|
|
||||||
property color handlePressColor: Qt.darker(handleNormalColor)
|
|
||||||
property bool expand: false
|
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
|
property color color : FluTheme.dark ? Qt.rgba(159/255,159/255,159/255,1) : Qt.rgba(138/255,138/255,138/255,1)
|
||||||
|
property color pressedColor: FluTheme.dark ? Qt.darker(color,1.2) : Qt.lighter(color,1.2)
|
||||||
|
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
implicitContentWidth + leftPadding + rightPadding)
|
implicitContentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
implicitContentHeight + topPadding + bottomPadding)
|
implicitContentHeight + topPadding + bottomPadding)
|
||||||
visible: control.policy !== ScrollBar.AlwaysOff
|
|
||||||
minimumSize: 0.3
|
padding: 2
|
||||||
topPadding:{
|
visible: control.policy !== T.ScrollBar.AlwaysOff
|
||||||
if(vertical){
|
minimumSize: Math.max(orientation === Qt.Horizontal ? height / width : width / height,0.3)
|
||||||
if(expand)
|
contentItem: Item {
|
||||||
return 15
|
property bool collapsed: (control.policy === T.ScrollBar.AlwaysOn || (control.active && control.size < 1.0))
|
||||||
return 2
|
implicitWidth: control.interactive ? 6 : 2
|
||||||
}else{
|
implicitHeight: control.interactive ? 6 : 2
|
||||||
if(expand){
|
|
||||||
return 2
|
Rectangle{
|
||||||
}
|
id:rect_bar
|
||||||
return 4
|
width: vertical ? 2 : parent.width
|
||||||
}
|
height: horizontal ? 2 : parent.height
|
||||||
}
|
color:{
|
||||||
bottomPadding:{
|
if(control.pressed){
|
||||||
if(vertical){
|
return control.pressedColor
|
||||||
if(expand)
|
|
||||||
return 15
|
|
||||||
return 2
|
|
||||||
}else{
|
|
||||||
if(expand){
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
return 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
leftPadding:{
|
|
||||||
if(vertical){
|
|
||||||
if(expand){
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
return 4
|
|
||||||
}else{
|
|
||||||
if(expand)
|
|
||||||
return 15
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rightPadding:{
|
|
||||||
if(vertical){
|
|
||||||
if(expand){
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
return 4
|
|
||||||
}else{
|
|
||||||
if(expand)
|
|
||||||
return 15
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on topPadding {
|
|
||||||
NumberAnimation{
|
|
||||||
duration: 150
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on bottomPadding {
|
|
||||||
NumberAnimation{
|
|
||||||
duration: 150
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on leftPadding {
|
|
||||||
NumberAnimation{
|
|
||||||
duration: 150
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Behavior on rightPadding {
|
|
||||||
NumberAnimation{
|
|
||||||
duration: 150
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contentItem: Rectangle {
|
|
||||||
id:item_react
|
|
||||||
implicitWidth: expand ? 8 : 2
|
|
||||||
implicitHeight: expand ? 8 : 2
|
|
||||||
radius: width / 2
|
|
||||||
color: control.pressed?handlePressColor:control.hovered?handleHoverColor:handleNormalColor
|
|
||||||
opacity:(control.policy === ScrollBar.AlwaysOn || control.size < 1.0)?1.0:0.0
|
|
||||||
}
|
|
||||||
background: Rectangle{
|
|
||||||
radius: 5
|
|
||||||
color: {
|
|
||||||
if(expand && item_react.opacity){
|
|
||||||
if(FluTheme.dark){
|
|
||||||
return Qt.rgba(0,0,0,1)
|
|
||||||
}
|
}
|
||||||
return Qt.rgba(1,1,1,1)
|
return control .color
|
||||||
}
|
}
|
||||||
return Qt.rgba(0,0,0,0)
|
anchors{
|
||||||
}
|
right: vertical ? parent.right : undefined
|
||||||
MouseArea{
|
bottom: horizontal ? parent.bottom : undefined
|
||||||
id:mouse_item
|
|
||||||
hoverEnabled: true
|
|
||||||
anchors.fill: parent
|
|
||||||
onEntered: {
|
|
||||||
timer.restart()
|
|
||||||
}
|
}
|
||||||
onExited: {
|
radius: width / 2
|
||||||
timer.restart()
|
visible: control.size < 1.0
|
||||||
|
}
|
||||||
|
states: [
|
||||||
|
State{
|
||||||
|
name:"show"
|
||||||
|
when: contentItem.collapsed
|
||||||
|
PropertyChanges {
|
||||||
|
target: rect_bar
|
||||||
|
width: vertical ? 6 : parent.width
|
||||||
|
height: horizontal ? 6 : parent.height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
,State{
|
||||||
}
|
name:"hide"
|
||||||
Timer{
|
when: !contentItem.collapsed
|
||||||
id:timer
|
PropertyChanges {
|
||||||
interval: 800
|
target: rect_bar
|
||||||
onTriggered: {
|
width: vertical ? 2 : parent.width
|
||||||
expand = mouse_item.containsMouse || btn_top.hovered || btn_bottom.hovered || btn_left.hovered || btn_right.hovered
|
height: horizontal ? 2 : parent.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on implicitWidth {
|
]
|
||||||
NumberAnimation{
|
transitions:[
|
||||||
duration: 150
|
Transition {
|
||||||
}
|
to: "hide"
|
||||||
}
|
SequentialAnimation {
|
||||||
FluIconButton{
|
PauseAnimation { duration: 450 }
|
||||||
id:btn_top
|
NumberAnimation {
|
||||||
iconSource: FluentIcons.CaretSolidUp
|
target: rect_bar
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
properties: vertical ? "width" : "height"
|
||||||
width:10
|
duration: 167
|
||||||
height:10
|
easing.type: Easing.OutCubic
|
||||||
z:100
|
}
|
||||||
iconColor: hovered ? FluColors.Black : FluColors.Grey120
|
}
|
||||||
iconSize: 8
|
}
|
||||||
anchors.top: parent.top
|
,Transition {
|
||||||
anchors.topMargin: 4
|
to: "show"
|
||||||
visible:vertical && expand && item_react.opacity
|
SequentialAnimation{
|
||||||
onClicked:{
|
PauseAnimation { duration: 100 }
|
||||||
decrease()
|
NumberAnimation {
|
||||||
}
|
target: rect_bar
|
||||||
}
|
properties: vertical ? "width" : "height"
|
||||||
FluIconButton{
|
duration: 167
|
||||||
id:btn_bottom
|
easing.type: Easing.OutCubic
|
||||||
iconSource: FluentIcons.CaretSolidDown
|
}
|
||||||
visible:vertical && expand && item_react.opacity
|
}
|
||||||
width:10
|
}
|
||||||
height:10
|
]
|
||||||
iconSize: 8
|
|
||||||
iconColor: hovered ? FluColors.Black : FluColors.Grey120
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.bottomMargin: 4
|
|
||||||
onClicked:{
|
|
||||||
increase()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluIconButton{
|
|
||||||
id:btn_left
|
|
||||||
iconSource: FluentIcons.CaretSolidLeft
|
|
||||||
visible:!vertical && expand && item_react.opacity
|
|
||||||
width:10
|
|
||||||
height:10
|
|
||||||
iconSize: 8
|
|
||||||
iconColor: hovered ? FluColors.Black : FluColors.Grey120
|
|
||||||
anchors.leftMargin: 4
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
onClicked:{
|
|
||||||
decrease()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluIconButton{
|
|
||||||
id:btn_right
|
|
||||||
iconSource: FluentIcons.CaretSolidRight
|
|
||||||
visible:!vertical && expand && item_react.opacity
|
|
||||||
width:10
|
|
||||||
height:10
|
|
||||||
iconSize: 8
|
|
||||||
iconColor: hovered ? FluColors.Black : FluColors.Grey120
|
|
||||||
anchors.rightMargin: 4
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.right: parent.right
|
|
||||||
onClicked:{
|
|
||||||
increase()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,10 @@ FluPage {
|
|||||||
contentWidth: parent.width
|
contentWidth: parent.width
|
||||||
contentHeight: container.height
|
contentHeight: container.height
|
||||||
ScrollBar.vertical: FluScrollBar {
|
ScrollBar.vertical: FluScrollBar {
|
||||||
|
anchors.right: flickview.right
|
||||||
|
anchors.rightMargin: 2
|
||||||
}
|
}
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
anchors{
|
anchors{
|
||||||
top: text_title.bottom
|
top: text_title.bottom
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
|
@ -38,6 +38,7 @@ T.Slider {
|
|||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
160
src/imports/FluentUI/Controls/FluSpinBox.qml
Normal file
160
src/imports/FluentUI/Controls/FluSpinBox.qml
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Rectangle{
|
||||||
|
readonly property string displayText : d._displayText
|
||||||
|
property bool disabled: false
|
||||||
|
property int from: 0
|
||||||
|
property int to: 99
|
||||||
|
property var validator: IntValidator {
|
||||||
|
bottom: Math.min(control.from, control.to)
|
||||||
|
top: Math.max(control.from, control.to)
|
||||||
|
}
|
||||||
|
id:control
|
||||||
|
implicitWidth: 200
|
||||||
|
implicitHeight: 34
|
||||||
|
radius: 4
|
||||||
|
color: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
|
||||||
|
border.width: 1
|
||||||
|
border.color: FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
||||||
|
QtObject{
|
||||||
|
id:d
|
||||||
|
property string _displayText: "0"
|
||||||
|
}
|
||||||
|
Component{
|
||||||
|
id:com_edit
|
||||||
|
FluTextBox{
|
||||||
|
rightPadding: 80
|
||||||
|
closeRightMargin: 55
|
||||||
|
disabled: control.disabled
|
||||||
|
validator: control.validator
|
||||||
|
text: d._displayText
|
||||||
|
Component.onCompleted: {
|
||||||
|
forceActiveFocus()
|
||||||
|
}
|
||||||
|
onCommit: {
|
||||||
|
var number = Number(text)
|
||||||
|
if(number>=control.from && number<=control.to){
|
||||||
|
d._displayText = String(number)
|
||||||
|
}
|
||||||
|
edit_loader.sourceComponent = null
|
||||||
|
}
|
||||||
|
onActiveFocusChanged: {
|
||||||
|
if(!activeFocus){
|
||||||
|
edit_loader.sourceComponent = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluTextBox{
|
||||||
|
id:text_number
|
||||||
|
anchors.fill: parent
|
||||||
|
readOnly: true
|
||||||
|
rightPadding: 80
|
||||||
|
disabled: control.disabled
|
||||||
|
text: control.displayText
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
edit_loader.sourceComponent = com_edit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loader{
|
||||||
|
id:edit_loader
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
FluIconButton{
|
||||||
|
id:btn_up
|
||||||
|
width: 20
|
||||||
|
height: 20
|
||||||
|
iconSize: 16
|
||||||
|
disabled: {
|
||||||
|
if(control.disabled===true){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return Number(control.displayText) === control.to
|
||||||
|
}
|
||||||
|
iconSource: FluentIcons.ChevronUp
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: 30
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
d._displayText = String(Math.min(Number(d._displayText)+1,control.to))
|
||||||
|
}
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
onReleased: {
|
||||||
|
timer.stop()
|
||||||
|
}
|
||||||
|
TapHandler{
|
||||||
|
onTapped: {
|
||||||
|
btn_up.clicked()
|
||||||
|
}
|
||||||
|
onCanceled: {
|
||||||
|
timer.stop()
|
||||||
|
}
|
||||||
|
onLongPressed: {
|
||||||
|
timer.isUp = true
|
||||||
|
timer.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluIconButton{
|
||||||
|
id:btn_down
|
||||||
|
iconSource: FluentIcons.ChevronDown
|
||||||
|
width: 20
|
||||||
|
height: 20
|
||||||
|
disabled: {
|
||||||
|
if(control.disabled === true){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return Number(control.displayText) === control.from
|
||||||
|
}
|
||||||
|
iconSize: 16
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: 5
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
d._displayText = String(Math.max(Number(d._displayText)-1,control.from))
|
||||||
|
}
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
onReleased: {
|
||||||
|
timer.stop()
|
||||||
|
}
|
||||||
|
TapHandler{
|
||||||
|
onTapped: {
|
||||||
|
btn_down.clicked()
|
||||||
|
}
|
||||||
|
onCanceled: {
|
||||||
|
timer.stop()
|
||||||
|
}
|
||||||
|
onLongPressed: {
|
||||||
|
timer.isUp = false
|
||||||
|
timer.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Timer{
|
||||||
|
id:timer
|
||||||
|
property bool isUp : true
|
||||||
|
interval: 50
|
||||||
|
repeat: true
|
||||||
|
onTriggered: {
|
||||||
|
if(isUp){
|
||||||
|
btn_up.clicked()
|
||||||
|
}else{
|
||||||
|
btn_down.clicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,9 @@ import FluentUI
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
property var columnSource
|
property var columnSource
|
||||||
property var dataSource
|
property var dataSource
|
||||||
|
property color selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
|
property color hoverButtonColor: Qt.alpha(selectionColor,0.2)
|
||||||
|
property color pressedButtonColor: Qt.alpha(selectionColor,0.4)
|
||||||
id:control
|
id:control
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||||
onColumnSourceChanged: {
|
onColumnSourceChanged: {
|
||||||
@ -30,6 +33,27 @@ Rectangle {
|
|||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
property var header_rows:[]
|
property var header_rows:[]
|
||||||
|
property bool selectionFlag: true
|
||||||
|
function obtEditDelegate(column,row){
|
||||||
|
var display = table_model.data(table_model.index(row,column),"display")
|
||||||
|
var cellItem = table_view.itemAtCell(column, row)
|
||||||
|
var cellPosition = cellItem.mapToItem(scroll_table, 0, 0)
|
||||||
|
item_loader.column = column
|
||||||
|
item_loader.row = row
|
||||||
|
item_loader.x = table_view.contentX + cellPosition.x
|
||||||
|
item_loader.y = table_view.contentY + cellPosition.y
|
||||||
|
item_loader.width = table_view.columnWidthProvider(column)
|
||||||
|
item_loader.height = table_view.rowHeightProvider(row)
|
||||||
|
item_loader.display = display
|
||||||
|
var obj =columnSource[column].editDelegate
|
||||||
|
if(obj){
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
if(columnSource[column].editMultiline === true){
|
||||||
|
return com_edit_multiline
|
||||||
|
}
|
||||||
|
return com_edit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onDataSourceChanged: {
|
onDataSourceChanged: {
|
||||||
table_model.clear()
|
table_model.clear()
|
||||||
@ -42,11 +66,9 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_edit
|
id:com_edit
|
||||||
FluTextBox {
|
FluTextBox{
|
||||||
anchors.fill: parent
|
|
||||||
text: display
|
text: display
|
||||||
readOnly: true === columnSource[column].readOnly
|
readOnly: true === columnSource[column].readOnly
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
selectAll()
|
selectAll()
|
||||||
@ -59,14 +81,78 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Component{
|
||||||
|
id:com_edit_multiline
|
||||||
|
Item{
|
||||||
|
anchors.fill: parent
|
||||||
|
ScrollView{
|
||||||
|
id:item_scroll
|
||||||
|
clip: true
|
||||||
|
anchors.fill: parent
|
||||||
|
ScrollBar.vertical: FluScrollBar{
|
||||||
|
parent: item_scroll
|
||||||
|
x: item_scroll.mirrored ? 0 : item_scroll.width - width
|
||||||
|
y: item_scroll.topPadding
|
||||||
|
height: item_scroll.availableHeight
|
||||||
|
active: item_scroll.ScrollBar.horizontal.active
|
||||||
|
}
|
||||||
|
FluMultilineTextBox {
|
||||||
|
id:text_box
|
||||||
|
text: display
|
||||||
|
readOnly: true === columnSource[column].readOnly
|
||||||
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
Component.onCompleted: {
|
||||||
|
forceActiveFocus()
|
||||||
|
selectAll()
|
||||||
|
}
|
||||||
|
rightPadding: 24
|
||||||
|
onCommit: {
|
||||||
|
if(!readOnly){
|
||||||
|
display = text
|
||||||
|
}
|
||||||
|
tableView.closeEditor()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluIconButton{
|
||||||
|
iconSource:FluentIcons.ChromeClose
|
||||||
|
iconSize: 10
|
||||||
|
width: 20
|
||||||
|
height: 20
|
||||||
|
visible: {
|
||||||
|
if(text_box.readOnly)
|
||||||
|
return false
|
||||||
|
return text_box.text !== ""
|
||||||
|
}
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: 5
|
||||||
|
}
|
||||||
|
onClicked:{
|
||||||
|
text_box.text = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_text
|
id:com_text
|
||||||
FluText {
|
FluText {
|
||||||
|
id:item_text
|
||||||
text: itemData
|
text: itemData
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 10
|
anchors.margins: 10
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
HoverHandler{
|
||||||
|
id: hover_handler
|
||||||
|
}
|
||||||
|
FluTooltip{
|
||||||
|
text: item_text.text
|
||||||
|
delay: 500
|
||||||
|
visible: item_text.contentWidth < item_text.implicitWidth && item_text.contentHeight < item_text.implicitHeight && hover_handler.hovered
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScrollView{
|
ScrollView{
|
||||||
@ -88,6 +174,11 @@ Rectangle {
|
|||||||
selectionModel: ItemSelectionModel {
|
selectionModel: ItemSelectionModel {
|
||||||
id:selection_model
|
id:selection_model
|
||||||
model: table_model
|
model: table_model
|
||||||
|
onSelectionChanged: {
|
||||||
|
if(selection_rect.dragging){
|
||||||
|
d.selectionFlag = !d.selectionFlag
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
columnWidthProvider: function(column) {
|
columnWidthProvider: function(column) {
|
||||||
var w = columnSource[column].width
|
var w = columnSource[column].width
|
||||||
@ -104,6 +195,9 @@ Rectangle {
|
|||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
rowHeightProvider: function(row) {
|
rowHeightProvider: function(row) {
|
||||||
|
if(row>=table_model.rowCount){
|
||||||
|
return 0
|
||||||
|
}
|
||||||
var h = table_model.getRow(row).height
|
var h = table_model.getRow(row).height
|
||||||
if(row === item_loader.row){
|
if(row === item_loader.row){
|
||||||
item_loader.height = h
|
item_loader.height = h
|
||||||
@ -123,25 +217,43 @@ Rectangle {
|
|||||||
id:item_table
|
id:item_table
|
||||||
property var position: Qt.point(column,row)
|
property var position: Qt.point(column,row)
|
||||||
required property bool selected
|
required property bool selected
|
||||||
property bool current: selection_model.currentIndex === table_model.index(row,column)
|
color: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
||||||
color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
implicitWidth: columnSource[column].width
|
implicitWidth: columnSource[column].width
|
||||||
TapHandler{
|
Rectangle{
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: !item_loader.sourceComponent
|
||||||
|
color: selected ? control.selectionColor : "#00000000"
|
||||||
|
}
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
onDoubleTapped: {
|
onPressed:{
|
||||||
|
closeEditor()
|
||||||
|
table_view.interactive = false
|
||||||
|
}
|
||||||
|
onCanceled: {
|
||||||
|
table_view.interactive = true
|
||||||
|
}
|
||||||
|
onReleased: {
|
||||||
|
table_view.interactive = true
|
||||||
|
}
|
||||||
|
onDoubleClicked:{
|
||||||
if(display instanceof Component){
|
if(display instanceof Component){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
selection_model.setCurrentIndex(table_model.index(row,column), ItemSelectionModel.Current)
|
item_loader.sourceComponent = d.obtEditDelegate(column,row)
|
||||||
item_loader.sourceComponent = obtEditDelegate(column,row)
|
|
||||||
var index = table_model.index(row,column)
|
|
||||||
}
|
}
|
||||||
onTapped: {
|
onClicked:
|
||||||
if(!current){
|
(event)=>{
|
||||||
item_loader.sourceComponent = null
|
item_loader.sourceComponent = null
|
||||||
|
if(!(event.modifiers & Qt.ControlModifier)){
|
||||||
|
selection_model.clear()
|
||||||
|
}
|
||||||
|
selection_model.select(table_model.index(row,column),ItemSelectionModel.Select)
|
||||||
|
d.selectionFlag = !d.selectionFlag
|
||||||
|
event.accepted = true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loader{
|
Loader{
|
||||||
property var itemData: display
|
property var itemData: display
|
||||||
@ -167,67 +279,28 @@ Rectangle {
|
|||||||
property int column
|
property int column
|
||||||
property int row
|
property int row
|
||||||
property var tableView: control
|
property var tableView: control
|
||||||
|
sourceComponent: null
|
||||||
onDisplayChanged: {
|
onDisplayChanged: {
|
||||||
table_model.setData(table_model.index(row,column),"display",display)
|
var obj = table_model.getRow(row)
|
||||||
|
obj[columnSource[column].dataIndex] = display
|
||||||
|
table_model.setRow(row,obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function obtEditDelegate(column,row){
|
|
||||||
var display = table_model.data(table_model.index(row,column),"display")
|
|
||||||
var cellItem = table_view.itemAtCell(column, row)
|
|
||||||
var cellPosition = cellItem.mapToItem(scroll_table, 0, 0)
|
|
||||||
item_loader.column = column
|
|
||||||
item_loader.row = row
|
|
||||||
item_loader.x = table_view.contentX + cellPosition.x
|
|
||||||
item_loader.y = table_view.contentY + cellPosition.y
|
|
||||||
item_loader.width = table_view.columnWidthProvider(column)
|
|
||||||
item_loader.height = table_view.rowHeightProvider(row)
|
|
||||||
item_loader.display = display
|
|
||||||
var obj =columnSource[column].editDelegate
|
|
||||||
if(obj){
|
|
||||||
return obj
|
|
||||||
}
|
|
||||||
return com_edit
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:com_handle
|
id:com_handle
|
||||||
FluControl {
|
Item {}
|
||||||
width: 24
|
|
||||||
height: 24
|
|
||||||
background: Rectangle{
|
|
||||||
radius: 12
|
|
||||||
color: FluTheme.dark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
|
|
||||||
}
|
|
||||||
visible: SelectionRectangle.control.active
|
|
||||||
FluShadow{
|
|
||||||
radius: 12
|
|
||||||
}
|
|
||||||
Rectangle{
|
|
||||||
width: 24
|
|
||||||
height: 24
|
|
||||||
radius: 12
|
|
||||||
scale: pressed?4/10:hovered?6/10:5/10
|
|
||||||
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
|
||||||
anchors.centerIn: parent
|
|
||||||
Behavior on scale {
|
|
||||||
NumberAnimation{
|
|
||||||
duration: 167
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SelectionRectangle {
|
SelectionRectangle {
|
||||||
target: {
|
id:selection_rect
|
||||||
if(item_loader.sourceComponent){
|
target: table_view
|
||||||
return null
|
|
||||||
}
|
|
||||||
return table_view
|
|
||||||
}
|
|
||||||
bottomRightHandle:com_handle
|
bottomRightHandle:com_handle
|
||||||
topLeftHandle: com_handle
|
topLeftHandle: com_handle
|
||||||
|
onDraggingChanged: {
|
||||||
|
if(!dragging){
|
||||||
|
table_view.interactive = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
TableView {
|
TableView {
|
||||||
id: header_horizontal
|
id: header_horizontal
|
||||||
@ -244,49 +317,88 @@ Rectangle {
|
|||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
clip: true
|
clip: true
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
|
id:column_item_control
|
||||||
readonly property real cellPadding: 8
|
readonly property real cellPadding: 8
|
||||||
|
property bool canceled: false
|
||||||
readonly property var obj : columnSource[column]
|
readonly property var obj : columnSource[column]
|
||||||
implicitWidth: column_text.implicitWidth + (cellPadding * 2)
|
implicitWidth: column_text.implicitWidth + (cellPadding * 2)
|
||||||
implicitHeight: Math.max(header_horizontal.height, column_text.implicitHeight + (cellPadding * 2))
|
implicitHeight: Math.max(header_horizontal.height, column_text.implicitHeight + (cellPadding * 2))
|
||||||
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
color:{
|
||||||
|
d.selectionFlag
|
||||||
|
if(column_item_control_mouse.pressed){
|
||||||
|
return control.pressedButtonColor
|
||||||
|
}
|
||||||
|
if(selection_model.isColumnSelected(column)){
|
||||||
|
return control.hoverButtonColor
|
||||||
|
}
|
||||||
|
return column_item_control_mouse.containsMouse&&!canceled ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||||
|
}
|
||||||
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
|
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
|
||||||
FluText {
|
FluText {
|
||||||
id: column_text
|
id: column_text
|
||||||
text: display
|
text: model.display
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
font.bold: true
|
font.bold:{
|
||||||
|
d.selectionFlag
|
||||||
|
return selection_model.columnIntersectsSelection(column)
|
||||||
|
}
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
TapHandler{
|
MouseArea{
|
||||||
onDoubleTapped: {
|
id:column_item_control_mouse
|
||||||
selection_model.clear()
|
anchors.fill: parent
|
||||||
for(var i=0;i<=table_view.rows;i++){
|
anchors.rightMargin: 6
|
||||||
selection_model.select(table_model.index(i,column),ItemSelectionModel.Select)
|
hoverEnabled: true
|
||||||
|
onCanceled: {
|
||||||
|
column_item_control.canceled = true
|
||||||
|
}
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
if(!containsMouse){
|
||||||
|
column_item_control.canceled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onClicked:
|
||||||
|
(event)=>{
|
||||||
|
closeEditor()
|
||||||
|
if(!(event.modifiers & Qt.ControlModifier)){
|
||||||
|
selection_model.clear()
|
||||||
|
}
|
||||||
|
for(var i=0;i<=table_view.rows;i++){
|
||||||
|
selection_model.select(table_model.index(i,column),ItemSelectionModel.Select)
|
||||||
|
}
|
||||||
|
d.selectionFlag = !d.selectionFlag
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
property point clickPos: "0,0"
|
property point clickPos: "0,0"
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: 4
|
width: 6
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
|
hoverEnabled: true
|
||||||
visible: !(obj.width === obj.minimumWidth && obj.width === obj.maximumWidth)
|
visible: !(obj.width === obj.minimumWidth && obj.width === obj.maximumWidth)
|
||||||
cursorShape: Qt.SplitHCursor
|
cursorShape: Qt.SplitHCursor
|
||||||
preventStealing: true
|
|
||||||
propagateComposedEvents: true
|
|
||||||
onPressed :
|
onPressed :
|
||||||
(mouse)=>{
|
(mouse)=>{
|
||||||
|
header_horizontal.interactive = false
|
||||||
FluTools.setOverrideCursor(Qt.SplitHCursor)
|
FluTools.setOverrideCursor(Qt.SplitHCursor)
|
||||||
clickPos = Qt.point(mouse.x, mouse.y)
|
clickPos = Qt.point(mouse.x, mouse.y)
|
||||||
}
|
}
|
||||||
onReleased:{
|
onReleased:{
|
||||||
|
header_horizontal.interactive = true
|
||||||
|
FluTools.restoreOverrideCursor()
|
||||||
|
}
|
||||||
|
onCanceled: {
|
||||||
|
header_horizontal.interactive = true
|
||||||
FluTools.restoreOverrideCursor()
|
FluTools.restoreOverrideCursor()
|
||||||
}
|
}
|
||||||
onPositionChanged:
|
onPositionChanged:
|
||||||
(mouse)=>{
|
(mouse)=>{
|
||||||
|
if(!pressed){
|
||||||
|
return
|
||||||
|
}
|
||||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||||
var minimumWidth = obj.minimumWidth
|
var minimumWidth = obj.minimumWidth
|
||||||
var maximumWidth = obj.maximumWidth
|
var maximumWidth = obj.maximumWidth
|
||||||
@ -321,50 +433,92 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
delegate: Rectangle{
|
delegate: Rectangle{
|
||||||
|
id:item_control
|
||||||
readonly property real cellPadding: 8
|
readonly property real cellPadding: 8
|
||||||
readonly property var obj : table_model.getRow(row)
|
property bool canceled: false
|
||||||
implicitWidth: Math.max(header_vertical.width, row_text.implicitWidth + (cellPadding * 2))
|
implicitWidth: Math.max(header_vertical.width, row_text.implicitWidth + (cellPadding * 2))
|
||||||
implicitHeight: row_text.implicitHeight + (cellPadding * 2)
|
implicitHeight: row_text.implicitHeight + (cellPadding * 2)
|
||||||
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
color: {
|
||||||
|
d.selectionFlag
|
||||||
|
if(item_control_mouse.pressed){
|
||||||
|
return control.pressedButtonColor
|
||||||
|
}
|
||||||
|
if(selection_model.isRowSelected(row)){
|
||||||
|
return control.hoverButtonColor
|
||||||
|
}
|
||||||
|
return item_control_mouse.containsMouse&&!canceled ? control.hoverButtonColor : FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||||
|
}
|
||||||
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
|
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
|
||||||
FluText{
|
FluText{
|
||||||
id:row_text
|
id:row_text
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: row + 1
|
text: row + 1
|
||||||
}
|
font.bold:{
|
||||||
TapHandler{
|
d.selectionFlag
|
||||||
onDoubleTapped: {
|
return selection_model.rowIntersectsSelection(row)
|
||||||
selection_model.clear()
|
|
||||||
for(var i=0;i<=columnSource.length;i++){
|
|
||||||
selection_model.select(table_model.index(row,i),ItemSelectionModel.Select)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MouseArea{
|
||||||
|
id:item_control_mouse
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.bottomMargin: 6
|
||||||
|
hoverEnabled: true
|
||||||
|
onCanceled: {
|
||||||
|
item_control.canceled = true
|
||||||
|
}
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
if(!containsMouse){
|
||||||
|
item_control.canceled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onClicked:
|
||||||
|
(event)=>{
|
||||||
|
closeEditor()
|
||||||
|
if(!(event.modifiers & Qt.ControlModifier)){
|
||||||
|
selection_model.clear()
|
||||||
|
}
|
||||||
|
for(var i=0;i<=columnSource.length;i++){
|
||||||
|
selection_model.select(table_model.index(row,i),ItemSelectionModel.Select)
|
||||||
|
}
|
||||||
|
d.selectionFlag = !d.selectionFlag
|
||||||
|
}
|
||||||
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
property point clickPos: "0,0"
|
property point clickPos: "0,0"
|
||||||
height: 4
|
height: 6
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
cursorShape: Qt.SplitVCursor
|
cursorShape: Qt.SplitVCursor
|
||||||
preventStealing: true
|
visible: {
|
||||||
visible: !(obj.height === obj.minimumHeight && obj.width === obj.maximumHeight)
|
var obj = table_model.getRow(row)
|
||||||
propagateComposedEvents: true
|
return !(obj.height === obj.minimumHeight && obj.width === obj.maximumHeight)
|
||||||
|
}
|
||||||
onPressed :
|
onPressed :
|
||||||
(mouse)=>{
|
(mouse)=>{
|
||||||
|
header_vertical.interactive = false
|
||||||
FluTools.setOverrideCursor(Qt.SplitVCursor)
|
FluTools.setOverrideCursor(Qt.SplitVCursor)
|
||||||
clickPos = Qt.point(mouse.x, mouse.y)
|
clickPos = Qt.point(mouse.x, mouse.y)
|
||||||
}
|
}
|
||||||
onReleased:{
|
onReleased:{
|
||||||
|
header_vertical.interactive = true
|
||||||
|
FluTools.restoreOverrideCursor()
|
||||||
|
}
|
||||||
|
onCanceled: {
|
||||||
|
header_vertical.interactive = true
|
||||||
FluTools.restoreOverrideCursor()
|
FluTools.restoreOverrideCursor()
|
||||||
}
|
}
|
||||||
onPositionChanged:
|
onPositionChanged:
|
||||||
(mouse)=>{
|
(mouse)=>{
|
||||||
|
if(!pressed){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var obj = table_model.getRow(row)
|
||||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||||
var minimumHeight = obj.minimumHeight
|
var minimumHeight = obj.minimumHeight
|
||||||
var maximumHeight = obj.maximumHeight
|
var maximumHeight = obj.maximumHeight
|
||||||
if(!minimumHeight){
|
if(!minimumHeight){
|
||||||
minimumHeight = 40
|
minimumHeight = 42
|
||||||
}
|
}
|
||||||
if(!maximumHeight){
|
if(!maximumHeight){
|
||||||
maximumHeight = 65535
|
maximumHeight = 65535
|
||||||
|
@ -12,8 +12,11 @@ TextField{
|
|||||||
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
|
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
|
||||||
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
||||||
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
||||||
|
property int closeRightMargin: icon_end.visible ? 25 : 5
|
||||||
id:control
|
id:control
|
||||||
width: 300
|
width: 300
|
||||||
|
padding: 8
|
||||||
|
leftPadding: padding+2
|
||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
color: {
|
color: {
|
||||||
if(!enabled){
|
if(!enabled){
|
||||||
@ -23,7 +26,8 @@ TextField{
|
|||||||
}
|
}
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
|
selectedTextColor: color
|
||||||
placeholderTextColor: {
|
placeholderTextColor: {
|
||||||
if(!enabled){
|
if(!enabled){
|
||||||
return placeholderDisableColor
|
return placeholderDisableColor
|
||||||
@ -33,12 +37,6 @@ TextField{
|
|||||||
}
|
}
|
||||||
return placeholderNormalColor
|
return placeholderNormalColor
|
||||||
}
|
}
|
||||||
Keys.onEnterPressed: {
|
|
||||||
control.commit()
|
|
||||||
}
|
|
||||||
Keys.onReturnPressed: {
|
|
||||||
control.commit()
|
|
||||||
}
|
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
rightPadding: icon_end.visible ? 50 : 30
|
rightPadding: icon_end.visible ? 50 : 30
|
||||||
background: FluTextBoxBackground{
|
background: FluTextBoxBackground{
|
||||||
@ -56,6 +54,14 @@ TextField{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Keys.onEnterPressed: (event)=> d.handleCommit(event)
|
||||||
|
Keys.onReturnPressed:(event)=> d.handleCommit(event)
|
||||||
|
QtObject{
|
||||||
|
id:d
|
||||||
|
function handleCommit(event){
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.IBeamCursor
|
cursorShape: Qt.IBeamCursor
|
||||||
@ -67,7 +73,6 @@ TextField{
|
|||||||
iconSize: 10
|
iconSize: 10
|
||||||
width: 20
|
width: 20
|
||||||
height: 20
|
height: 20
|
||||||
opacity: 0.5
|
|
||||||
visible: {
|
visible: {
|
||||||
if(control.readOnly)
|
if(control.readOnly)
|
||||||
return false
|
return false
|
||||||
@ -76,7 +81,7 @@ TextField{
|
|||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: icon_end.visible ? 25 : 5
|
rightMargin: closeRightMargin
|
||||||
}
|
}
|
||||||
onClicked:{
|
onClicked:{
|
||||||
control.text = ""
|
control.text = ""
|
||||||
|
@ -49,8 +49,7 @@ Rectangle{
|
|||||||
Behavior on height{
|
Behavior on height{
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 83
|
duration: 83
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.OutCubic
|
||||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,25 +92,25 @@ Button {
|
|||||||
Behavior on anchors.leftMargin {
|
Behavior on anchors.leftMargin {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.OutCubic
|
||||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on anchors.rightMargin {
|
Behavior on anchors.rightMargin {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.OutCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 167
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 167
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user