mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-01-22 20:04:32 +08:00
update
This commit is contained in:
parent
a6e494d1c7
commit
33fda1d025
@ -64,7 +64,7 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
||||
endforeach(filepath)
|
||||
|
||||
#遍历所有资源文件
|
||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp qmldir)
|
||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.obj qmldir)
|
||||
foreach(filepath ${RES_PATHS})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||
list(APPEND resource_files ${filename})
|
||||
|
@ -188,5 +188,7 @@
|
||||
<file>qml/viewmodel/SettingsViewModel.qml</file>
|
||||
<file>qml/viewmodel/TextBoxViewModel.qml</file>
|
||||
<file>qml/page/T_Clip.qml</file>
|
||||
<file>qml/page/T_3D.qml</file>
|
||||
<file>res/obj/test.obj</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -459,6 +459,12 @@ FluObject{
|
||||
}
|
||||
onDropped:{ FluApp.navigate("/hotload") }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"3D"
|
||||
url:"qrc:/example/qml/page/T_3D.qml"
|
||||
onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) }
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
}
|
||||
|
||||
function getRecentlyAddedData(){
|
||||
|
120
example/qml-Qt6/page/T_3D.qml
Normal file
120
example/qml-Qt6/page/T_3D.qml
Normal file
@ -0,0 +1,120 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Window
|
||||
import FluentUI
|
||||
import Qt3D.Core
|
||||
import Qt3D.Render
|
||||
import Qt3D.Input
|
||||
import Qt3D.Extras
|
||||
import QtQuick.Scene3D
|
||||
import QtQuick.Dialogs
|
||||
import Qt.labs.platform
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
FluContentPage{
|
||||
|
||||
id:root
|
||||
title:"3D"
|
||||
|
||||
Scene3D{
|
||||
id:scene_3d
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
aspects: ["input", "logic"]
|
||||
cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
|
||||
Entity {
|
||||
Camera {
|
||||
id: camera
|
||||
projectionType: CameraLens.PerspectiveProjection
|
||||
fieldOfView: 22.5
|
||||
aspectRatio: scene_3d.width / scene_3d.height
|
||||
nearPlane: 1
|
||||
farPlane: 1000.0
|
||||
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
|
||||
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
|
||||
position: Qt.vector3d( 0.0, 0.0, 15.0 )
|
||||
}
|
||||
FirstPersonCameraController {
|
||||
linearSpeed: 100
|
||||
lookSpeed: 50
|
||||
camera: camera
|
||||
}
|
||||
components: [
|
||||
RenderSettings{
|
||||
activeFrameGraph: ForwardRenderer{
|
||||
clearColor: Qt.rgba(0,0,0,0);
|
||||
camera: camera
|
||||
}
|
||||
},
|
||||
InputSettings{}
|
||||
]
|
||||
Mesh {
|
||||
id: mesh
|
||||
source: "qrc:/example/res/obj/test.obj"
|
||||
}
|
||||
PhongMaterial {
|
||||
id: material
|
||||
ambient: color_picker.colorValue
|
||||
}
|
||||
Transform{
|
||||
id:transform
|
||||
scale: 1.0
|
||||
translation: Qt.vector3d(0, 0, 0)
|
||||
rotation: fromEulerAngles(0, 0, 0)
|
||||
property real hAngle:0.0
|
||||
NumberAnimation on hAngle{
|
||||
from:0
|
||||
to:360.0
|
||||
duration: 5000
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
matrix:{
|
||||
var m=Qt.matrix4x4();
|
||||
m.rotate(hAngle,Qt.vector3d(0,1,0));
|
||||
m.translate(Qt.vector3d(0,0,0));
|
||||
return m;
|
||||
}
|
||||
}
|
||||
Entity {
|
||||
id: entity
|
||||
components: [mesh, material,transform]
|
||||
}
|
||||
}
|
||||
}
|
||||
ColumnLayout{
|
||||
RowLayout{
|
||||
spacing: 10
|
||||
Layout.topMargin: 20
|
||||
FluText{
|
||||
text:"tintColor:"
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
FluColorPicker{
|
||||
id:color_picker
|
||||
enableAlphaChannel:false
|
||||
Component.onCompleted: {
|
||||
setColor("gray")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluButton{
|
||||
text:"选择obj资源"
|
||||
onClicked: {
|
||||
file_dialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: file_dialog
|
||||
nameFilters: ["Obj files (*.obj)"]
|
||||
folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
|
||||
onAccepted: {
|
||||
var fileUrl = file_dialog.currentFile
|
||||
mesh.source = fileUrl
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -459,6 +459,12 @@ FluObject{
|
||||
}
|
||||
onDropped:{ FluApp.navigate("/hotload") }
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"3D"
|
||||
url:"qrc:/example/qml/page/T_3D.qml"
|
||||
onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) }
|
||||
onTap:{ navigationView.push(url) }
|
||||
}
|
||||
}
|
||||
|
||||
function getRecentlyAddedData(){
|
||||
|
121
example/qml/page/T_3D.qml
Normal file
121
example/qml/page/T_3D.qml
Normal file
@ -0,0 +1,121 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Window 2.15
|
||||
import Qt3D.Core 2.15
|
||||
import Qt3D.Render 2.15
|
||||
import Qt3D.Input 2.12
|
||||
import Qt3D.Extras 2.15
|
||||
import QtQuick.Scene3D 2.15
|
||||
import QtQuick.Dialogs 1.3
|
||||
import Qt.labs.platform 1.1
|
||||
import FluentUI 1.0
|
||||
import "qrc:///example/qml/component"
|
||||
import "../component"
|
||||
|
||||
FluContentPage{
|
||||
|
||||
id:root
|
||||
title:"3D"
|
||||
|
||||
Scene3D{
|
||||
id:scene_3d
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
aspects: ["input", "logic"]
|
||||
cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
|
||||
Entity {
|
||||
Camera {
|
||||
id: camera
|
||||
projectionType: CameraLens.PerspectiveProjection
|
||||
fieldOfView: 22.5
|
||||
aspectRatio: scene_3d.width / scene_3d.height
|
||||
nearPlane: 1
|
||||
farPlane: 1000.0
|
||||
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
|
||||
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
|
||||
position: Qt.vector3d( 0.0, 0.0, 15.0 )
|
||||
}
|
||||
FirstPersonCameraController {
|
||||
linearSpeed: 100
|
||||
lookSpeed: 50
|
||||
camera: camera
|
||||
}
|
||||
components: [
|
||||
RenderSettings{
|
||||
activeFrameGraph: ForwardRenderer{
|
||||
clearColor: Qt.rgba(0,0,0,0);
|
||||
camera: camera
|
||||
}
|
||||
},
|
||||
InputSettings{}
|
||||
]
|
||||
Mesh {
|
||||
id: mesh
|
||||
source: "qrc:/example/res/obj/test.obj"
|
||||
}
|
||||
PhongMaterial {
|
||||
id: material
|
||||
ambient: color_picker.colorValue
|
||||
}
|
||||
Transform{
|
||||
id:transform
|
||||
scale: 1.0
|
||||
translation: Qt.vector3d(0, 0, 0)
|
||||
rotation: fromEulerAngles(0, 0, 0)
|
||||
property real hAngle:0.0
|
||||
NumberAnimation on hAngle{
|
||||
from:0
|
||||
to:360.0
|
||||
duration: 5000
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
matrix:{
|
||||
var m=Qt.matrix4x4();
|
||||
m.rotate(hAngle,Qt.vector3d(0,1,0));
|
||||
m.translate(Qt.vector3d(0,0,0));
|
||||
return m;
|
||||
}
|
||||
}
|
||||
Entity {
|
||||
id: entity
|
||||
components: [mesh, material,transform]
|
||||
}
|
||||
}
|
||||
}
|
||||
ColumnLayout{
|
||||
RowLayout{
|
||||
spacing: 10
|
||||
Layout.topMargin: 20
|
||||
FluText{
|
||||
text:"tintColor:"
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
FluColorPicker{
|
||||
id:color_picker
|
||||
enableAlphaChannel:false
|
||||
Component.onCompleted: {
|
||||
setColor("gray")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluButton{
|
||||
text:"选择obj资源"
|
||||
onClicked: {
|
||||
file_dialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: file_dialog
|
||||
nameFilters: ["Obj files (*.obj)"]
|
||||
folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
|
||||
onAccepted: {
|
||||
var fileUrl = file_dialog.currentFile
|
||||
mesh.source = fileUrl
|
||||
}
|
||||
}
|
||||
|
||||
}
|
2067
example/res/obj/test.obj
Normal file
2067
example/res/obj/test.obj
Normal file
File diff suppressed because it is too large
Load Diff
@ -197,23 +197,14 @@ Rectangle {
|
||||
}
|
||||
|
||||
function _hsla(h, s, b, a) {
|
||||
if(!enableAlphaChannel){
|
||||
a = 1
|
||||
}
|
||||
var lightness = (2 - s)*b
|
||||
var satHSL = s*b/((lightness <= 1) ? lightness : 2 - lightness)
|
||||
lightness /= 2
|
||||
|
||||
var c = Qt.hsla(h, satHSL, lightness, a)
|
||||
|
||||
colorChanged(c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
function _rgb(rgb, a) {
|
||||
|
||||
var c = Qt.rgba(rgb.r, rgb.g, rgb.b, a)
|
||||
|
||||
colorChanged(c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ Button{
|
||||
implicitWidth: width
|
||||
implicitHeight: height
|
||||
property alias colorValue: container.colorValue
|
||||
property alias enableAlphaChannel: container.enableAlphaChannel
|
||||
background:
|
||||
Rectangle{
|
||||
id:layout_color
|
||||
@ -27,7 +28,7 @@ Button{
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
radius: 5
|
||||
color: container.colorValue
|
||||
color: control.colorValue
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import "ColorPicker"
|
||||
Item {
|
||||
id:control
|
||||
property alias colorValue: color_picker.colorValue
|
||||
property alias enableAlphaChannel: color_picker.enableAlphaChannel
|
||||
property int radius: 5
|
||||
width: color_picker.width+10
|
||||
height: color_picker.height
|
||||
|
@ -197,23 +197,20 @@ Rectangle {
|
||||
}
|
||||
|
||||
function _hsla(h, s, b, a) {
|
||||
if(!enableAlphaChannel){
|
||||
a = 1
|
||||
}
|
||||
var lightness = (2 - s)*b
|
||||
var satHSL = s*b/((lightness <= 1) ? lightness : 2 - lightness)
|
||||
lightness /= 2
|
||||
|
||||
var c = Qt.hsla(h, satHSL, lightness, a)
|
||||
|
||||
colorChanged(c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
function _rgb(rgb, a) {
|
||||
|
||||
var c = Qt.rgba(rgb.r, rgb.g, rgb.b, a)
|
||||
|
||||
colorChanged(c)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ Button{
|
||||
implicitWidth: width
|
||||
implicitHeight: height
|
||||
property alias colorValue: container.colorValue
|
||||
property alias enableAlphaChannel: container.enableAlphaChannel
|
||||
background:
|
||||
Rectangle{
|
||||
id:layout_color
|
||||
@ -28,9 +29,8 @@ Button{
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
radius: 5
|
||||
color: container.colorValue
|
||||
color: control.colorValue
|
||||
}
|
||||
|
||||
}
|
||||
Item{
|
||||
id: d
|
||||
|
@ -6,6 +6,7 @@ import "ColorPicker"
|
||||
Item {
|
||||
id:control
|
||||
property alias colorValue: color_picker.colorValue
|
||||
property alias enableAlphaChannel: color_picker.enableAlphaChannel
|
||||
property int radius: 5
|
||||
width: color_picker.width+10
|
||||
height: color_picker.height
|
||||
|
Loading…
Reference in New Issue
Block a user