mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-02 08:05:29 +08:00
update
This commit is contained in:
@ -15,6 +15,9 @@ Rectangle{
|
||||
|
||||
property string title: "标题"
|
||||
|
||||
property bool showDark: false
|
||||
property bool showFps: false
|
||||
|
||||
property bool resizable: {
|
||||
if(Window.window == null){
|
||||
return false
|
||||
@ -63,12 +66,13 @@ Rectangle{
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.rightMargin: 12
|
||||
Layout.topMargin: 5
|
||||
visible: FluApp.isFps
|
||||
visible: showFps
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
spacing: 5
|
||||
visible: showDark
|
||||
FluText{
|
||||
text:"夜间模式"
|
||||
fontStyle: FluText.Body
|
||||
@ -112,7 +116,6 @@ Rectangle{
|
||||
icon : FluentIcons.FA_close
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text:"关闭"
|
||||
iconSize: 15
|
||||
onClicked: {
|
||||
Window.window.close()
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
import QtQuick 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
DropShadow {
|
||||
radius: 5
|
||||
samples: 4
|
||||
color: FluApp.isDark ? "#80FFFFFF" : "#40000000"
|
||||
}
|
@ -6,13 +6,14 @@ Popup {
|
||||
id: popup
|
||||
default property alias content: container.children
|
||||
|
||||
background: FluRectangle {
|
||||
background: Rectangle {
|
||||
implicitWidth: 140
|
||||
implicitHeight: container.height
|
||||
color:FluApp.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(237/255,237/255,237/255,1)
|
||||
radius: [5,5,5,5]
|
||||
layer.effect: FluDropShadow{}
|
||||
layer.enabled: true
|
||||
radius: 5
|
||||
FluShadow{
|
||||
radius: 5
|
||||
}
|
||||
Column{
|
||||
spacing: 5
|
||||
topPadding: 5
|
||||
|
@ -8,6 +8,7 @@ Item{
|
||||
property color color : "#FFFFFF"
|
||||
property color borderColor:"red"
|
||||
property int borderWidth: 1
|
||||
property bool shadow: true
|
||||
default property alias contentItem: container.children
|
||||
|
||||
Rectangle{
|
||||
@ -18,6 +19,17 @@ Item{
|
||||
color:root.color
|
||||
}
|
||||
|
||||
FluShadow{
|
||||
anchors.fill: container
|
||||
radius: root.radius[0]
|
||||
visible: {
|
||||
if(root.radius[0] === root.radius[1] && root.radius[0] === root.radius[2] && root.radius[0] === root.radius[3] && root.shadow){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
anchors.fill: parent
|
||||
|
65
src/controls/FluShadow.qml
Normal file
65
src/controls/FluShadow.qml
Normal file
@ -0,0 +1,65 @@
|
||||
import QtQuick 2.15
|
||||
|
||||
Item {
|
||||
id:root
|
||||
anchors.fill: parent
|
||||
anchors.margins: -4
|
||||
property color color: FluApp.isDark ? "#FFFFFF" : "#000000"
|
||||
|
||||
property var radius: 4
|
||||
|
||||
Rectangle{
|
||||
width: root.width
|
||||
height: root.height
|
||||
anchors.centerIn: parent
|
||||
color: "#00000000"
|
||||
opacity: 0.02
|
||||
border.width: 1
|
||||
radius: root.radius
|
||||
border.color: root.color
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
width: root.width - 2
|
||||
height: root.height - 2
|
||||
anchors.centerIn: parent
|
||||
color: "#00000000"
|
||||
opacity: 0.04
|
||||
border.width: 1
|
||||
radius: root.radius
|
||||
border.color: root.color
|
||||
}
|
||||
Rectangle{
|
||||
width: root.width - 4
|
||||
height: root.height - 4
|
||||
anchors.centerIn: parent
|
||||
color: "#00000000"
|
||||
opacity: 0.06
|
||||
border.width: 1
|
||||
radius: root.radius
|
||||
border.color: root.color
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
width: root.width - 6
|
||||
height: root.height - 6
|
||||
anchors.centerIn: parent
|
||||
color: "#00000000"
|
||||
opacity: 0.08
|
||||
border.width: 1
|
||||
radius: root.radius
|
||||
border.color: root.color
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
width: root.width - 8
|
||||
height: root.height - 8
|
||||
anchors.centerIn: parent
|
||||
opacity: 0.1
|
||||
radius: root.radius
|
||||
color: "#00000000"
|
||||
border.width: 1
|
||||
border.color: root.color
|
||||
}
|
||||
|
||||
}
|
@ -40,11 +40,12 @@ Item{
|
||||
id:dot
|
||||
width: dotSize
|
||||
height: dotSize
|
||||
FluShadow{
|
||||
radius: 15
|
||||
}
|
||||
radius: 15
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
layer.enabled: true
|
||||
color:FluApp.isDark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
|
||||
layer.effect: FluDropShadow {}
|
||||
Rectangle{
|
||||
width: dotSize/2
|
||||
height: dotSize/2
|
||||
|
22
src/controls/FluTextButton.qml
Normal file
22
src/controls/FluTextButton.qml
Normal file
@ -0,0 +1,22 @@
|
||||
import QtQuick 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluText {
|
||||
id:root
|
||||
color: {
|
||||
if(FluApp.isDark){
|
||||
return mouse_area.containsMouse?Qt.rgba(73/255,148/255,206/255,1):Qt.rgba(76/255,160/255,224/255,1)
|
||||
}
|
||||
return mouse_area.containsMouse?Qt.rgba(24/255,116/255,186/255,1):Qt.rgba(0/255,102/255,180/255,1)
|
||||
}
|
||||
signal clicked
|
||||
MouseArea{
|
||||
id:mouse_area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
root.clicked()
|
||||
}
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ ToolTip {
|
||||
anchors.fill: parent
|
||||
color: FluApp.isDark ? Qt.rgba(50/255,49/255,48/255,1) : Qt.rgba(1,1,1,1)
|
||||
radius: 5
|
||||
layer.enabled: true
|
||||
layer.effect: FluDropShadow {}
|
||||
FluShadow{}
|
||||
}
|
||||
}
|
||||
|
@ -32,25 +32,22 @@ Item {
|
||||
|
||||
FluWindowResize{}
|
||||
|
||||
|
||||
Behavior on opacity{
|
||||
NumberAnimation{
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
|
||||
FluShadow{
|
||||
anchors.fill: container
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:container
|
||||
color:root.color
|
||||
anchors.fill: parent
|
||||
anchors.margins: borderless
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
radius: 5
|
||||
samples: 5
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 0
|
||||
color: "#40000000"
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
@ -31,68 +31,50 @@ MouseArea {
|
||||
return;
|
||||
}
|
||||
|
||||
var rc = Qt.rect(0, 0, 0, 0);
|
||||
let e = 0;
|
||||
|
||||
//top-left
|
||||
rc = Qt.rect(0, 0, border, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(0,0,border,border, mouse.x, mouse.y)) {
|
||||
e = Qt.TopEdge | Qt.LeftEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
//top
|
||||
rc = Qt.rect(border, 0, window.width-border*2, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(border,0,window.width-border*2,border, mouse.x, mouse.y)) {
|
||||
e = Qt.TopEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
//top-right
|
||||
rc = Qt.rect(window.width-border, 0, border, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(window.width-border,0,border,border, mouse.x, mouse.y)) {
|
||||
e = Qt.TopEdge | Qt.RightEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
//right
|
||||
rc = Qt.rect(window.width-border, border, border, window.height-border*2);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(window.width-border,border,border,window.height-border*2, mouse.x, mouse.y)) {
|
||||
e = Qt.RightEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
//bottom-right
|
||||
rc = Qt.rect(window.width-border, window.height-border, border, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(window.width-border,window.height-border,border,border, mouse.x, mouse.y)) {
|
||||
e = Qt.BottomEdge | Qt.RightEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
//bottom
|
||||
rc = Qt.rect(border, window.height-border, window.width-border*2, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(border,window.height-border,window.width-border*2,border, mouse.x, mouse.y)) {
|
||||
e = Qt.BottomEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
//bottom_left
|
||||
rc = Qt.rect(0, window.height-border,border, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(0,window.height-border,border,border, mouse.x, mouse.y)) {
|
||||
e = Qt.BottomEdge | Qt.LeftEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
//left
|
||||
rc = Qt.rect(0, border,border, window.height-border*2);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(0,border,border , window.height-border*2, mouse.x, mouse.y)) {
|
||||
e = Qt.LeftEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
@ -105,66 +87,46 @@ MouseArea {
|
||||
cursorShape = Qt.ArrowCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
var rc = Qt.rect(0, 0, 0, 0);
|
||||
|
||||
//top-left
|
||||
rc = Qt.rect(0, 0, border, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(0,0,border,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeFDiagCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
//top
|
||||
rc = Qt.rect(border, 0, window.width-border*2, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(border,0,window.width-border*2,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeVerCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
//top-right
|
||||
rc = Qt.rect(window.width-border, 0, border, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(window.width-border,0,border,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeBDiagCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
//right
|
||||
rc = Qt.rect(window.width-border, border, border, window.height-border*2);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(window.width-border,border,border,window.height-border*2, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeHorCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
//bottom-right
|
||||
rc = Qt.rect(window.width-border, window.height-border, border, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(window.width-border,window.height-border,border,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeFDiagCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
//bottom
|
||||
rc = Qt.rect(border, window.height-border, window.width-border*2, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(border,window.height-border,window.width-border*2,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeVerCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
//bottom_left
|
||||
rc = Qt.rect(0, window.height-border,border, border);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(0,window.height-border,border,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeBDiagCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
//left
|
||||
rc = Qt.rect(0, border,border, window.height-border*2);
|
||||
if (ptInRect(rc, mouse.x, mouse.y)) {
|
||||
if (ptInRect(0,border,border, window.height-border*2, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeHorCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
//default
|
||||
cursorShape = Qt.ArrowCursor;
|
||||
}
|
||||
|
||||
@ -172,13 +134,12 @@ MouseArea {
|
||||
cursorShape = Qt.ArrowCursor;
|
||||
}
|
||||
|
||||
function ptInRect(rc, x, y)
|
||||
function ptInRect(rcx,rcy,rcwidth,rcheight, x, y)
|
||||
{
|
||||
if ((rc.x <= x && x <= (rc.x + rc.width)) &&
|
||||
(rc.y <= y && y <= (rc.y + rc.height))) {
|
||||
if ((rcx <= x && x <= (rcx + rcwidth)) &&
|
||||
(rcy <= y && y <= (rcy + rcheight))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user