mirror of
https://github.com/jaredtao/TaoQuick.git
synced 2025-01-17 20:12:54 +08:00
[reset] 仓库精简
This commit is contained in:
commit
fa073713fe
117
.clang-format
Normal file
117
.clang-format
Normal file
@ -0,0 +1,117 @@
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: false
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Allman
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 160
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepLineBreaksForNonEmptyLines: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: Inner
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 4
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
...
|
62
.gitattributes
vendored
Normal file
62
.gitattributes
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
264
.gitignore
vendored
Normal file
264
.gitignore
vendored
Normal file
@ -0,0 +1,264 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
build/
|
||||
run/
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
#*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
/.vscode/settings.json
|
37
.travis.yml
Normal file
37
.travis.yml
Normal file
@ -0,0 +1,37 @@
|
||||
language: cpp
|
||||
sudo: required
|
||||
compiler: gcc
|
||||
group: deprecated-2019Q1
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: xenial
|
||||
env:
|
||||
releaseName=TaoQuickDemo_ubuntu_xenial_x64.AppImage
|
||||
cache:
|
||||
apt: true
|
||||
directories:
|
||||
- /opt/qt512/
|
||||
- ./linuxdeployqt.AppImage
|
||||
- os: osx
|
||||
osx_image: xcode10.2
|
||||
env:
|
||||
releaseName=TaoQuickDemo_macos10-14_xcode10-2.dmg
|
||||
before_install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then chmod a+x ./scripts/macos/install.sh; ./scripts/macos/install.sh; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod a+x ./scripts/ubuntu/install.sh; ./scripts/ubuntu/install.sh; fi
|
||||
script:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then chmod a+x ./scripts/macos/build.sh; ./scripts/macos/build.sh; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod a+x ./scripts/ubuntu/build.sh; ./scripts/ubuntu/build.sh; fi
|
||||
before_deploy:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then chmod a+x ./scripts/macos/deploy.sh; ./scripts/macos/deploy.sh; fi
|
||||
deploy: # 部署
|
||||
provider: releases # 部署到 GitHub Release,除此之外,Travis CI 还支持发布到 fir.im、AWS、Google App Engine 等
|
||||
api_key: $GITHUB_OAUTH_TOKEN # 填写 GitHub 的 token (Settings -> Personal access tokens -> Generate new token)
|
||||
file: bin/release/${releaseName} # 部署文件路径
|
||||
skip_cleanup: true # 设置为 true 以跳过清理,不然 apk 文件就会被清理
|
||||
on: # 发布时机
|
||||
tags: true # tags 设置为 true 表示只有在有 tag 的情况下才部署
|
||||
notifications:
|
||||
email: false
|
||||
|
32
Common/TaoVersion.pri
Normal file
32
Common/TaoVersion.pri
Normal file
@ -0,0 +1,32 @@
|
||||
isEmpty(TaoVersionPri) {
|
||||
TaoVersionPri=1
|
||||
|
||||
TAO_VERSION_TAG = 1.0
|
||||
|
||||
# current commit hash
|
||||
REVISION=$$system("git rev-parse HEAD")
|
||||
REVISION=$$str_member($${REVISION}, 0, $$num_add(10, -1))
|
||||
|
||||
# last tag
|
||||
Ver=$$system("git describe --abbrev=0 --tags")
|
||||
VerList =$$split(Ver, .)
|
||||
MAJ = $$take_first(VerList)
|
||||
MIN = $$take_first(VerList)
|
||||
PAT = $$take_first(VerList)
|
||||
equals(TEMPLATE, lib) {
|
||||
CONFIG += skip_target_version_ext
|
||||
VER_MAJ = $${MAJ}
|
||||
VER_MIN = $${MIN}
|
||||
VER_PAT = $${PAT}
|
||||
VERSION = $${Ver}
|
||||
}
|
||||
DEFINES += TaoREVISION=\"\\\"$${REVISION}\\\"\"
|
||||
DEFINES += TaoVer=\"\\\"$${Ver}\\\"\"
|
||||
DEFINES += TaoMAJ=$${MAJ}
|
||||
DEFINES += TaoMIN=$${MIN}
|
||||
DEFINES += TaoPAT=$${PAT}
|
||||
DEFINES += TaoDATETIME=\"\\\"$${_DATE_}\\\"\"
|
||||
DEFINES += TaoCompilerVendor=\"\\\"$${QT_VERSION} $${QMAKE_PLATFORM} $${QMAKE_COMPILER} $${QMAKE_TARGET.arch}\\\"\"
|
||||
# message($${DEFINES})
|
||||
}
|
||||
|
74
Install.md
Normal file
74
Install.md
Normal file
@ -0,0 +1,74 @@
|
||||
# 目录
|
||||
- [目录](#%E7%9B%AE%E5%BD%95)
|
||||
- [代码结构](#%E4%BB%A3%E7%A0%81%E7%BB%93%E6%9E%84)
|
||||
- [TaoQuick 安装](#TaoQuick-%E5%AE%89%E8%A3%85)
|
||||
- [QtCreator安装TaoQuick](#QtCreator%E5%AE%89%E8%A3%85TaoQuick)
|
||||
- [命令行安装TaoQuick](#%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%AE%89%E8%A3%85TaoQuick)
|
||||
- [TaoQuick dll的使用](#TaoQuick-dll%E7%9A%84%E4%BD%BF%E7%94%A8)
|
||||
- [TaoQuick Designer的使用](#TaoQuick-Designer%E7%9A%84%E4%BD%BF%E7%94%A8)
|
||||
|
||||
## 代码结构
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/Struct.png)
|
||||
|
||||
TaoQuickDemo目录是Demo项目,示例如何使用TaoQuick库。
|
||||
|
||||
TaoQuick目录就是TaoQuick库。
|
||||
|
||||
可以使用生成的dll库,dll生成目录在项目的bin/TaoQuick目录下。
|
||||
|
||||
也可以将TaoQuick安装进Qt环境,支持在QtCreator中使用Designer进行拖拽式设计。
|
||||
|
||||
安装方法可以直接用QtCreator进行安装,也可以用命令行安装。
|
||||
|
||||
## TaoQuick 安装
|
||||
|
||||
### QtCreator安装TaoQuick
|
||||
|
||||
如下图所示:
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/QtCreator-install.png)
|
||||
|
||||
任意编译器kit都可以,项目->构建步骤->添加build步骤->Make,添加之后在make参数中输入install。最后重新构建工程,即可完成安装。
|
||||
|
||||
TaoQuick库将被安装到{QTDIR}/qml/TaoQuick/ 路径下。
|
||||
|
||||
### 命令行安装TaoQuick
|
||||
|
||||
确保环境变量PATH中有QTDIR/bin,即能找到qmake
|
||||
|
||||
在TaoQuick目录,依次执行以下命令:
|
||||
|
||||
```
|
||||
qmake
|
||||
make
|
||||
make install
|
||||
|
||||
```
|
||||
|
||||
## TaoQuick dll的使用
|
||||
|
||||
1. 将bin/TaoQuick文件夹复制到你的可执行程序同级目录下
|
||||
|
||||
2. 在你的Qml中写上这两句,就完成了TaoQuick的导入
|
||||
```
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml/"
|
||||
```
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/TaoQuick-use.png)
|
||||
|
||||
`import TaoQuick 1.0` 是在导入dll库。
|
||||
`import "qrc:/Tao/Qml/` 是在导入"qrc:/Tao/Qml/"路径下的qmldir文件。这个文件描述了TaoQuick中的所有组件。导入过后就能使用全部的组件了。
|
||||
|
||||
这种方式TaoQuick的Qml是以资源文件的方式编译进dll的,所以不支持QtCreator的语法高亮。(商业版有内建资源功能,或许可以支持)
|
||||
|
||||
## TaoQuick Designer的使用
|
||||
|
||||
1. 确保TaoQuick库被安装到{QTDIR}/qml/TaoQuick/目录下
|
||||
2. 重启QtCreator,并在你的Qt项目的Designer 模式,Importer列表中,选择TaoQuick。选完记得按一下Ctrl + S保存一下,让Designer正确加载TaoQuick。
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/Import.png)
|
||||
|
||||
3. 拖拽创建组件,修改属性
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/Drag.gif)
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 JaredTao jared2020@163.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
179
README.md
Normal file
179
README.md
Normal file
@ -0,0 +1,179 @@
|
||||
# 目录
|
||||
- [目录](#%E7%9B%AE%E5%BD%95)
|
||||
- [TaoQuick](#TaoQuick)
|
||||
- [徽章预览](#%E5%BE%BD%E7%AB%A0%E9%A2%84%E8%A7%88)
|
||||
- [CI](#CI)
|
||||
- [Repo](#Repo)
|
||||
- [Issue](#Issue)
|
||||
- [Other status](#Other-status)
|
||||
- [开发环境](#%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83)
|
||||
- [效果预览](#%E6%95%88%E6%9E%9C%E9%A2%84%E8%A7%88)
|
||||
- [启动界面](#%E5%90%AF%E5%8A%A8%E7%95%8C%E9%9D%A2)
|
||||
- [动态换皮肤](#%E5%8A%A8%E6%80%81%E6%8D%A2%E7%9A%AE%E8%82%A4)
|
||||
- [百叶窗特效](#%E7%99%BE%E5%8F%B6%E7%AA%97%E7%89%B9%E6%95%88)
|
||||
- [棋盘特效](#%E6%A3%8B%E7%9B%98%E7%89%B9%E6%95%88)
|
||||
- [ShaderToy-超级马里奥](#ShaderToy-%E8%B6%85%E7%BA%A7%E9%A9%AC%E9%87%8C%E5%A5%A5)
|
||||
- [Qml 安卓简易热加载](#Qml-%E5%AE%89%E5%8D%93%E7%AE%80%E6%98%93%E7%83%AD%E5%8A%A0%E8%BD%BD)
|
||||
- [更多基础效果预览](#%E6%9B%B4%E5%A4%9A%E5%9F%BA%E7%A1%80%E6%95%88%E6%9E%9C%E9%A2%84%E8%A7%88)
|
||||
- [动画效果预览](#%E5%8A%A8%E7%94%BB%E6%95%88%E6%9E%9C%E9%A2%84%E8%A7%88)
|
||||
- [页面切换效果预览](#%E9%A1%B5%E9%9D%A2%E5%88%87%E6%8D%A2%E6%95%88%E6%9E%9C%E9%A2%84%E8%A7%88)
|
||||
- [ShaderToy效果预览](#ShaderToy%E6%95%88%E6%9E%9C%E9%A2%84%E8%A7%88)
|
||||
- [其它特效](#%E5%85%B6%E5%AE%83%E7%89%B9%E6%95%88)
|
||||
- [TaoQuick 安装和使用](#TaoQuick-%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8)
|
||||
- [联系方式](#%E8%81%94%E7%B3%BB%E6%96%B9%E5%BC%8F)
|
||||
- [赞助](#%E8%B5%9E%E5%8A%A9)
|
||||
# TaoQuick
|
||||
|
||||
这是一个Qt/Qml组件库,集成了常用的QtQuick组件,并做了适当的属性封装、功能扩展,以方便开发Qml程序。
|
||||
|
||||
实现原理可以参考《Qml组件化编程》《Qml特效》系列教程,以下网站都有收录:
|
||||
|
||||
[涛哥的博客](https://jaredtao.github.io)
|
||||
|
||||
[知乎专栏-Qt进阶之路](https://zhuanlan.zhihu.com/TaoQt)
|
||||
|
||||
微信公众号: Qt进阶之路
|
||||
|
||||
## 徽章预览
|
||||
### CI
|
||||
|[License][license-link]| [Ubuntu/MacOS][lin-link] | [Windows][win-link] |[Release][release-link]|[Download][download-link]|latest|
|
||||
|:--:|:--:|:--:|:--:|:--:|:--:|
|
||||
|![license-badge]| ![lin-badge]| ![win-badge]|![release-badge] |![download-badge]|![download-latest]|
|
||||
|
||||
[license-link]: https://github.com/jaredtao/TaoQuick/blob/master/LICENSE "LICENSE"
|
||||
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg "MIT"
|
||||
|
||||
[lin-badge]: https://travis-ci.com/jaredtao/TaoQuick.svg?branch=master "Travis build status"
|
||||
[lin-link]: https://travis-ci.com/jaredtao/TaoQuick "Travis build status"
|
||||
[win-badge]: https://ci.appveyor.com/api/projects/status/ontim37g33hvfv72?svg=true "AppVeyor build status"
|
||||
[win-link]: https://ci.appveyor.com/project/jiawentao/TaoQuick "AppVeyor build status"
|
||||
|
||||
[release-link]: https://github.com/jaredtao/TaoQuick/releases "Release status"
|
||||
[release-badge]: https://img.shields.io/github/release/jaredtao/TaoQuick.svg?style=flat-square "Release status"
|
||||
[download-link]: https://github.com/jaredtao/TaoQuick/releases/latest "Download status"
|
||||
[download-badge]: https://img.shields.io/github/downloads/jaredtao/TaoQuick/total.svg "Download status"
|
||||
[download-latest]: https://img.shields.io/github/downloads/jaredtao/TaoQuick/latest/total.svg "latest status"
|
||||
|
||||
### Repo
|
||||
|latest tag|languages|top language|code size|repo size|
|
||||
|:--: |:--: |:--:|:--:|:--:|
|
||||
|![tag-latest]|![languanges]|![taolanguage]|![code-size]|![repo-size]|
|
||||
|
||||
[languanges]: https://img.shields.io/github/languages/count/jaredtao/taoquick.svg "language count"
|
||||
[taolanguage]: https://img.shields.io/github/languages/top/jaredtao/taoquick.svg "top language"
|
||||
[code-size]: https://img.shields.io/github/languages/code-size/jaredtao/taoquick.svg "code size"
|
||||
[repo-size]: https://img.shields.io/github/repo-size/jaredtao/taoquick.svg "repo-size"
|
||||
[tag-latest]: https://img.shields.io/github/tag/jaredtao/taoquick.svg
|
||||
|
||||
### Issue
|
||||
|[Issues][issues-link]|closed issue|pull request|pull closed|
|
||||
|:--:|:--:|:--:|:--:|
|
||||
|![issuse-badge]|![issue-closed]|![pull-request]|![pull-closed]|
|
||||
|
||||
[issues-link]: https://github.com/jaredtao/TaoQuick/issues
|
||||
[issuse-badge]: https://img.shields.io/github/issues/jaredtao/taoquick.svg?style=popout
|
||||
[issue-closed]: https://img.shields.io/github/issues-closed/jaredtao/taoquick.svg
|
||||
[pull-request]: https://img.shields.io/github/issues-pr/jaredtao/taoquick.svg
|
||||
[pull-closed]: https://img.shields.io/github/issues-pr-closed/jaredtao/taoquick.svg
|
||||
|
||||
### Other status
|
||||
|
||||
|commit-active|laste commit|release date|forks|stars|goto hit|
|
||||
|:--:|:--:|:--:|:--:|:--:|:--:|
|
||||
|![commit-active]|![commit-latest]|![release-date]|![forks-badge]|![stars-badge]|![goto-hit]|
|
||||
|
||||
[forks-badge]: https://img.shields.io/github/forks/jaredtao/taoquick.svg "forks"
|
||||
[stars-badge]: https://img.shields.io/github/stars/jaredtao/taoquick.svg "stars"
|
||||
[goto-hit]: https://img.shields.io/github/search/jaredtao/taoquick/goto.svg "goto-hit"
|
||||
[commit-active]: https://img.shields.io/github/commit-activity/w/jaredtao/taoquick.svg
|
||||
[commit-latest]: https://img.shields.io/github/last-commit/jaredtao/taoquick.svg
|
||||
[release-date]: https://img.shields.io/github/release-date/jaredtao/taoquick.svg
|
||||
|
||||
## 开发环境
|
||||
|
||||
* Qt 5.12.x
|
||||
|
||||
## 效果预览
|
||||
|
||||
### 启动界面
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/Splash.gif)
|
||||
|
||||
### 动态换皮肤
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/Skin.gif)
|
||||
|
||||
### 百叶窗特效
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/Animation/5.gif)
|
||||
|
||||
### 棋盘特效
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/PageSwitch/棋盘效果.gif)
|
||||
|
||||
### ShaderToy-超级马里奥
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/ShaderToy/Preview4.gif)
|
||||
|
||||
### Qml 安卓简易热加载
|
||||
|
||||
![](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview/Hotload2.gif)
|
||||
|
||||
说明:简易热加载功能,正在完善中。整个TaoQuick将支持热加载。
|
||||
|
||||
|
||||
预览效果太多,浏览器会卡,放进单独的Markdown
|
||||
### 更多基础效果预览
|
||||
|
||||
[基础效果预览](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview-normal.md)
|
||||
|
||||
### 动画效果预览
|
||||
|
||||
[动画效果预览](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview-animation.md)
|
||||
|
||||
说明:动画效果暂不开源,博客/知乎/公众号会有教程和核心代码,有需要请单独联系我。
|
||||
|
||||
### 页面切换效果预览
|
||||
[页面切换效果预览](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview-PageSwitch.md)
|
||||
|
||||
说明:页面切换效果暂不开源,博客/知乎/公众号会有教程和核心代码,有需要请单独联系我。
|
||||
### ShaderToy效果预览
|
||||
|
||||
[ShaderToy效果预览](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview-ShaderToy.md)
|
||||
|
||||
### 其它特效
|
||||
|
||||
[其它特效](https://github.com/jaredtao/TaoQuickPreview/blob/master/Preview-Effect.md)
|
||||
|
||||
## TaoQuick 安装和使用
|
||||
|
||||
[TaoQuick 安装和使用](Install.md)
|
||||
|
||||
## 联系方式
|
||||
|
||||
***
|
||||
|
||||
| 作者 | 涛哥 |
|
||||
| ---- | -------------------------------- |
|
||||
|开发理念 | 弘扬鲁班文化,传承工匠精神 |
|
||||
| 博客 | https://jaredtao.github.io/ |
|
||||
|知乎专栏| https://zhuanlan.zhihu.com/TaoQt |
|
||||
|微信公众号| Qt进阶之路 |
|
||||
| 邮箱 | jared2020@163.com |
|
||||
| 微信 | xsd2410421 |
|
||||
| QQ、TIM | 759378563 |
|
||||
|
||||
***
|
||||
|
||||
QQ(TIM)、微信二维码
|
||||
|
||||
<img src="https://github.com/jaredtao/jaredtao.github.io/blob/master/img/qq_connect.jpg?raw=true" width="30%" height="30%" /><img src="https://github.com/jaredtao/jaredtao.github.io/blob/master/img/weixin_connect.jpg?raw=true" width="30%" height="30%" />
|
||||
|
||||
|
||||
****** 请放心联系我,乐于提供咨询服务,也可洽谈有偿技术支持相关事宜。
|
||||
|
||||
***
|
||||
## 赞助
|
||||
<img src="https://github.com/jaredtao/jaredtao.github.io/blob/master/img/weixin.jpg?raw=true" width="30%" height="30%" /><img src="https://github.com/jaredtao/jaredtao.github.io/blob/master/img/zhifubao.jpg?raw=true" width="30%" height="30%" />
|
||||
|
||||
****** 觉得分享的内容还不错, 就请作者喝杯奶茶吧~~
|
||||
***
|
||||
|
29
TaoQuick.pro
Normal file
29
TaoQuick.pro
Normal file
@ -0,0 +1,29 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += \
|
||||
TaoQuickDemo \
|
||||
TaoQuick
|
||||
|
||||
CONFIG += ordered
|
||||
|
||||
OTHER_FILES += README.md \
|
||||
Install.md \
|
||||
Preview-animation.md \
|
||||
Preview-normal.md \
|
||||
.clang-format \
|
||||
LICENSE \
|
||||
appveyor.yml \
|
||||
.travis.yml
|
||||
|
||||
macos {
|
||||
OTHER_FILES += \
|
||||
scripts/macos/install.sh \
|
||||
scripts/macos/build.sh \
|
||||
scripts/macos/deploy.sh
|
||||
}
|
||||
|
||||
linux {
|
||||
OTHER_FILES += \
|
||||
scripts/ubuntu/install.sh \
|
||||
scripts/ubuntu/build.sh \
|
||||
scripts/ubuntu/deploy.sh
|
||||
}
|
9
TaoQuick/Image.qrc
Normal file
9
TaoQuick/Image.qrc
Normal file
@ -0,0 +1,9 @@
|
||||
<RCC>
|
||||
<qresource prefix="/Core">
|
||||
<file>Image/ProgressBar/fail.png</file>
|
||||
<file>Image/ProgressBar/ok.png</file>
|
||||
<file>Image/ProgressBar/ok_circle.png</file>
|
||||
<file>Image/ProgressBar/fail_circle.png</file>
|
||||
<file>Image/Others/spinner.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
3
TaoQuick/Image/Others/spinner.png
Normal file
3
TaoQuick/Image/Others/spinner.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ecd0876db4764b9d0636043f5457579efa9e97d2d93c7ef97eac6b6456cd19d6
|
||||
size 3470
|
3
TaoQuick/Image/ProgressBar/fail.png
Normal file
3
TaoQuick/Image/ProgressBar/fail.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3d279ce03ff8621111ebac80e8e0a8b1ecdedd61ee7460fa853ea6516c43a12a
|
||||
size 176
|
3
TaoQuick/Image/ProgressBar/fail_circle.png
Normal file
3
TaoQuick/Image/ProgressBar/fail_circle.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5836e6e192be77289d4abf4eb373461f6500c64e1b89c9f71533954c16e864e2
|
||||
size 477
|
3
TaoQuick/Image/ProgressBar/ok.png
Normal file
3
TaoQuick/Image/ProgressBar/ok.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4893c8e45bd27b388051fc29fa76852a64ed80810d15981c3380ccc692a258e8
|
||||
size 246
|
3
TaoQuick/Image/ProgressBar/ok_circle.png
Normal file
3
TaoQuick/Image/ProgressBar/ok_circle.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d54d9627799e11e783e974f3a1ca054bc97a823e64dc3ce332b1869df859f93f
|
||||
size 395
|
22
TaoQuick/Qml.qrc
Normal file
22
TaoQuick/Qml.qrc
Normal file
@ -0,0 +1,22 @@
|
||||
<RCC>
|
||||
<qresource prefix="/Tao">
|
||||
<file>Qml/BasicComponent/Button/TGradientBtn.qml</file>
|
||||
<file>Qml/BasicComponent/Button/TImageBtn.qml</file>
|
||||
<file>Qml/BasicComponent/Button/TImgTextBtn.qml</file>
|
||||
<file>Qml/BasicComponent/Button/TTextBtn.qml</file>
|
||||
<file>Qml/BasicComponent/Mouse/TMoveArea.qml</file>
|
||||
<file>Qml/BasicComponent/Mouse/TTransArea.qml</file>
|
||||
<file>Qml/BasicComponent/Others/TBusyIndicator.qml</file>
|
||||
<file>Qml/BasicComponent/Others/TDragItem.qml</file>
|
||||
<file>Qml/BasicComponent/Others/TResizeBorder.qml</file>
|
||||
<file>Qml/BasicComponent/Others/TToolTip.qml</file>
|
||||
<file>Qml/BasicComponent/Others/TPopup.qml</file>
|
||||
<file>Qml/BasicComponent/Progress/TNormalProgress.qml</file>
|
||||
<file>Qml/BasicComponent/Progress/TCircleProgress.qml</file>
|
||||
<file>Qml/BasicComponent/Others/TDialog.qml</file>
|
||||
<file>Qml/BasicComponent/Progress/TInOut.qml</file>
|
||||
<file>Qml/BasicComponent/Others/TFPS.qml</file>
|
||||
<file>Qml/qmldir</file>
|
||||
<file>Qml/BasicComponent/Others/TShaderToy.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
164
TaoQuick/Qml/BasicComponent/Button/TGradientBtn.qml
Normal file
164
TaoQuick/Qml/BasicComponent/Button/TGradientBtn.qml
Normal file
@ -0,0 +1,164 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** This file is part of the TaoQuick project.
|
||||
**
|
||||
** Copyright 2019 JaredTao jared2020@163.com. https://github.com/jaredtao
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
|
||||
/*!
|
||||
\qmltype TGradientBtn
|
||||
\inqmlmodule TaoQuick
|
||||
\inherits Item
|
||||
\since 1.0
|
||||
\ingroup Button
|
||||
\brief 提供一个Material风格的按钮,点击的地方有圆弧放大的动画。
|
||||
|
||||
渐变按钮,参考Material风格实现,鼠标点击的地方一个圆弧,逐渐放大。
|
||||
示例代码:
|
||||
\qml
|
||||
TGradientBtn {
|
||||
text: qsTr("Button")
|
||||
width: 120
|
||||
height: 40
|
||||
onClicked: {
|
||||
console.log("渐变按钮被按下")
|
||||
}
|
||||
}
|
||||
\endqml
|
||||
*/
|
||||
Item {
|
||||
id: root
|
||||
|
||||
/*!
|
||||
\qmlproperty string TGradientBtn::text
|
||||
|
||||
渐变按钮要显示的文字
|
||||
*/
|
||||
property alias text: t.text
|
||||
|
||||
/*!
|
||||
\qmlproperty color TGradientBtn::textColor
|
||||
|
||||
渐变按钮文字的颜色
|
||||
*/
|
||||
property alias textColor: t.color
|
||||
|
||||
/*!
|
||||
渐变按钮文字的锚布局。默认为居中
|
||||
*/
|
||||
property alias textAnchors: t.anchors
|
||||
|
||||
/*!
|
||||
\qmlproperty enum TGradientBtn::textHorizontalAlignment
|
||||
|
||||
渐变按钮文字的垂直对齐方式。默认为垂直居中
|
||||
*/
|
||||
property alias textHorizontalAlignment: t.horizontalAlignment
|
||||
|
||||
/*!
|
||||
\qmlproperty enum TGradientBtn::textVerticalAlignment
|
||||
|
||||
渐变按钮文字的水平对齐方式。默认为水平居中
|
||||
*/
|
||||
property alias textVerticalAlignment: t.verticalAlignment
|
||||
|
||||
/*!
|
||||
渐变按钮文字Text实例,可以直接修改这个实例的属性
|
||||
|
||||
\qml
|
||||
TGradientBtn {
|
||||
|
||||
textItem.text: qsTr("Button")
|
||||
textItem.color: "red"
|
||||
|
||||
width: 120
|
||||
height: 40
|
||||
onClicked: {
|
||||
console.log("渐变按钮被按下")
|
||||
}
|
||||
}
|
||||
\endqml
|
||||
*/
|
||||
property alias textItem: t
|
||||
|
||||
/*!
|
||||
\qmlproperty bool TGradientBtn::containsMouse
|
||||
|
||||
渐变按钮是否有鼠标悬浮
|
||||
*/
|
||||
property alias containsMouse: mouseBtn.containsMouse
|
||||
/*!
|
||||
\qmlproperty bool TGradientBtn::containsMouse
|
||||
|
||||
渐变按钮是否有鼠标按下
|
||||
*/
|
||||
property alias containsPress: mouseBtn.containsPress
|
||||
|
||||
/*!
|
||||
\qmlsignal TGradientBtn::clicked()
|
||||
|
||||
渐变按钮按下时,发出此信号
|
||||
*/
|
||||
signal clicked();
|
||||
|
||||
Rectangle {
|
||||
id: hoverRect
|
||||
anchors.fill: parent
|
||||
visible: root.containsMouse || root.containsPress
|
||||
color: Qt.lighter("gray")
|
||||
radius: 5
|
||||
clip: true
|
||||
Rectangle {
|
||||
id: pressRect
|
||||
radius: 0
|
||||
smooth: true
|
||||
property int startX: root.width / 2
|
||||
property int startY: root.height / 2
|
||||
x: startX - radius
|
||||
y: startY - radius
|
||||
width: radius * 2
|
||||
height: radius * 2
|
||||
visible: radius > 0
|
||||
color: "gray"
|
||||
|
||||
SequentialAnimation {
|
||||
id: pressAnimation
|
||||
NumberAnimation {
|
||||
target: pressRect
|
||||
property: "radius"
|
||||
from: 0
|
||||
to: Math.max(pressRect.startX, root.width - pressRect.startX)
|
||||
duration: 500
|
||||
}
|
||||
ScriptAction {
|
||||
script: {
|
||||
pressRect.radius = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: t
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
}
|
||||
MouseArea {
|
||||
id: mouseBtn
|
||||
anchors.fill: parent;
|
||||
hoverEnabled: parent.enabled;
|
||||
onPressed: {
|
||||
pressRect.startX = mouseX
|
||||
pressRect.startY = mouseY
|
||||
pressAnimation.start()
|
||||
}
|
||||
onClicked: root.clicked();
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
36
TaoQuick/Qml/BasicComponent/Button/TImageBtn.qml
Normal file
36
TaoQuick/Qml/BasicComponent/Button/TImageBtn.qml
Normal file
@ -0,0 +1,36 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Item {
|
||||
id: root
|
||||
property url normalUrl //常规状态下的图片路径
|
||||
property url hoveredUrl //悬浮
|
||||
property url pressedUrl //按下
|
||||
property url disabledUrl //禁用
|
||||
|
||||
property alias imageItem: img //直接别名导出Image实例,外面可以修改其任意属性
|
||||
property alias imageUrl: img.source //别名导出图片路径
|
||||
|
||||
property alias imageWidth: img.width
|
||||
property alias imageHeight: img.height
|
||||
property alias imageAnchors: img.anchors
|
||||
property alias containsMouse: area.containsMouse
|
||||
property alias containsPress: area.containsPress
|
||||
//点击信号
|
||||
signal clicked();
|
||||
Image {
|
||||
id: img
|
||||
anchors.fill: parent
|
||||
//默认按鼠标状态选取不同的图片
|
||||
source: root.enabled ? (containsPress ? pressedUrl : (containsMouse ? hoveredUrl : normalUrl)) : disabledUrl
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent;
|
||||
hoverEnabled: parent.enabled;
|
||||
onClicked: root.clicked();
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
preventStealing: true
|
||||
}
|
||||
}
|
||||
|
80
TaoQuick/Qml/BasicComponent/Button/TImgTextBtn.qml
Normal file
80
TaoQuick/Qml/BasicComponent/Button/TImgTextBtn.qml
Normal file
@ -0,0 +1,80 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Rectangle {
|
||||
id: root
|
||||
property url normalUrl
|
||||
property url hoveredUrl
|
||||
property url pressedUrl
|
||||
property url disabledUrl
|
||||
|
||||
property alias imageItem: img
|
||||
property alias imageUrl: img.source
|
||||
property alias imageWidth: img.width
|
||||
property alias imageHeight: img.height
|
||||
|
||||
property alias textItem: t
|
||||
property alias text: t.text
|
||||
property alias textColor: t.color
|
||||
property alias containsMouse: area.containsMouse
|
||||
property alias containsPress: area.containsPress
|
||||
signal clicked();
|
||||
|
||||
//5.10以前的版本,Qml中没有枚举,用int属性代替枚举
|
||||
property int layoutType: layoutImageLeft //布局类型,默认图片在左,外部可修改
|
||||
readonly property int layoutImageLeft: 0 //图片在左 只读属性,代替枚举
|
||||
readonly property int layoutImageRight: 1 //图片在右 只读属性,代替枚举
|
||||
readonly property int layoutImageUp: 2 //图片在上 只读属性,代替枚举
|
||||
readonly property int layoutImageDown: 3 //图片在下 只读属性,代替枚举
|
||||
color: "transparent"
|
||||
Image {
|
||||
id: img
|
||||
source: root.enabled ? (containsPress ? pressedUrl : (containsMouse ? hoveredUrl : normalUrl)) : disabledUrl
|
||||
}
|
||||
Text {
|
||||
id: t
|
||||
//默认文字对齐方式为水平和垂直居中
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
//按布局类型 处理布局
|
||||
Component.onCompleted: {
|
||||
switch (layoutType) {
|
||||
case layoutImageLeft:
|
||||
img.anchors.verticalCenter = root.verticalCenter
|
||||
t.anchors.verticalCenter = root.verticalCenter
|
||||
img.anchors.left = root.left
|
||||
t.anchors.left = img.right
|
||||
t.anchors.leftMargin = 6
|
||||
break;
|
||||
case layoutImageRight:
|
||||
img.anchors.verticalCenter = root.verticalCenter
|
||||
t.anchors.verticalCenter = root.verticalCenter
|
||||
t.anchors.left = root.left
|
||||
img.anchors.left = t.right
|
||||
img.anchors.leftMargin = 6
|
||||
break
|
||||
case layoutImageUp:
|
||||
img.anchors.horizontalCenter = root.horizontalCenter
|
||||
t.anchors.horizontalCenter = root.horizontalCenter
|
||||
img.anchors.top = root.top
|
||||
t.anchors.top = img.bottom
|
||||
t.anchors.topMargin = 6
|
||||
break
|
||||
case layoutImageDown:
|
||||
img.anchors.horizontalCenter = root.horizontalCenter
|
||||
t.anchors.horizontalCenter = root.horizontalCenter
|
||||
t.anchors.top = root.top
|
||||
img.anchors.top = t.bottom
|
||||
img.anchors.topMargin = 6
|
||||
break;
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent;
|
||||
hoverEnabled: parent.enabled;
|
||||
onClicked: root.clicked();
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
||||
|
32
TaoQuick/Qml/BasicComponent/Button/TTextBtn.qml
Normal file
32
TaoQuick/Qml/BasicComponent/Button/TTextBtn.qml
Normal file
@ -0,0 +1,32 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Rectangle {
|
||||
id: root
|
||||
property alias textItem: t //导出Text实例,方便外部直接修改
|
||||
property alias text: t.text //导出文本
|
||||
property alias textColor: t.color //导出文本颜色
|
||||
property alias containsMouse: area.containsMouse //导出鼠标悬浮
|
||||
property alias containsPress: area.containsPress //导出鼠标按下
|
||||
signal clicked(); //自定义点击信号
|
||||
color: "transparent"
|
||||
Text {
|
||||
id: t
|
||||
//默认坐标居中
|
||||
anchors.centerIn: parent
|
||||
//默认文字对齐方式为水平和垂直居中
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
//默认宽度为parent的宽度,这样字太长超出范围时自动显示省略号
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent;
|
||||
hoverEnabled: parent.enabled;
|
||||
onClicked: root.clicked(); //点击时触发自定义点击信号
|
||||
cursorShape: Qt.PointingHandCursor //悬浮或点击时的鼠标样式
|
||||
}
|
||||
}
|
||||
|
29
TaoQuick/Qml/BasicComponent/Mouse/TMoveArea.qml
Normal file
29
TaoQuick/Qml/BasicComponent/Mouse/TMoveArea.qml
Normal file
@ -0,0 +1,29 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
|
||||
property real lastX: 0
|
||||
property real lastY: 0
|
||||
property bool mask: false //有时候外面需要屏蔽拖动,导出一个mask属性, 默认false。
|
||||
property var control: parent //导出一个control属性,指定要拖动的目标, 默认就用parent好了。注意目标要有x和y属性并且可修改
|
||||
onPressed: {
|
||||
lastX = mouseX;
|
||||
lastY = mouseY;
|
||||
}
|
||||
onContainsMouseChanged: { //修改一下鼠标样式,以示区别
|
||||
if (containsMouse) {
|
||||
cursorShape = Qt.SizeAllCursor;
|
||||
} else {
|
||||
cursorShape = Qt.ArrowCursor;
|
||||
}
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (!mask && pressed && control)
|
||||
{
|
||||
control.x +=mouseX - lastX
|
||||
control.y +=mouseY - lastY
|
||||
}
|
||||
}
|
||||
}
|
15
TaoQuick/Qml/BasicComponent/Mouse/TTransArea.qml
Normal file
15
TaoQuick/Qml/BasicComponent/Mouse/TTransArea.qml
Normal file
@ -0,0 +1,15 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
MouseArea {
|
||||
id:operMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onDoubleClicked: { mouse.accepted = false;}
|
||||
onPositionChanged: { mouse.accepted = false;}
|
||||
onPressed: { mouse.accepted = false; }
|
||||
onPressAndHold: { mouse.accepted = false; }
|
||||
onClicked: { mouse.accepted = false;}
|
||||
onReleased: { mouse.accepted = false;}
|
||||
onWheel: { wheel.accepted = false; }
|
||||
}
|
62
TaoQuick/Qml/BasicComponent/Others/TBusyIndicator.qml
Normal file
62
TaoQuick/Qml/BasicComponent/Others/TBusyIndicator.qml
Normal file
@ -0,0 +1,62 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
BusyIndicator {
|
||||
id: control
|
||||
width: 64
|
||||
height: 64
|
||||
property color busyColor: "#008b8b"
|
||||
property int busyRadius: 5
|
||||
property int busyCount: 6
|
||||
property int durationPerCycle: 1500
|
||||
|
||||
contentItem: Item {
|
||||
width: control.width
|
||||
height: control.height
|
||||
Item {
|
||||
id: item
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
opacity: control.running ? 1 : 0
|
||||
|
||||
Behavior on opacity {
|
||||
OpacityAnimator {
|
||||
duration: 250
|
||||
}
|
||||
}
|
||||
|
||||
RotationAnimator {
|
||||
target: item
|
||||
running: control.visible && control.running
|
||||
from: 0
|
||||
to: 360
|
||||
loops: Animation.Infinite
|
||||
duration: durationPerCycle
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
model: busyCount
|
||||
|
||||
Rectangle {
|
||||
x: item.width / 2 - width / 2
|
||||
y: item.height / 2 - height / 2
|
||||
implicitWidth: busyRadius * 2
|
||||
implicitHeight: busyRadius * 2
|
||||
radius: busyRadius
|
||||
color: busyColor
|
||||
transform: [
|
||||
Translate {
|
||||
y: -Math.min(item.width, item.height) * 0.5 + busyRadius
|
||||
},
|
||||
Rotation {
|
||||
angle: index / repeater.count * 360
|
||||
origin.x: busyRadius
|
||||
origin.y: busyRadius
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
73
TaoQuick/Qml/BasicComponent/Others/TDialog.qml
Normal file
73
TaoQuick/Qml/BasicComponent/Others/TDialog.qml
Normal file
@ -0,0 +1,73 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Dialogs 1.3
|
||||
Item {
|
||||
//顶层使用Item,不用FileDialog,屏蔽FileDialog内部属性和函数
|
||||
enum Type {
|
||||
CreateFile,
|
||||
OpenFile,
|
||||
OpenFiles,
|
||||
OpenFolder
|
||||
}
|
||||
property int __type
|
||||
property var __acceptCallback: function(file) {}
|
||||
|
||||
FileDialog {
|
||||
id: d
|
||||
folder: shortcuts.home
|
||||
onAccepted: {
|
||||
switch(__type) {
|
||||
case TDialog.Type.CreateFile:
|
||||
__acceptCallback(d.fileUrl)
|
||||
break
|
||||
case TDialog.Type.OpenFile:
|
||||
__acceptCallback(d.fileUrl)
|
||||
break
|
||||
case TDialog.Type.OpenFiles:
|
||||
__acceptCallback(d.fileUrls)
|
||||
break
|
||||
case TDialog.Type.OpenFolder:
|
||||
__acceptCallback(d.folder)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
function createFile(title, nameFilters, callback) {
|
||||
__type = TDialog.Type.CreateFile
|
||||
d.selectExisting = false
|
||||
d.selectFolder = false
|
||||
d.selectMultiple = false
|
||||
d.title = title
|
||||
d.nameFilters = nameFilters
|
||||
__acceptCallback = callback
|
||||
d.open()
|
||||
}
|
||||
function openFile(title, nameFilters, callback) {
|
||||
__type = TDialog.Type.OpenFile
|
||||
d.selectExisting = true
|
||||
d.selectFolder = false
|
||||
d.selectMultiple = false
|
||||
d.title = title
|
||||
d.nameFilters = nameFilters
|
||||
__acceptCallback = callback
|
||||
d.open()
|
||||
}
|
||||
function openFiles(title, nameFilters, callback) {
|
||||
__type = TDialog.Type.OpenFiles
|
||||
d.selectExisting = true
|
||||
d.selectFolder = false
|
||||
d.selectMultiple = true
|
||||
d.title = title
|
||||
d.nameFilters = nameFilters
|
||||
__acceptCallback = callback
|
||||
d.open()
|
||||
}
|
||||
function openFolder(title, callback) {
|
||||
__type = TDialog.Type.OpenFolder
|
||||
d.selectExisting = true
|
||||
d.selectFolder = true
|
||||
d.selectMultiple = false
|
||||
d.title = title
|
||||
__acceptCallback = callback
|
||||
d.open()
|
||||
}
|
||||
}
|
45
TaoQuick/Qml/BasicComponent/Others/TDragItem.qml
Normal file
45
TaoQuick/Qml/BasicComponent/Others/TDragItem.qml
Normal file
@ -0,0 +1,45 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Item {
|
||||
id: root
|
||||
property alias containsMouse: mouseArea.containsMouse
|
||||
signal posChange(int xOffset, int yOffset)
|
||||
implicitWidth: 12
|
||||
implicitHeight: 12
|
||||
property int posType: Qt.ArrowCursor
|
||||
|
||||
//5.10之前, qml是不能定义枚举的,用只读的int属性代替一下。
|
||||
readonly property int posLeftTop: Qt.SizeFDiagCursor
|
||||
readonly property int posLeft: Qt.SizeHorCursor
|
||||
readonly property int posLeftBottom: Qt.SizeBDiagCursor
|
||||
readonly property int posTop: Qt.SizeVerCursor
|
||||
readonly property int posBottom: Qt.SizeVerCursor
|
||||
readonly property int posRightTop: Qt.SizeBDiagCursor
|
||||
readonly property int posRight: Qt.SizeHorCursor
|
||||
readonly property int posRightBottom: Qt.SizeFDiagCursor
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
property int lastX: 0
|
||||
property int lastY: 0
|
||||
onContainsMouseChanged: {
|
||||
if (containsMouse) {
|
||||
cursorShape = posType;
|
||||
} else {
|
||||
cursorShape = Qt.ArrowCursor;
|
||||
}
|
||||
}
|
||||
onPressedChanged: {
|
||||
if (containsPress) {
|
||||
lastX = mouseX;
|
||||
lastY = mouseY;
|
||||
}
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (pressed) {
|
||||
posChange(mouseX - lastX, mouseY - lastY)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
44
TaoQuick/Qml/BasicComponent/Others/TFPS.qml
Normal file
44
TaoQuick/Qml/BasicComponent/Others/TFPS.qml
Normal file
@ -0,0 +1,44 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import TaoQuick 1.0
|
||||
Item {
|
||||
property int fps: 60
|
||||
|
||||
property int frameCount: 0
|
||||
property color textColor: "#f7e08c"
|
||||
Image {
|
||||
id: spinner
|
||||
source: "qrc:/Core/Image/Others/spinner.png"
|
||||
width: 32
|
||||
height: 32
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
RotationAnimation on rotation {
|
||||
from: 0
|
||||
to: 360
|
||||
running: true
|
||||
loops: Animation.Infinite
|
||||
duration: 1000
|
||||
}
|
||||
onRotationChanged: frameCount++
|
||||
}
|
||||
Text {
|
||||
anchors.left: spinner.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "FPS" + fps
|
||||
font.pixelSize: 20
|
||||
style: Text.Outline
|
||||
styleColor: "#606060"
|
||||
// renderType: Text.NativeRendering
|
||||
color: textColor
|
||||
}
|
||||
Timer {
|
||||
interval: 1000
|
||||
repeat: true
|
||||
running: true
|
||||
onTriggered: {
|
||||
fps = frameCount
|
||||
frameCount = 0
|
||||
}
|
||||
}
|
||||
}
|
50
TaoQuick/Qml/BasicComponent/Others/TPopup.qml
Normal file
50
TaoQuick/Qml/BasicComponent/Others/TPopup.qml
Normal file
@ -0,0 +1,50 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Item {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
property alias popupVisible: popup.visible
|
||||
property alias contentItem: popup.contentItem
|
||||
property color barColor: "white"
|
||||
property alias backgroundItem: background
|
||||
property real backgroundWidth: 200
|
||||
property real backgroundHeight: 160
|
||||
property color borderColor: barColor
|
||||
property real borderWidth: 0
|
||||
|
||||
property real verticalOffset: 20
|
||||
//矩形旋转45度,一半被toolTip遮住(重合),另一半三角形和ToolTip组成一个带箭头的ToolTip
|
||||
Rectangle {
|
||||
id: bar
|
||||
visible: popup.visible
|
||||
rotation: 45
|
||||
width: 16
|
||||
height: 16
|
||||
color: barColor
|
||||
//水平居中
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
//垂直方向上,由ToolTip的y值,决定位置
|
||||
anchors.verticalCenter: parent.bottom
|
||||
anchors.verticalCenterOffset: verticalOffset
|
||||
}
|
||||
Popup {
|
||||
id: popup
|
||||
width: backgroundWidth
|
||||
height: backgroundHeight
|
||||
background: Rectangle {
|
||||
id: background
|
||||
color: barColor
|
||||
radius: 8
|
||||
border.color:borderColor
|
||||
border.width: borderWidth
|
||||
}
|
||||
}
|
||||
function show() {
|
||||
popup.x = (root.width - popup.width) / 2
|
||||
popup.y = root.height + verticalOffset
|
||||
popupVisible = true
|
||||
}
|
||||
function hide() {
|
||||
popupVisible = false
|
||||
}
|
||||
}
|
115
TaoQuick/Qml/BasicComponent/Others/TResizeBorder.qml
Normal file
115
TaoQuick/Qml/BasicComponent/Others/TResizeBorder.qml
Normal file
@ -0,0 +1,115 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
Item {
|
||||
id: root
|
||||
//controller 要控制大小的目标,可以是Item,也可以是view,只要提供x、y、width、height等属性的修改
|
||||
//默认值为parent
|
||||
property var control: parent
|
||||
//左上角的拖拽
|
||||
TDragItem {
|
||||
id: leftTopHandle
|
||||
posType: posLeftTop
|
||||
onPosChange: {
|
||||
//不要简化这个判断条件,至少让以后维护的人能看懂。我当然知道能化简,化简过几分钟之后我自己都看不懂了。
|
||||
if (control.x + xOffset < control.x + control.width)
|
||||
control.x += xOffset;
|
||||
if (control.y + yOffset < control.y + control.height)
|
||||
control.y += yOffset;
|
||||
if (control.width - xOffset > 0)
|
||||
control.width-= xOffset;
|
||||
if (control.height -yOffset > 0)
|
||||
control.height -= yOffset;
|
||||
}
|
||||
}
|
||||
//右上角拖拽
|
||||
TDragItem {
|
||||
id: rightTopHandle
|
||||
posType: posRightTop
|
||||
x: parent.width - width
|
||||
onPosChange: {
|
||||
//向左拖动时,xOffset为负数
|
||||
if (control.width + xOffset > 0)
|
||||
control.width += xOffset;
|
||||
if (control.height - yOffset > 0)
|
||||
control.height -= yOffset;
|
||||
if (control.y + yOffset < control.y + control.height)
|
||||
control.y += yOffset;
|
||||
}
|
||||
}
|
||||
//左下角拖拽
|
||||
TDragItem {
|
||||
id: leftBottomHandle
|
||||
posType: posLeftBottom
|
||||
y: parent.height - height
|
||||
onPosChange: {
|
||||
if (control.x + xOffset < control.x + control.width)
|
||||
control.x += xOffset;
|
||||
if (control.width - xOffset > 0)
|
||||
control.width-= xOffset;
|
||||
if (control.height + yOffset > 0)
|
||||
control.height += yOffset;
|
||||
}
|
||||
}
|
||||
//右下角拖拽
|
||||
TDragItem {
|
||||
id: rightBottomHandle
|
||||
posType: posRightBottom
|
||||
x: parent.width - width
|
||||
y: parent.height - height
|
||||
onPosChange: {
|
||||
if (control.width + xOffset > 0)
|
||||
control.width += xOffset;
|
||||
if (control.height + yOffset > 0)
|
||||
control.height += yOffset;
|
||||
}
|
||||
}
|
||||
//上边拖拽
|
||||
TDragItem {
|
||||
posType: posTop
|
||||
width: parent.width - leftTopHandle.width - rightTopHandle.width
|
||||
x: leftBottomHandle.width
|
||||
onPosChange: {
|
||||
if (control.y + yOffset < control.y + control.height)
|
||||
control.y += yOffset;
|
||||
if (control.height - yOffset > 0)
|
||||
control.height -= yOffset;
|
||||
}
|
||||
}
|
||||
|
||||
//左边拖拽
|
||||
TDragItem {
|
||||
posType: posLeft
|
||||
height: parent.height - leftTopHandle.height - leftBottomHandle.height
|
||||
y: leftTopHandle.height
|
||||
onPosChange: {
|
||||
if (control.x + xOffset < control.x + control.width)
|
||||
control.x += xOffset;
|
||||
if (control.width - xOffset > 0)
|
||||
control.width-= xOffset;
|
||||
}
|
||||
}
|
||||
//右边拖拽
|
||||
TDragItem {
|
||||
posType: posRight
|
||||
x: parent.width - width
|
||||
height: parent.height - rightTopHandle.height - rightBottomHandle.height
|
||||
y: rightTopHandle.height
|
||||
onPosChange: {
|
||||
if (control.width + xOffset > 0)
|
||||
control.width += xOffset;
|
||||
}
|
||||
}
|
||||
//下边拖拽
|
||||
TDragItem {
|
||||
posType: posBottom
|
||||
x: leftBottomHandle.width
|
||||
y: parent.height - height
|
||||
width: parent.width - leftBottomHandle.width - rightBottomHandle.width
|
||||
onPosChange: {
|
||||
if (control.height + yOffset > 0)
|
||||
control.height += yOffset;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
172
TaoQuick/Qml/BasicComponent/Others/TShaderToy.qml
Normal file
172
TaoQuick/Qml/BasicComponent/Others/TShaderToy.qml
Normal file
@ -0,0 +1,172 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
/*
|
||||
vec3 iResolution image/buffer The viewport resolution (z is pixel aspect ratio, usually 1.0)
|
||||
float iTime image/sound/buffer Current time in seconds
|
||||
float iTimeDelta image/buffer Time it takes to render a frame, in seconds
|
||||
int iFrame image/buffer Current frame
|
||||
float iFrameRate image/buffer Number of frames rendered per second
|
||||
float iChannelTime[4] image/buffer Time for channel (if video or sound), in seconds
|
||||
vec3 iChannelResolution[4] image/buffer/sound Input texture resolution for each channel
|
||||
vec4 iMouse image/buffer xy = current pixel coords (if LMB is down). zw = click pixel
|
||||
sampler2D iChannel{i} image/buffer/sound Sampler for input textures i
|
||||
vec4 iDate image/buffer/sound Year, month, day, time in seconds in .xyzw
|
||||
float iSampleRate image/buffer/sound The sound sample rate (typically 44100)
|
||||
*/
|
||||
ShaderEffect {
|
||||
id: shader
|
||||
|
||||
//properties for shader
|
||||
|
||||
//not pass to shader
|
||||
readonly property vector3d defaultResolution: Qt.vector3d(shader.width, shader.height, shader.width / shader.height)
|
||||
function calcResolution(channel) {
|
||||
if (channel) {
|
||||
return Qt.vector3d(channel.width, channel.height, channel.width / channel.height);
|
||||
} else {
|
||||
return defaultResolution;
|
||||
}
|
||||
}
|
||||
//pass
|
||||
readonly property vector3d iResolution: defaultResolution
|
||||
property real iTime: 0
|
||||
property real iTimeDelta: 100
|
||||
property int iFrame: 10
|
||||
property real iFrameRate
|
||||
property vector4d iMouse;
|
||||
property var iChannel0; //only Image or ShaderEffectSource
|
||||
property var iChannel1; //only Image or ShaderEffectSource
|
||||
property var iChannel2; //only Image or ShaderEffectSource
|
||||
property var iChannel3; //only Image or ShaderEffectSource
|
||||
property var iChannelTime: [0, 1, 2, 3]
|
||||
property var iChannelResolution: [calcResolution(iChannel0), calcResolution(iChannel1), calcResolution(iChannel2), calcResolution(iChannel3)]
|
||||
property vector4d iDate;
|
||||
property real iSampleRate: 44100
|
||||
|
||||
//properties for Qml controller
|
||||
property alias hoverEnabled: mouse.hoverEnabled
|
||||
property bool running: true
|
||||
function restart() {
|
||||
shader.iTime = 0
|
||||
running = true
|
||||
timer1.restart()
|
||||
}
|
||||
Timer {
|
||||
id: timer1
|
||||
running: shader.running
|
||||
triggeredOnStart: true
|
||||
interval: 16
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
shader.iTime += 0.016;
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
running: shader.running
|
||||
interval: 1000
|
||||
onTriggered: {
|
||||
var date = new Date();
|
||||
shader.iDate.x = date.getFullYear();
|
||||
shader.iDate.y = date.getMonth();
|
||||
shader.iDate.z = date.getDay();
|
||||
shader.iDate.w = date.getSeconds()
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
onPositionChanged: {
|
||||
shader.iMouse.x = mouseX
|
||||
shader.iMouse.y = mouseY
|
||||
}
|
||||
onClicked: {
|
||||
shader.iMouse.z = mouseX
|
||||
shader.iMouse.w = mouseY
|
||||
}
|
||||
}
|
||||
readonly property string gles2Ver: "
|
||||
#define texture texture2D
|
||||
precision mediump float;
|
||||
"
|
||||
readonly property string gles3Ver: "#version 300 es
|
||||
#define varying in
|
||||
#define gl_FragColor fragColor
|
||||
precision mediump float;
|
||||
|
||||
out vec4 fragColor;
|
||||
"
|
||||
|
||||
readonly property string gl3Ver: "#version 150
|
||||
#define varying in
|
||||
#define gl_FragColor fragColor
|
||||
#define lowp
|
||||
#define mediump
|
||||
#define highp
|
||||
|
||||
out vec4 fragColor;
|
||||
"
|
||||
readonly property string gl2Ver: "#version 110
|
||||
#define texture texture2D
|
||||
"
|
||||
property string versionString: {
|
||||
if (Qt.platform.os === "android") {
|
||||
if (GraphicsInfo.majorVersion === 3) {
|
||||
console.log("android gles 3")
|
||||
return gles3Ver
|
||||
} else {
|
||||
console.log("android gles 2")
|
||||
return gles2Ver
|
||||
}
|
||||
} else {
|
||||
if (GraphicsInfo.majorVersion === 3 ||GraphicsInfo.majorVersion === 4) {
|
||||
return gl3Ver
|
||||
} else {
|
||||
return gl2Ver
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vertexShader: "
|
||||
uniform mat4 qt_Matrix;
|
||||
attribute vec4 qt_Vertex;
|
||||
attribute vec2 qt_MultiTexCoord0;
|
||||
varying vec2 qt_TexCoord0;
|
||||
varying vec4 vertex;
|
||||
void main() {
|
||||
vertex = qt_Vertex;
|
||||
gl_Position = qt_Matrix * vertex;
|
||||
qt_TexCoord0 = qt_MultiTexCoord0;
|
||||
}"
|
||||
readonly property string forwardString: versionString + "
|
||||
varying vec2 qt_TexCoord0;
|
||||
varying vec4 vertex;
|
||||
uniform lowp float qt_Opacity;
|
||||
|
||||
uniform vec3 iResolution;
|
||||
uniform float iTime;
|
||||
uniform float iTimeDelta;
|
||||
uniform int iFrame;
|
||||
uniform float iFrameRate;
|
||||
uniform float iChannelTime[4];
|
||||
uniform vec3 iChannelResolution[4];
|
||||
uniform vec4 iMouse;
|
||||
uniform vec4 iDate;
|
||||
uniform float iSampleRate;
|
||||
uniform sampler2D iChannel0;
|
||||
uniform sampler2D iChannel1;
|
||||
uniform sampler2D iChannel2;
|
||||
uniform sampler2D iChannel3;
|
||||
"
|
||||
readonly property string startCode: "
|
||||
void main(void)
|
||||
{
|
||||
mainImage(gl_FragColor, vec2(vertex.x, iResolution.y - vertex.y));
|
||||
}"
|
||||
readonly property string defaultPixelShader: "
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord)
|
||||
{
|
||||
fragColor = vec4(fragCoord, fragCoord.x, fragCoord.y);
|
||||
}"
|
||||
property string pixelShader: ""
|
||||
fragmentShader: forwardString + (pixelShader ? pixelShader : defaultPixelShader) + startCode
|
||||
}
|
36
TaoQuick/Qml/BasicComponent/Others/TToolTip.qml
Normal file
36
TaoQuick/Qml/BasicComponent/Others/TToolTip.qml
Normal file
@ -0,0 +1,36 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Item {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
property alias text: toolTip.text
|
||||
property alias tipVisible: toolTip.visible
|
||||
property alias delay: toolTip.delay
|
||||
property alias timeout: toolTip.timeout
|
||||
property color barColor: "white"
|
||||
//矩形旋转45度,一半被toolTip遮住(重合),另一半三角形和ToolTip组成一个带箭头的ToolTip
|
||||
Rectangle {
|
||||
id: bar
|
||||
visible: toolTip.visible
|
||||
rotation: 45
|
||||
width: 10
|
||||
height: 10
|
||||
color: barColor
|
||||
//水平居中
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
//垂直方向上,由ToolTip的y值,决定位置
|
||||
anchors.verticalCenter: toolTip.y > 0 ? parent.bottom : parent.top
|
||||
anchors.verticalCenterOffset: toolTip.y > 0 ? 5 : -5
|
||||
}
|
||||
ToolTip {
|
||||
id: toolTip
|
||||
contentItem: Text {
|
||||
text: toolTip.text
|
||||
}
|
||||
background: Rectangle {
|
||||
id: background
|
||||
color: barColor
|
||||
radius: 8
|
||||
}
|
||||
}
|
||||
}
|
70
TaoQuick/Qml/BasicComponent/Progress/TCircleProgress.qml
Normal file
70
TaoQuick/Qml/BasicComponent/Progress/TCircleProgress.qml
Normal file
@ -0,0 +1,70 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtGraphicalEffects 1.12
|
||||
import TaoQuick 1.0
|
||||
import "../../"
|
||||
Item {
|
||||
id: r
|
||||
property int percent: 0
|
||||
|
||||
enum BarType {
|
||||
Text,
|
||||
SucceedOrFailed,
|
||||
NoBar
|
||||
}
|
||||
readonly property color __backColor: "#f5f5f5"
|
||||
readonly property color __blueColor: "#1890ff"
|
||||
readonly property color __succeedColor: "#52c41a"
|
||||
readonly property color __failedColor: "#f5222d"
|
||||
property color backgroundColor: __backColor
|
||||
property color frontColor: {
|
||||
switch (barType) {
|
||||
case TCircleProgress.BarType.SucceedOrFailed:
|
||||
return percent === 100 ? __succeedColor : __failedColor
|
||||
default:
|
||||
return __blueColor
|
||||
}
|
||||
}
|
||||
|
||||
property string text: String("%1%").arg(percent)
|
||||
property var barType: TCircleProgress.BarType.Text
|
||||
Rectangle {
|
||||
id: back
|
||||
color: "transparent"
|
||||
anchors.fill: parent
|
||||
border.color: percent === 100 ? frontColor : backgroundColor
|
||||
border.width: 10
|
||||
radius: width / 2
|
||||
}
|
||||
Text {
|
||||
id: t
|
||||
enabled: barType === TCircleProgress.BarType.Text
|
||||
visible: enabled
|
||||
text: r.text
|
||||
anchors.centerIn: parent
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
Image {
|
||||
id: image
|
||||
source: percent === 100 ? "qrc:/Core/Image/ProgressBar/ok.png" : "qrc:/Core/Image/ProgressBar/fail.png"
|
||||
enabled: barType === TCircleProgress.BarType.SucceedOrFailed
|
||||
visible: enabled
|
||||
scale: 2
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
ConicalGradient {
|
||||
anchors.fill: back
|
||||
source: back
|
||||
enabled: percent != 100
|
||||
visible: enabled
|
||||
smooth: true
|
||||
antialiasing: true
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: frontColor }
|
||||
GradientStop { position: percent / 100 ; color: frontColor }
|
||||
GradientStop { position: percent / 100 + 0.001; color: backgroundColor }
|
||||
GradientStop { position: 1.0; color: backgroundColor }
|
||||
}
|
||||
}
|
||||
}
|
104
TaoQuick/Qml/BasicComponent/Progress/TInOut.qml
Normal file
104
TaoQuick/Qml/BasicComponent/Progress/TInOut.qml
Normal file
@ -0,0 +1,104 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Item {
|
||||
width: 400
|
||||
height: 400
|
||||
|
||||
property var colors: [
|
||||
"#a93190",
|
||||
"#c13fa6",
|
||||
"#d64172",
|
||||
"#e44e48",
|
||||
"#f25650",
|
||||
"#f57241",
|
||||
"#f47032",
|
||||
"#ff9329",
|
||||
"#ff9b38",
|
||||
"#ffc101",
|
||||
"#ffd103",
|
||||
"#ffde00",
|
||||
"#4ee366",
|
||||
"#4bf49a",
|
||||
"#4ef4c3",
|
||||
"#51c2f8",
|
||||
"#43b0e7",
|
||||
"#32a0d6",
|
||||
"#ffffff"
|
||||
]
|
||||
|
||||
property real maxDistance: 100
|
||||
property vector2d originPos: Qt.vector2d(big.x + big.width / 2, big.y + big.height / 2)
|
||||
property vector2d targetPos
|
||||
property int angle
|
||||
|
||||
Rectangle {
|
||||
id: big
|
||||
width: 40
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: Qt.lighter(colors[0])
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
Rectangle {
|
||||
id: small
|
||||
width: 10
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: {
|
||||
let p = small.mapToItem(big, small.x, small.y)
|
||||
return big.contains(Qt.point(p.x, p.y)) ? big.color : colors[5]
|
||||
}
|
||||
Component.onCompleted: {
|
||||
x = originPos.x
|
||||
y = originPos.y
|
||||
}
|
||||
SequentialAnimation {
|
||||
running: true
|
||||
loops: Animation.Infinite
|
||||
ScriptAction {
|
||||
script: {
|
||||
angle = getRandomArbitrary(0, 360)
|
||||
|
||||
let x = originPos.x + maxDistance * Math.cos(degreeToRadians(angle))
|
||||
let y = originPos.y + maxDistance * Math.sin(degreeToRadians(angle))
|
||||
targetPos = Qt.vector2d(x, y)
|
||||
console.log(targetPos)
|
||||
}
|
||||
}
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: small; easing.type: Easing.InExpo; property:"x"; to: targetPos.x; duration: 800; }
|
||||
NumberAnimation { target: small; easing.type: Easing.InExpo; property:"y"; to: targetPos.y; duration: 800; }
|
||||
}
|
||||
|
||||
PauseAnimation { duration: 200}
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: small; easing.type: Easing.InExpo; property:"x"; to: originPos.x; duration: 800; }
|
||||
NumberAnimation { target: small; easing.type: Easing.InExpo; property:"y"; to: originPos.y; duration: 800; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//得到一个两数之间的随机数 [min, max)
|
||||
function getRandomArbitrary(min, max) {
|
||||
return Math.random() * (max - min) + min;
|
||||
}
|
||||
//得到一个两数之间的随机整数 [min↑, max↓)
|
||||
function getRandomInt(min, max) {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min)) + min; //不含最大值,含最小值
|
||||
}
|
||||
//得到一个两数之间的随机整数,包括两个数在内 [min↑, max↓)
|
||||
function getRandomIntInclusive(min, max) {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min; //含最大值,含最小值
|
||||
}
|
||||
function degreeToRadians(angle) {
|
||||
return angle / 360 * Math.PI
|
||||
}
|
||||
function radiansToDegree(radians) {
|
||||
return radians / Math.PI * 360
|
||||
}
|
||||
|
||||
}
|
95
TaoQuick/Qml/BasicComponent/Progress/TNormalProgress.qml
Normal file
95
TaoQuick/Qml/BasicComponent/Progress/TNormalProgress.qml
Normal file
@ -0,0 +1,95 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import TaoQuick 1.0
|
||||
import "../../"
|
||||
Item {
|
||||
id: r
|
||||
property int percent: 0
|
||||
implicitWidth: 200
|
||||
implicitHeight: 16
|
||||
|
||||
enum BarType {
|
||||
Text,
|
||||
SucceedOrFailed,
|
||||
NoBar
|
||||
}
|
||||
readonly property color __backColor: "#f5f5f5"
|
||||
readonly property color __blueColor: "#1890ff"
|
||||
readonly property color __succeedColor: "#52c41a"
|
||||
readonly property color __failedColor: "#f5222d"
|
||||
|
||||
property color backgroundColor: __backColor
|
||||
property color frontColor: {
|
||||
switch (barType) {
|
||||
case TNormalProgress.BarType.SucceedOrFailed:
|
||||
return percent === 100 ? __succeedColor : __failedColor
|
||||
default:
|
||||
return __blueColor
|
||||
}
|
||||
}
|
||||
property string text: String("%1%").arg(percent)
|
||||
property int gradientIndex: -1
|
||||
property bool flicker: false
|
||||
property var barType: TNormalProgress.BarType.Text
|
||||
Text {
|
||||
id: t
|
||||
enabled: barType === TNormalProgress.BarType.Text
|
||||
visible: enabled
|
||||
text: r.text
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
}
|
||||
Image {
|
||||
id: image
|
||||
source: percent === 100 ? "qrc:/Core/Image/ProgressBar/ok_circle.png" : "qrc:/Core/Image/ProgressBar/fail_circle.png"
|
||||
height: parent.height
|
||||
width: height
|
||||
enabled: barType === TNormalProgress.BarType.SucceedOrFailed
|
||||
visible: enabled
|
||||
anchors.right: parent.right
|
||||
}
|
||||
|
||||
property var __right: {
|
||||
switch (barType) {
|
||||
case TNormalProgress.BarType.Text:
|
||||
return t.left
|
||||
case TNormalProgress.BarType.SucceedOrFailed:
|
||||
return image.left
|
||||
default:
|
||||
return r.right
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: back
|
||||
anchors.left: parent.left
|
||||
anchors.right: __right
|
||||
anchors.rightMargin: 4
|
||||
height: parent.height
|
||||
radius: height / 2
|
||||
color: backgroundColor
|
||||
Rectangle {
|
||||
id: front
|
||||
width: percent / 100 * parent.width
|
||||
height: parent.height
|
||||
radius: parent.radius
|
||||
color: frontColor
|
||||
gradient: gradientIndex === -1 ? null : gradientIndex
|
||||
Rectangle {
|
||||
id: flick
|
||||
height: parent.height
|
||||
width: 0
|
||||
radius: parent.radius
|
||||
color: Qt.lighter(parent.color, 1.2)
|
||||
enabled: flicker
|
||||
visible: enabled
|
||||
NumberAnimation on width {
|
||||
running: visible
|
||||
from: 0
|
||||
to: front.width
|
||||
duration: 1000
|
||||
loops: Animation.Infinite;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
TaoQuick/Qml/TaoQuickDesigner.pri
Normal file
22
TaoQuick/Qml/TaoQuickDesigner.pri
Normal file
@ -0,0 +1,22 @@
|
||||
taoquick_designer.files = $$PWD/designer/TaoQuick.metainfo
|
||||
taoquick_designer.path = $$[QT_INSTALL_QML]/$${uri}/designer
|
||||
|
||||
toaquick_qmldir.files = $$PWD/qmldir
|
||||
toaquick_qmldir.path = $$[QT_INSTALL_QML]/$${uri}
|
||||
|
||||
taoquick_qml_buttons.files = $$PWD/BasicComponent/Button/*.qml
|
||||
taoquick_qml_buttons.path = $$[QT_INSTALL_QML]/$${uri}/BasicComponent/Button
|
||||
|
||||
taoquick_qml_mouse.files = $$PWD/BasicComponent/Mouse/*.qml
|
||||
taoquick_qml_mouse.path = $$[QT_INSTALL_QML]/$${uri}/BasicComponent/Mouse
|
||||
|
||||
taoquick_qml_others.files = $$PWD/BasicComponent/Others/*.qml
|
||||
taoquick_qml_others.path = $$[QT_INSTALL_QML]/$${uri}/BasicComponent/Others
|
||||
|
||||
taoquick_qml_progress.files = $$PWD/BasicComponent/Progress/*.qml
|
||||
taoquick_qml_progress.path = $$[QT_INSTALL_QML]/$${uri}/BasicComponent/Progress
|
||||
|
||||
taoquick_degisner_images.files = $$PWD/designer/images/*.png
|
||||
taoquick_degisner_images.path = $$[QT_INSTALL_QML]/$${uri}/designer/images
|
||||
|
||||
INSTALLS += taoquick_designer toaquick_qmldir taoquick_qml_buttons taoquick_qml_mouse taoquick_qml_others taoquick_qml_progress taoquick_degisner_images
|
212
TaoQuick/Qml/designer/TaoQuick.metainfo
Normal file
212
TaoQuick/Qml/designer/TaoQuick.metainfo
Normal file
@ -0,0 +1,212 @@
|
||||
MetaInfo {
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Button.TGradientBtn"
|
||||
icon: "images/TGradientBtn.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TGradientBtn"
|
||||
category: "TaoQuick - Buttons"
|
||||
libraryIcon: "images/TGradientBtn.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Button.TImageBtn"
|
||||
icon: "images/TImageBtn.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TImageBtn"
|
||||
category: "TaoQuick - Buttons"
|
||||
libraryIcon: "images/TImageBtn.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Button.TImgTextBtn"
|
||||
icon: "images/TImgTextBtn.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TImgTextBtn"
|
||||
category: "TaoQuick - Buttons"
|
||||
libraryIcon: "images/TImgTextBtn.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Button.TTextBtn"
|
||||
icon: "images/TTextBtn.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TTextBtn"
|
||||
category: "TaoQuick - Buttons"
|
||||
libraryIcon: "images/TTextBtn.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Mouse.TMoveArea"
|
||||
icon: "images/TMoveArea.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TMoveArea"
|
||||
category: "TaoQuick - Mouse"
|
||||
libraryIcon: "images/TMoveArea.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Mouse.TTransArea"
|
||||
icon: "images/TTransArea.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TTransArea"
|
||||
category: "TaoQuick - Mouse"
|
||||
libraryIcon: "images/TTransArea.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Progress.TNormalProgress"
|
||||
icon: "images/TNormalProgress.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TNormalProgress"
|
||||
category: "TaoQuick - Progress"
|
||||
libraryIcon: "images/TNormalProgress.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Progress.TCircleProgress"
|
||||
icon: "images/TCircleProgress.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TCircleProgress"
|
||||
category: "TaoQuick - Progress"
|
||||
libraryIcon: "images/TCircleProgress.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Others.TBusyIndicator"
|
||||
icon: "images/TBusyIndicator.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TBusyIndicator"
|
||||
category: "TaoQuick - Others"
|
||||
libraryIcon: "images/TBusyIndicator.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Others.TDialog"
|
||||
icon: "images/TDialog.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TDialog"
|
||||
category: "TaoQuick - Others"
|
||||
libraryIcon: "images/TDialog.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Others.TDragItem"
|
||||
icon: "images/TDragItem.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TDragItem"
|
||||
category: "TaoQuick - Others"
|
||||
libraryIcon: "images/TDragItem.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Others.TFPS"
|
||||
icon: "images/TFPS.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TFPS"
|
||||
category: "TaoQuick - Others"
|
||||
libraryIcon: "images/TFPS.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Others.TPopup"
|
||||
icon: "images/TPopup.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TPopup"
|
||||
category: "TaoQuick - Others"
|
||||
libraryIcon: "images/TPopup.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Others.TResizeBorder"
|
||||
icon: "images/TResizeBorder.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TResizeBorder"
|
||||
category: "TaoQuick - Others"
|
||||
libraryIcon: "images/TResizeBorder.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
Type {
|
||||
name: "TaoQuick.BasicComponent.Others.TToolTip"
|
||||
icon: "images/TToolTip.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "TToolTip"
|
||||
category: "TaoQuick - Others"
|
||||
libraryIcon: "images/TToolTip.png"
|
||||
version: "1.0"
|
||||
requiredImport: "TaoQuick"
|
||||
Property { name: "width"; type: "int"; value: 120 }
|
||||
Property { name: "height"; type: "int"; value: 80 }
|
||||
}
|
||||
}
|
||||
}
|
3
TaoQuick/Qml/designer/images/TBusyIndicator.png
Normal file
3
TaoQuick/Qml/designer/images/TBusyIndicator.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:60cff8dcb4bfb1f74f4561c3ecbf53be0390256db08454388e0c0b698ca302dd
|
||||
size 745
|
3
TaoQuick/Qml/designer/images/TCircleProgress.png
Normal file
3
TaoQuick/Qml/designer/images/TCircleProgress.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c2450111cf8fad6bcb0e25160096a5ce6a033b7e9b7138384451ce5a227d1175
|
||||
size 884
|
3
TaoQuick/Qml/designer/images/TDialog.png
Normal file
3
TaoQuick/Qml/designer/images/TDialog.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b2f0d35f9e58d1c030dbfdba2b38902296e179081a25f8e7dfd1a05ee861af33
|
||||
size 894
|
3
TaoQuick/Qml/designer/images/TDragItem.png
Normal file
3
TaoQuick/Qml/designer/images/TDragItem.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2b5f57401cdf16b7735806d883d50a9d23bb5db8a1dcffbbb5115aaf58493316
|
||||
size 661
|
3
TaoQuick/Qml/designer/images/TFPS.png
Normal file
3
TaoQuick/Qml/designer/images/TFPS.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:51d300447865d725a1f493a1f2e5234b418c53732dd09e08b96916c01bc7a845
|
||||
size 665
|
3
TaoQuick/Qml/designer/images/TGradientBtn.png
Normal file
3
TaoQuick/Qml/designer/images/TGradientBtn.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:07034444253ac59a8b9be3d4c0592a77b94fc2c812e00d449f5b1c239618652f
|
||||
size 422
|
3
TaoQuick/Qml/designer/images/TImageBtn.png
Normal file
3
TaoQuick/Qml/designer/images/TImageBtn.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:02c1160ab882e3b399c81cc96e20d8d6b69366fbecf30b4a6819db9d23cb5ee6
|
||||
size 380
|
3
TaoQuick/Qml/designer/images/TImgTextBtn.png
Normal file
3
TaoQuick/Qml/designer/images/TImgTextBtn.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0e79798fc51be0511406aa8b28fe80826471f187b9742c43e8ae6be15797dc66
|
||||
size 361
|
3
TaoQuick/Qml/designer/images/TMoveArea.png
Normal file
3
TaoQuick/Qml/designer/images/TMoveArea.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3d2474d19553a3020fa2d5eef16529018295d662f7c95ebfe1a09c964c6d7c7f
|
||||
size 674
|
3
TaoQuick/Qml/designer/images/TNormalProgress.png
Normal file
3
TaoQuick/Qml/designer/images/TNormalProgress.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d71ec4d684c25a422b98e617d587c9b4b965a3f042af1655abc433c37ed115e7
|
||||
size 276
|
3
TaoQuick/Qml/designer/images/TPopup.png
Normal file
3
TaoQuick/Qml/designer/images/TPopup.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:82a623ec15e53b405526835b2756ca15adf395f0da5d4eacf2f77d9609688b26
|
||||
size 405
|
3
TaoQuick/Qml/designer/images/TResizeBorder.png
Normal file
3
TaoQuick/Qml/designer/images/TResizeBorder.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:516873931f13830ab1b40ffb92d99a49c32d8c6d0ac8923f5f8c327f72d2f181
|
||||
size 616
|
3
TaoQuick/Qml/designer/images/TTextBtn.png
Normal file
3
TaoQuick/Qml/designer/images/TTextBtn.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:edc2619659253a67e6bce4826db6a172f5c0aab1c96561c4614a5e4df741ae3a
|
||||
size 599
|
3
TaoQuick/Qml/designer/images/TToolTip.png
Normal file
3
TaoQuick/Qml/designer/images/TToolTip.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7dd26240813c1d82e9d166d55036af3365c653ee8231868d3cff4dbafd62d6ae
|
||||
size 405
|
3
TaoQuick/Qml/designer/images/TTransArea.png
Normal file
3
TaoQuick/Qml/designer/images/TTransArea.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:181daffe92e7733e4fd320acc2690a379c5e5583313dd7d7362557073a367351
|
||||
size 261
|
19
TaoQuick/Qml/qmldir
Normal file
19
TaoQuick/Qml/qmldir
Normal file
@ -0,0 +1,19 @@
|
||||
TGradientBtn 1.0 BasicComponent/Button/TGradientBtn.qml
|
||||
TImageBtn 1.0 BasicComponent/Button/TImageBtn.qml
|
||||
TImgTextBtn 1.0 BasicComponent/Button/TImgTextBtn.qml
|
||||
TTextBtn 1.0 BasicComponent/Button/TTextBtn.qml
|
||||
|
||||
TMoveArea 1.0 BasicComponent/Mouse/TMoveArea.qml
|
||||
TTransArea 1.0 BasicComponent/Mouse/TTransArea.qml
|
||||
|
||||
TNormalProgress 1.0 BasicComponent/Progress/TNormalProgress.qml
|
||||
TCircleProgress 1.0 BasicComponent/Progress/TCircleProgress.qml
|
||||
|
||||
TBusyIndicator 1.0 BasicComponent/Others/TBusyIndicator.qml
|
||||
TDragItem 1.0 BasicComponent/Others/TDragItem.qml
|
||||
TResizeBorder 1.0 BasicComponent/Others/TResizeBorder.qml
|
||||
TToolTip 1.0 BasicComponent/Others/TToolTip.qml
|
||||
TDialog 1.0 BasicComponent/Others/TDialog.qml
|
||||
TPopup 1.0 BasicComponent/Others/TPopup.qml
|
||||
TFPS 1.0 BasicComponent/Others/TFPS.qml
|
||||
TShaderToy 1.0 BasicComponent/Others/TShaderToy.qml
|
20
TaoQuick/Src/taoquick_plugin.cpp
Normal file
20
TaoQuick/Src/taoquick_plugin.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "taoquick_plugin.h"
|
||||
#include <QDebug>
|
||||
|
||||
void TaoQuickPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_UNUSED(uri);
|
||||
Q_INIT_RESOURCE(Qml);
|
||||
qInfo() << "\033[35m" << "Your application is using TaoQuick ";
|
||||
qInfo() << " Version:" << TaoVer;
|
||||
qInfo() << " Revision:" << TaoREVISION;
|
||||
qInfo() << " Author: Jared Tao";
|
||||
qInfo() << " You can find more info about TaoQuick in website:"
|
||||
<< "\033[0m"
|
||||
<< "\033[31m"
|
||||
<< "https://github.com/jaredtao";
|
||||
|
||||
qInfo() << "\033[0m\033[32m" << "Good luck to you." << "\033[0m";
|
||||
}
|
||||
|
||||
|
12
TaoQuick/Src/taoquick_plugin.h
Normal file
12
TaoQuick/Src/taoquick_plugin.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
class TaoQuickPlugin : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri) override;
|
||||
};
|
66
TaoQuick/TaoQuick.pro
Normal file
66
TaoQuick/TaoQuick.pro
Normal file
@ -0,0 +1,66 @@
|
||||
TEMPLATE = lib
|
||||
|
||||
TARGET = $$qtLibraryTarget(TaoQuick)
|
||||
|
||||
QT += qml quick
|
||||
CONFIG += plugin c++11 qtquickcompiler
|
||||
uri = TaoQuick
|
||||
|
||||
BundlePath=
|
||||
macos{
|
||||
CONFIG(debug, debug|release){
|
||||
CONFIG -=app_bundle
|
||||
} else {
|
||||
BundlePath=TaoQuickDemo.app/Contents/MacOS/
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release){
|
||||
DESTDIR = $$absolute_path($${_PRO_FILE_PWD_}/../bin/debug/$${BundlePath}$${uri})
|
||||
} else {
|
||||
DESTDIR = $$absolute_path($${_PRO_FILE_PWD_}/../bin/release/$${BundlePath}$${uri})
|
||||
}
|
||||
|
||||
include(../Common/TaoVersion.pri)
|
||||
include(Qml/TaoQuickDesigner.pri)
|
||||
HEADERS += \
|
||||
Src/taoquick_plugin.h
|
||||
|
||||
SOURCES += \
|
||||
Src/taoquick_plugin.cpp
|
||||
|
||||
RESOURCES += \
|
||||
Image.qrc \
|
||||
Qml.qrc
|
||||
|
||||
|
||||
|
||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||
QML2_IMPORT_PATH += $$_PRO_FILE_PWD_/Qml
|
||||
|
||||
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
||||
QML_DESIGNER_IMPORT_PATH += $$_PRO_FILE_PWD_/Qml
|
||||
|
||||
!equals(_PRO_FILE_PWD_, $$DESTDIR) {
|
||||
copy_qmldir.target = $$DESTDIR/qmldir
|
||||
copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
|
||||
win32 {
|
||||
copy_qmldir.target ~= s,/,\\\\,g
|
||||
copy_qmldir.depends ~= s,/,\\\\,g
|
||||
}
|
||||
copy_qmldir.commands = $${QMAKE_COPY_FILE} $${copy_qmldir.depends} $${copy_qmldir.target}
|
||||
QMAKE_EXTRA_TARGETS += copy_qmldir
|
||||
PRE_TARGETDEPS += $$copy_qmldir.target
|
||||
}
|
||||
|
||||
DISTFILES = qmldir
|
||||
qmldir.files = qmldir
|
||||
|
||||
installPath = $$[QT_INSTALL_QML]/$${uri}
|
||||
win32 {
|
||||
installPath ~= s,/,\\,g
|
||||
}
|
||||
qmldir.path = $$installPath
|
||||
target.path = $$installPath
|
||||
INSTALLS += target qmldir
|
||||
|
26
TaoQuick/qmldir
Normal file
26
TaoQuick/qmldir
Normal file
@ -0,0 +1,26 @@
|
||||
module TaoQuick
|
||||
plugin TaoQuick
|
||||
|
||||
depends QtQuick 2.12
|
||||
depends QtQuick.Controls 2.12
|
||||
|
||||
TGradientBtn 1.0 BasicComponent/Button/TGradientBtn.qml
|
||||
TImageBtn 1.0 BasicComponent/Button/TImageBtn.qml
|
||||
TImgTextBtn 1.0 BasicComponent/Button/TImgTextBtn.qml
|
||||
TTextBtn 1.0 BasicComponent/Button/TTextBtn.qml
|
||||
|
||||
TMoveArea 1.0 BasicComponent/Mouse/TMoveArea.qml
|
||||
TTransArea 1.0 BasicComponent/Mouse/TTransArea.qml
|
||||
|
||||
TNormalProgress 1.0 BasicComponent/Progress/TNormalProgress.qml
|
||||
TCircleProgress 1.0 BasicComponent/Progress/TCircleProgress.qml
|
||||
|
||||
TBusyIndicator 1.0 BasicComponent/Others/TBusyIndicator.qml
|
||||
TDragItem 1.0 BasicComponent/Others/TDragItem.qml
|
||||
TResizeBorder 1.0 BasicComponent/Others/TResizeBorder.qml
|
||||
TToolTip 1.0 BasicComponent/Others/TToolTip.qml
|
||||
TDialog 1.0 BasicComponent/Others/TDialog.qml
|
||||
TPopup 1.0 BasicComponent/Others/TPopup.qml
|
||||
TFPS 1.0 BasicComponent/Others/TFPS.qml
|
||||
|
||||
designersupported
|
51
TaoQuickDemo/App.rc
Normal file
51
TaoQuickDemo/App.rc
Normal file
@ -0,0 +1,51 @@
|
||||
#include "Ver.h"
|
||||
#if defined(UNDER_CE)
|
||||
#include <winbase.h>
|
||||
#else
|
||||
#include <winver.h>
|
||||
#endif
|
||||
|
||||
IDI_ICON1 ICON DISCARDABLE "milk.ico"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
|
||||
FILEVERSION RELEASE_VER_MAIN,RELEASE_VER_MAIN2,RELEASE_VER_SUB
|
||||
PRODUCTVERSION RELEASE_VER_MAIN,RELEASE_VER_MAIN2,RELEASE_VER_SUB
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
|
||||
BLOCK "080404b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", VER_COMPANYNAME_STR
|
||||
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
|
||||
VALUE "FileVersion", RELEASE_VER_STR
|
||||
VALUE "InternalName", VER_INTERNALNAME_STR
|
||||
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
|
||||
VALUE "LegalTrademarks", VER_LEGALTRADEMARKS_STR
|
||||
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
|
||||
VALUE "ProductName", VER_PRODUCTNAME_STR
|
||||
VALUE "ProductVersion", RELEASE_VER_STR
|
||||
END
|
||||
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
|
||||
VALUE "Translation", 0x804, 1200
|
||||
END
|
||||
|
||||
END
|
25
TaoQuickDemo/Image.qrc
Normal file
25
TaoQuickDemo/Image.qrc
Normal file
@ -0,0 +1,25 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>Image/logo/milk.png</file>
|
||||
<file>Image/logo/milk.ico</file>
|
||||
<file>Image/Window/close_gray.png</file>
|
||||
<file>Image/Window/close_white.png</file>
|
||||
<file>Image/Window/max_gray.png</file>
|
||||
<file>Image/Window/max_white.png</file>
|
||||
<file>Image/Window/minimal_gray.png</file>
|
||||
<file>Image/Window/minimal_white.png</file>
|
||||
<file>Image/Window/normal_gray.png</file>
|
||||
<file>Image/Window/normal_white.png</file>
|
||||
<file>Image/Window/lang_gray.png</file>
|
||||
<file>Image/Window/lang_white.png</file>
|
||||
<file>Image/Window/skin_gray.png</file>
|
||||
<file>Image/Window/skin_white.png</file>
|
||||
<file>Image/logo/splash.gif</file>
|
||||
<file>Image/Button/cry-fill.png</file>
|
||||
<file>Image/Button/smile-fill.png</file>
|
||||
<file>Image/Button/smile-fill-hover.png</file>
|
||||
<file>Image/Window/about_gray.png</file>
|
||||
<file>Image/Window/about_white.png</file>
|
||||
<file>Image/Window/flower.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
3
TaoQuickDemo/Image/Button/cry-fill.png
Normal file
3
TaoQuickDemo/Image/Button/cry-fill.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5804cdf1f38d078bbb4346a947fad550437bd8897c38a5c46aa35eaa211fd997
|
||||
size 834
|
3
TaoQuickDemo/Image/Button/smile-fill-hover.png
Normal file
3
TaoQuickDemo/Image/Button/smile-fill-hover.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:351f2eb7253fba36b84a61196769968f18f64312bed74ae17746ead52fc11b3c
|
||||
size 819
|
3
TaoQuickDemo/Image/Button/smile-fill.png
Normal file
3
TaoQuickDemo/Image/Button/smile-fill.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f53f44d45da9dab5d1007ca94d86203ca9d17c96d7f22718783bab4b92174757
|
||||
size 815
|
3
TaoQuickDemo/Image/Window/about_gray.png
Normal file
3
TaoQuickDemo/Image/Window/about_gray.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:124e27c6c2bdce7388c6b40e5fe5dc9609c7518c927c0d418cabc81be13c4ec4
|
||||
size 833
|
3
TaoQuickDemo/Image/Window/about_white.png
Normal file
3
TaoQuickDemo/Image/Window/about_white.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:53f31ea8a005525171e4c759ed3df4120114b0b9c1730d4d0a0a5a9c51b62ab0
|
||||
size 870
|
3
TaoQuickDemo/Image/Window/close_gray.png
Normal file
3
TaoQuickDemo/Image/Window/close_gray.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:96fb904070f080617c1e06a6d4a44b8691632ebec63d1534c08be785705e9efe
|
||||
size 447
|
3
TaoQuickDemo/Image/Window/close_white.png
Normal file
3
TaoQuickDemo/Image/Window/close_white.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c6d92215b215fadd28597221183c8955beb59e801425e077cc13a673504d11b0
|
||||
size 410
|
3
TaoQuickDemo/Image/Window/flower.jpg
Normal file
3
TaoQuickDemo/Image/Window/flower.jpg
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0bccac3672022d026404e1dce7178687cfe80b4402d4604ca74743a9b2f88aec
|
||||
size 2025169
|
3
TaoQuickDemo/Image/Window/lang_gray.png
Normal file
3
TaoQuickDemo/Image/Window/lang_gray.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4399b65b9d9f88b60d393e59dc9258bb72dbbe618cf9210be4210abba16510fd
|
||||
size 1098
|
3
TaoQuickDemo/Image/Window/lang_white.png
Normal file
3
TaoQuickDemo/Image/Window/lang_white.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fb8acc7e061c7b14157e167f71fd69016de5f179975fe71f209d29d9bcd79450
|
||||
size 972
|
3
TaoQuickDemo/Image/Window/max_gray.png
Normal file
3
TaoQuickDemo/Image/Window/max_gray.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f7165261e8ff623269a9b182c26032cbe19495ff9c179461f5951e35d7657419
|
||||
size 260
|
3
TaoQuickDemo/Image/Window/max_white.png
Normal file
3
TaoQuickDemo/Image/Window/max_white.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:384d956b64a2c6e9a147a36cbb5add3c0df7d4bd72954ba6341ca48263ab8d29
|
||||
size 239
|
3
TaoQuickDemo/Image/Window/minimal_gray.png
Normal file
3
TaoQuickDemo/Image/Window/minimal_gray.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:41d2365dd75e6d7d6260064af04b3c264e300423447bb24d428a0c2b0ee67e4c
|
||||
size 198
|
3
TaoQuickDemo/Image/Window/minimal_white.png
Normal file
3
TaoQuickDemo/Image/Window/minimal_white.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e62c187b9bb4ffd1ab4d06c011fa5f3377c5e01ec3d5010197fbdc475ce4559c
|
||||
size 166
|
3
TaoQuickDemo/Image/Window/normal_gray.png
Normal file
3
TaoQuickDemo/Image/Window/normal_gray.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a119594a539db2d8d6a7e863ac5027dacf5dbfaeac04992f21e35776803023c0
|
||||
size 290
|
3
TaoQuickDemo/Image/Window/normal_white.png
Normal file
3
TaoQuickDemo/Image/Window/normal_white.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1e0fe83401b7a35bb8efb07f4525b1cf27e6671a2150dfba63210dff5ebd13e8
|
||||
size 274
|
3
TaoQuickDemo/Image/Window/skin_gray.png
Normal file
3
TaoQuickDemo/Image/Window/skin_gray.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9641201c2eeebc7c9d19090c60b25b1bdfe18b2e24e2b1dc342265c843645326
|
||||
size 528
|
3
TaoQuickDemo/Image/Window/skin_white.png
Normal file
3
TaoQuickDemo/Image/Window/skin_white.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c0813ffacae32dc2ebf50a5f163d6eacd0fb53210bd8cb7609d154a9ff21391e
|
||||
size 463
|
BIN
TaoQuickDemo/Image/logo/milk.ico
Normal file
BIN
TaoQuickDemo/Image/logo/milk.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
3
TaoQuickDemo/Image/logo/milk.png
Normal file
3
TaoQuickDemo/Image/logo/milk.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b6889be422f307ae07652efdeb525b55c083ac42217c10a1b78f5b491eb3fb71
|
||||
size 2104
|
3
TaoQuickDemo/Image/logo/splash.gif
Normal file
3
TaoQuickDemo/Image/logo/splash.gif
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:10e51e405fc99d78a3936a651ff2c7f8fe18c5bae055446112342f491eab1d10
|
||||
size 2309029
|
24
TaoQuickDemo/Qml.qrc
Normal file
24
TaoQuickDemo/Qml.qrc
Normal file
@ -0,0 +1,24 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>Qml/main.qml</file>
|
||||
<file>Qml/Page/MenuPage.qml</file>
|
||||
<file>Qml/Page/ContentPage.qml</file>
|
||||
<file>Qml/Page/TitlePage.qml</file>
|
||||
<file>Qml/Contents/BaseComponent/Buttons.qml</file>
|
||||
<file>Qml/Contents/BaseComponent/Progresses.qml</file>
|
||||
<file>Qml/Page/NotifyBox.qml</file>
|
||||
<file>Qml/Splash.qml</file>
|
||||
<file>Qml/MainPage.qml</file>
|
||||
<file>Qml/Contents/BaseComponent/Drags.qml</file>
|
||||
<file>Qml/Page/ContentData.qml</file>
|
||||
<file>Qml/Contents/BaseComponent/Gradiants.qml</file>
|
||||
<file>Qml/Contents/Welcome/Welcome.qml</file>
|
||||
<file>Qml/Page/AboutDialog.qml</file>
|
||||
<file>Qml/Contents/BaseComponent/Dialogs.qml</file>
|
||||
<file>Qml/Contents/ShaderEffect/CloudHole.qml</file>
|
||||
<file>Qml/Contents/ShaderEffect/Planet.qml</file>
|
||||
<file>Qml/Contents/ShaderEffect/Snail.qml</file>
|
||||
<file>Qml/Contents/ShaderEffect/SuperMario.qml</file>
|
||||
<file>Qml/Contents/ShaderEffect/Planet1.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
178
TaoQuickDemo/Qml/Contents/BaseComponent/Buttons.qml
Normal file
178
TaoQuickDemo/Qml/Contents/BaseComponent/Buttons.qml
Normal file
@ -0,0 +1,178 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml/"
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
property color btnColor: "#06b7ed"
|
||||
property color btnBorderColor: "orange"
|
||||
Grid {
|
||||
width: parent.width - 20
|
||||
x: 10
|
||||
y: 10
|
||||
rowSpacing: 20
|
||||
columnSpacing: 10
|
||||
columns: 6
|
||||
TTextBtn {
|
||||
width: 80
|
||||
height: 40
|
||||
text: qsTr("文本按钮")
|
||||
color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
onClicked: {
|
||||
console.log("你按下了文本按钮")
|
||||
}
|
||||
}
|
||||
TTextBtn {
|
||||
width: 120
|
||||
height: 40
|
||||
radius: 20
|
||||
property color btnColor: "#06b7ed"
|
||||
|
||||
color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
text: qsTr("圆角文本按钮")
|
||||
onClicked: {
|
||||
console.log("你按下了圆角文本按钮")
|
||||
}
|
||||
}
|
||||
TTextBtn {
|
||||
width: 120
|
||||
height: 40
|
||||
radius: 20
|
||||
text: qsTr("圆角文本按钮")
|
||||
color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
textColor: "red"
|
||||
onClicked: {
|
||||
console.log("你按下了圆角文本按钮")
|
||||
}
|
||||
}
|
||||
TTextBtn {
|
||||
width: 60
|
||||
height: width
|
||||
radius: width / 2
|
||||
text: qsTr("圆按钮")
|
||||
textColor: "red"
|
||||
|
||||
color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
onClicked: {
|
||||
console.log("你按下了圆角文本按钮")
|
||||
}
|
||||
}
|
||||
TTextBtn {
|
||||
id: gradientBtn
|
||||
width: 120
|
||||
height: 40
|
||||
radius: 5
|
||||
text: qsTr("渐变按钮")
|
||||
textColor: "red"
|
||||
color: btnColor
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0 ; color: Qt.darker(btnColor, 1.2) }
|
||||
GradientStop { position: 0.3 ; color: Qt.darker(btnColor, 1.4) }
|
||||
GradientStop { position: 0.6 ; color: Qt.darker(btnColor, 1.6) }
|
||||
GradientStop { position: 1 ; color: Qt.darker(btnColor, 1.8) }
|
||||
}
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
// color: btnColor
|
||||
//color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
onClicked: {
|
||||
console.log("你按下了圆角文本按钮")
|
||||
}
|
||||
}
|
||||
TTextBtn {
|
||||
id: gradientBtn2
|
||||
width: 120
|
||||
height: 40
|
||||
radius: 5
|
||||
text: qsTr("渐变按钮")
|
||||
textColor: "red"
|
||||
|
||||
gradient: 19
|
||||
color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
onClicked: {
|
||||
console.log("你按下了圆角文本按钮")
|
||||
}
|
||||
}
|
||||
TImageBtn {
|
||||
width: 48
|
||||
height: 48
|
||||
normalUrl: "qrc:/Image/Button/smile-fill.png"
|
||||
hoveredUrl: "qrc:/Image/Button/smile-fill-hover.png"
|
||||
pressedUrl: "qrc:/Image/Button/cry-fill.png"
|
||||
onClicked: {
|
||||
console.log("你按下了图片按钮")
|
||||
}
|
||||
}
|
||||
|
||||
TImgTextBtn {
|
||||
width: 100
|
||||
height: 48
|
||||
normalUrl: "qrc:/Image/Button/smile-fill.png"
|
||||
hoveredUrl: "qrc:/Image/Button/smile-fill-hover.png"
|
||||
pressedUrl: "qrc:/Image/Button/cry-fill.png"
|
||||
text: qsTr("图文按钮")
|
||||
color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
layoutType: layoutImageLeft
|
||||
onClicked: {
|
||||
console.log("你按下了图片按钮")
|
||||
}
|
||||
}
|
||||
TImgTextBtn {
|
||||
width: 100
|
||||
height: 48
|
||||
normalUrl: "qrc:/Image/Button/smile-fill.png"
|
||||
hoveredUrl: "qrc:/Image/Button/smile-fill-hover.png"
|
||||
pressedUrl: "qrc:/Image/Button/cry-fill.png"
|
||||
text: qsTr("图文按钮")
|
||||
color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
layoutType: layoutImageRight
|
||||
onClicked: {
|
||||
console.log("你按下了图片按钮")
|
||||
}
|
||||
}
|
||||
TImgTextBtn {
|
||||
width: 80
|
||||
height: 60
|
||||
normalUrl: "qrc:/Image/Button/smile-fill.png"
|
||||
hoveredUrl: "qrc:/Image/Button/smile-fill-hover.png"
|
||||
pressedUrl: "qrc:/Image/Button/cry-fill.png"
|
||||
text: qsTr("图文按钮")
|
||||
color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
layoutType: layoutImageUp
|
||||
onClicked: {
|
||||
console.log("你按下了图片按钮")
|
||||
}
|
||||
}
|
||||
TImgTextBtn {
|
||||
width: 80
|
||||
height: 60
|
||||
normalUrl: "qrc:/Image/Button/smile-fill.png"
|
||||
hoveredUrl: "qrc:/Image/Button/smile-fill-hover.png"
|
||||
pressedUrl: "qrc:/Image/Button/cry-fill.png"
|
||||
text: qsTr("图文按钮")
|
||||
color: containsPress ? Qt.darker(btnColor, 1.2) : (containsMouse ? Qt.lighter(btnColor, 1.2) : btnColor)
|
||||
border.width: containsMouse ? 2 : 0
|
||||
border.color: btnBorderColor
|
||||
layoutType: layoutImageDown
|
||||
onClicked: {
|
||||
console.log("你按下了图片按钮")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
TaoQuickDemo/Qml/Contents/BaseComponent/Dialogs.qml
Normal file
46
TaoQuickDemo/Qml/Contents/BaseComponent/Dialogs.qml
Normal file
@ -0,0 +1,46 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml/"
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
TDialog {
|
||||
id: globalDialog
|
||||
}
|
||||
Row {
|
||||
spacing: 10
|
||||
Button {
|
||||
text: "create file"
|
||||
onClicked: {
|
||||
globalDialog.createFile("create", ["All files (*.*)"], function(file){
|
||||
console.log("create file", file)
|
||||
})
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: "open Image"
|
||||
onClicked: {
|
||||
globalDialog.openFile("Open one image", ["Image files (*.png *.jpg *.bmp)"], function(file){
|
||||
console.log("Open one image", file)
|
||||
})
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: "open Image"
|
||||
onClicked: {
|
||||
globalDialog.openFiles("Open mulit images", ["Image files (*.png *.jpg *.bmp)"], function(files){
|
||||
console.log("Open mulit images", files)
|
||||
})
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: "open folder"
|
||||
onClicked: {
|
||||
globalDialog.openFolder("Open one folder", function(file){
|
||||
console.log("Open one folder", file)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
38
TaoQuickDemo/Qml/Contents/BaseComponent/Drags.qml
Normal file
38
TaoQuickDemo/Qml/Contents/BaseComponent/Drags.qml
Normal file
@ -0,0 +1,38 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml/"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
x: 100
|
||||
y: 200
|
||||
width: 120
|
||||
height: 80
|
||||
color: "darkred"
|
||||
TMoveArea {
|
||||
control: parent
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
x: 300
|
||||
y: 200
|
||||
width: 120
|
||||
height: 80
|
||||
color: "darkred"
|
||||
TMoveArea {
|
||||
anchors.fill: parent
|
||||
control: parent
|
||||
}
|
||||
TResizeBorder {
|
||||
control: parent
|
||||
anchors.fill: parent
|
||||
|
||||
}
|
||||
}
|
||||
}
|
45
TaoQuickDemo/Qml/Contents/BaseComponent/Gradiants.qml
Normal file
45
TaoQuickDemo/Qml/Contents/BaseComponent/Gradiants.qml
Normal file
@ -0,0 +1,45 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml/"
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
GridView {
|
||||
id: g
|
||||
anchors.fill: parent
|
||||
anchors.margins: 20
|
||||
cellWidth: 160
|
||||
cellHeight: 160
|
||||
model: 180
|
||||
clip: true
|
||||
property var invalidList: [27, 39, 40, 45, 71, 74, 105, 111, 119, 130, 135, 141]
|
||||
delegate: Item{
|
||||
width: 160
|
||||
height: 160
|
||||
Rectangle{
|
||||
width: 150
|
||||
height: 150
|
||||
anchors.centerIn: parent
|
||||
color: "white"
|
||||
radius: 10
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 2
|
||||
text: index + 1
|
||||
}
|
||||
Rectangle {
|
||||
width: 100
|
||||
height: width
|
||||
radius: width / 2
|
||||
gradient: g.invalidList.indexOf(modelData + 1) < 0 ? modelData + 1 : null
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
129
TaoQuickDemo/Qml/Contents/BaseComponent/Progresses.qml
Normal file
129
TaoQuickDemo/Qml/Contents/BaseComponent/Progresses.qml
Normal file
@ -0,0 +1,129 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml/"
|
||||
|
||||
Item {
|
||||
id: r
|
||||
anchors.fill: parent
|
||||
Grid {
|
||||
id: g
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
columns: 2
|
||||
spacing: 10
|
||||
Column {
|
||||
width: g.width / 2 - 10
|
||||
height: g.height /2 - 10
|
||||
spacing: 10
|
||||
TNormalProgress {
|
||||
width: parent.width
|
||||
backgroundColor: gConfig.reserverColor
|
||||
NumberAnimation on percent { from: 0; to: 100; duration: 5000; running: true; loops: Animation.Infinite}
|
||||
}
|
||||
TNormalProgress {
|
||||
width: parent.width
|
||||
backgroundColor: gConfig.reserverColor
|
||||
flicker: true
|
||||
percent: 50
|
||||
}
|
||||
TNormalProgress {
|
||||
width: parent.width
|
||||
backgroundColor: gConfig.reserverColor
|
||||
barType: TNormalProgress.BarType.SucceedOrFailed
|
||||
percent: 70
|
||||
}
|
||||
TNormalProgress {
|
||||
width: parent.width
|
||||
backgroundColor: gConfig.reserverColor
|
||||
barType: TNormalProgress.BarType.SucceedOrFailed
|
||||
percent: 100
|
||||
}
|
||||
TNormalProgress {
|
||||
width: parent.width
|
||||
backgroundColor: gConfig.reserverColor
|
||||
barType: TNormalProgress.BarType.NoBar
|
||||
percent: 50
|
||||
gradientIndex: 12
|
||||
}
|
||||
}
|
||||
Row {
|
||||
width: g.width / 2 - 10
|
||||
height: g.height /2 - 10
|
||||
spacing: 10
|
||||
|
||||
TCircleProgress {
|
||||
width: 120
|
||||
height: 120
|
||||
backgroundColor: gConfig.reserverColor
|
||||
NumberAnimation on percent { from: 0; to: 100; duration: 5000; running: true; loops: Animation.Infinite}
|
||||
}
|
||||
TCircleProgress {
|
||||
width: 120
|
||||
height: 120
|
||||
backgroundColor: gConfig.reserverColor
|
||||
barType: TNormalProgress.BarType.SucceedOrFailed
|
||||
percent: 75
|
||||
}
|
||||
TCircleProgress {
|
||||
width: 120
|
||||
height: 120
|
||||
backgroundColor: gConfig.reserverColor
|
||||
barType: TNormalProgress.BarType.SucceedOrFailed
|
||||
percent: 100
|
||||
}
|
||||
}
|
||||
Row {
|
||||
width: g.width / 2 - 10
|
||||
height: g.height /2 - 10
|
||||
spacing: 10
|
||||
|
||||
TCircleProgress {
|
||||
width: 120
|
||||
height: 120
|
||||
backgroundColor: gConfig.reserverColor
|
||||
text: String("%1天").arg(percent)
|
||||
NumberAnimation on percent { from: 0; to: 100; duration: 5000; running: true; loops: Animation.Infinite}
|
||||
}
|
||||
TCircleProgress {
|
||||
id: ppppp
|
||||
width: 120
|
||||
height: 120
|
||||
backgroundColor: gConfig.reserverColor
|
||||
barType: TNormalProgress.BarType.SucceedOrFailed
|
||||
SequentialAnimation {
|
||||
running: true
|
||||
loops: Animation.Infinite
|
||||
NumberAnimation {
|
||||
target: ppppp
|
||||
property: "percent"
|
||||
from: 0
|
||||
to: 100
|
||||
duration: 3000
|
||||
}
|
||||
PauseAnimation {
|
||||
duration: 500
|
||||
}
|
||||
}
|
||||
}
|
||||
TCircleProgress {
|
||||
width: 120
|
||||
height: 120
|
||||
backgroundColor: gConfig.reserverColor
|
||||
percent: 100
|
||||
}
|
||||
}
|
||||
Column {
|
||||
width: g.width / 2 - 10
|
||||
height: g.height /2 - 10
|
||||
spacing: 10
|
||||
}
|
||||
Column {
|
||||
width: g.width / 2 - 10
|
||||
height: g.height /2 - 10
|
||||
spacing: 10
|
||||
}
|
||||
}
|
||||
|
||||
}
|
156
TaoQuickDemo/Qml/Contents/ShaderEffect/CloudHole.qml
Normal file
156
TaoQuickDemo/Qml/Contents/ShaderEffect/CloudHole.qml
Normal file
@ -0,0 +1,156 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml/"
|
||||
|
||||
TShaderToy {
|
||||
anchors.fill: parent
|
||||
pixelShader:"
|
||||
// Protean clouds by nimitz (twitter: @stormoid)
|
||||
// https://www.shadertoy.com/view/3l23Rh
|
||||
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
|
||||
// Contact the author for other licensing options
|
||||
|
||||
/*
|
||||
Technical details:
|
||||
|
||||
The main volume noise is generated from a deformed periodic grid, which can produce
|
||||
a large range of noise-like patterns at very cheap evalutation cost. Allowing for multiple
|
||||
fetches of volume gradient computation for improved lighting.
|
||||
|
||||
To further accelerate marching, since the volume is smooth, more than half the the density
|
||||
information isn't used to rendering or shading but only as an underlying volume distance to
|
||||
determine dynamic step size, by carefully selecting an equation (polynomial for speed) to
|
||||
step as a function of overall density (not necessarialy rendered) the visual results can be
|
||||
the same as a naive implementation with ~40% increase in rendering performance.
|
||||
|
||||
Since the dynamic marching step size is even less uniform due to steps not being rendered at all
|
||||
the fog is evaluated as the difference of the fog integral at each rendered step.
|
||||
|
||||
*/
|
||||
|
||||
mat2 rot(in float a){float c = cos(a), s = sin(a);return mat2(c,s,-s,c);}
|
||||
const mat3 m3 = mat3(0.33338, 0.56034, -0.71817, -0.87887, 0.32651, -0.15323, 0.15162, 0.69596, 0.61339)*1.93;
|
||||
float mag2(vec2 p){return dot(p,p);}
|
||||
float linstep(in float mn, in float mx, in float x){ return clamp((x - mn)/(mx - mn), 0., 1.); }
|
||||
float prm1 = 0.;
|
||||
vec2 bsMo = vec2(0);
|
||||
|
||||
vec2 disp(float t){ return vec2(sin(t*0.22)*1., cos(t*0.175)*1.)*2.; }
|
||||
|
||||
vec2 map(vec3 p)
|
||||
{
|
||||
vec3 p2 = p;
|
||||
p2.xy -= disp(p.z).xy;
|
||||
p.xy *= rot(sin(p.z+iTime)*(0.1 + prm1*0.05) + iTime*0.09);
|
||||
float cl = mag2(p2.xy);
|
||||
float d = 0.;
|
||||
p *= .61;
|
||||
float z = 1.;
|
||||
float trk = 1.;
|
||||
float dspAmp = 0.1 + prm1*0.2;
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
p += sin(p.zxy*0.75*trk + iTime*trk*.8)*dspAmp;
|
||||
d -= abs(dot(cos(p), sin(p.yzx))*z);
|
||||
z *= 0.57;
|
||||
trk *= 1.4;
|
||||
p = p*m3;
|
||||
}
|
||||
d = abs(d + prm1*3.)+ prm1*.3 - 2.5 + bsMo.y;
|
||||
return vec2(d + cl*.2 + 0.25, cl);
|
||||
}
|
||||
|
||||
vec4 render( in vec3 ro, in vec3 rd, float time )
|
||||
{
|
||||
vec4 rez = vec4(0);
|
||||
const float ldst = 8.;
|
||||
vec3 lpos = vec3(disp(time + ldst)*0.5, time + ldst);
|
||||
float t = 1.5;
|
||||
float fogT = 0.;
|
||||
for(int i=0; i<130; i++)
|
||||
{
|
||||
if(rez.a > 0.99)break;
|
||||
|
||||
vec3 pos = ro + t*rd;
|
||||
vec2 mpv = map(pos);
|
||||
float den = clamp(mpv.x-0.3,0.,1.)*1.12;
|
||||
float dn = clamp((mpv.x + 2.),0.,3.);
|
||||
|
||||
vec4 col = vec4(0);
|
||||
if (mpv.x > 0.6)
|
||||
{
|
||||
|
||||
col = vec4(sin(vec3(5.,0.4,0.2) + mpv.y*0.1 +sin(pos.z*0.4)*0.5 + 1.8)*0.5 + 0.5,0.08);
|
||||
col *= den*den*den;
|
||||
col.rgb *= linstep(4.,-2.5, mpv.x)*2.3;
|
||||
float dif = clamp((den - map(pos+.8).x)/9., 0.001, 1. );
|
||||
dif += clamp((den - map(pos+.35).x)/2.5, 0.001, 1. );
|
||||
col.xyz *= den*(vec3(0.005,.045,.075) + 1.5*vec3(0.033,0.07,0.03)*dif);
|
||||
}
|
||||
|
||||
float fogC = exp(t*0.2 - 2.2);
|
||||
col.rgba += vec4(0.06,0.11,0.11, 0.1)*clamp(fogC-fogT, 0., 1.);
|
||||
fogT = fogC;
|
||||
rez = rez + col*(1. - rez.a);
|
||||
t += clamp(0.5 - dn*dn*.05, 0.09, 0.3);
|
||||
}
|
||||
return clamp(rez, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float getsat(vec3 c)
|
||||
{
|
||||
float mi = min(min(c.x, c.y), c.z);
|
||||
float ma = max(max(c.x, c.y), c.z);
|
||||
return (ma - mi)/(ma+ 1e-7);
|
||||
}
|
||||
|
||||
//from my Will it blend shader (https://www.shadertoy.com/view/lsdGzN)
|
||||
vec3 iLerp(in vec3 a, in vec3 b, in float x)
|
||||
{
|
||||
vec3 ic = mix(a, b, x) + vec3(1e-6,0.,0.);
|
||||
float sd = abs(getsat(ic) - mix(getsat(a), getsat(b), x));
|
||||
vec3 dir = normalize(vec3(2.*ic.x - ic.y - ic.z, 2.*ic.y - ic.x - ic.z, 2.*ic.z - ic.y - ic.x));
|
||||
float lgt = dot(vec3(1.0), ic);
|
||||
float ff = dot(dir, normalize(ic));
|
||||
ic += 1.5*dir*sd*ff*lgt;
|
||||
return clamp(ic,0.,1.);
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
vec2 q = fragCoord.xy/iResolution.xy;
|
||||
vec2 p = (gl_FragCoord.xy - 0.5*iResolution.xy)/iResolution.y;
|
||||
bsMo = (iMouse.xy - 0.5*iResolution.xy)/iResolution.y;
|
||||
|
||||
float time = iTime*3.;
|
||||
vec3 ro = vec3(0,0,time);
|
||||
|
||||
ro += vec3(sin(iTime)*0.5,sin(iTime*1.)*0.,0);
|
||||
|
||||
float dspAmp = .85;
|
||||
ro.xy += disp(ro.z)*dspAmp;
|
||||
float tgtDst = 3.5;
|
||||
|
||||
vec3 target = normalize(ro - vec3(disp(time + tgtDst)*dspAmp, time + tgtDst));
|
||||
ro.x -= bsMo.x*2.;
|
||||
vec3 rightdir = normalize(cross(target, vec3(0,1,0)));
|
||||
vec3 updir = normalize(cross(rightdir, target));
|
||||
rightdir = normalize(cross(updir, target));
|
||||
vec3 rd=normalize((p.x*rightdir + p.y*updir)*1. - target);
|
||||
rd.xy *= rot(-disp(time + 3.5).x*0.2 + bsMo.x);
|
||||
prm1 = smoothstep(-0.4, 0.4,sin(iTime*0.3));
|
||||
vec4 scn = render(ro, rd, time);
|
||||
|
||||
vec3 col = scn.rgb;
|
||||
col = iLerp(col.bgr, col.rgb, clamp(1.-prm1,0.05,1.));
|
||||
|
||||
col = pow(col, vec3(.55,0.65,0.6))*vec3(1.,.97,.9);
|
||||
|
||||
col *= pow( 16.0*q.x*q.y*(1.0-q.x)*(1.0-q.y), 0.12)*0.7+0.3; //Vign
|
||||
|
||||
fragColor = vec4( col, 1.0 );
|
||||
}
|
||||
"
|
||||
}
|
193
TaoQuickDemo/Qml/Contents/ShaderEffect/Planet.qml
Normal file
193
TaoQuickDemo/Qml/Contents/ShaderEffect/Planet.qml
Normal file
@ -0,0 +1,193 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml/"
|
||||
|
||||
TShaderToy {
|
||||
anchors.fill: parent
|
||||
pixelShader:"
|
||||
// srtuss, 2018
|
||||
//
|
||||
// This began as an elaborate soundshader-experiment. I tried to create very clear-sounding
|
||||
// instruments and mix them nicely, with a feel of depth and dark atmosphere to it. I added
|
||||
// visuals based the images this music spawns in my head. Hope you enjoy it. :)
|
||||
//
|
||||
// Here is a recording of how the shader sounds, on the computers i created/tested it on:
|
||||
// http://srtuss.thrill-project.com/art/sanctuary_soundtrack.ogg
|
||||
//
|
||||
// Music production with a soundshader: :)
|
||||
// http://srtuss.thrill-project.com/music/shader.ogg
|
||||
//
|
||||
|
||||
vec2 rotate(vec2 p, float a)
|
||||
{
|
||||
float co = cos(a), si = sin(a);
|
||||
return p * mat2(co, si, -si, co);
|
||||
}
|
||||
|
||||
vec2 scene(vec3 p, bool details)
|
||||
{
|
||||
float v = 1e38;
|
||||
|
||||
float wall = 3. - dot(vec2(abs(p.x), p.y), normalize(vec2(1., .3)));
|
||||
float floorr = p.y;
|
||||
v = min(v, wall);
|
||||
float srs = .8;
|
||||
float strut = max(wall - .5, abs(fract(p.z * srs) - .5) / srs - .1);
|
||||
v = min(v, strut);
|
||||
v = min(v, max(strut, floorr) - .1);
|
||||
|
||||
v = min(v, max(strut - .1, abs(floorr - 2.) - .5));
|
||||
|
||||
float hole = 1.2 - length(p.xz);
|
||||
v = min(v, max(floorr, hole));
|
||||
v = min(v, max(abs(floorr), abs(hole)) - .2);
|
||||
|
||||
vec3 q = p + vec3(0., sin(iTime) * .1 - 1., 0.);
|
||||
float sphere = length(q) - .4;
|
||||
|
||||
v = min(v, sphere);
|
||||
|
||||
return vec2(v, step(sphere, v));
|
||||
}
|
||||
|
||||
vec3 normal(vec3 p)
|
||||
{
|
||||
float c = scene(p, true).x;
|
||||
vec2 h = vec2(.005, 0.);
|
||||
return normalize(vec3(scene(p + h.xyy, true).x - c, scene(p + h.yxy, true).x - c, scene(p + h.yyx, true).x - c));
|
||||
}
|
||||
|
||||
vec4 trip(sampler2D sampler, vec3 nml, vec3 pos)
|
||||
{
|
||||
vec3 b = abs(nml);
|
||||
b = pow(b, vec3(50.));
|
||||
b /= dot(b, vec3(1.));
|
||||
return texture(iChannel0, pos.yz) * b.x + texture(iChannel0, pos.xz) * b.y + texture(iChannel0, pos.xy) * b.z;
|
||||
}
|
||||
|
||||
float softshadow( in vec3 ro, in vec3 rd, float mint, float k )
|
||||
{
|
||||
float res = 1.0;
|
||||
float t = mint;
|
||||
for(int i = 0; i < 32; ++i)
|
||||
{
|
||||
float h = scene(ro + rd * t, false).x;
|
||||
if(h < 0.001)
|
||||
return 0.0;
|
||||
res = min(res, k * h / t);
|
||||
t += h;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
float amb_occ(vec3 p, float h)
|
||||
{
|
||||
float acc = 0.0;
|
||||
acc += scene(p + vec3(-h, -h, -h), false).x;
|
||||
acc += scene(p + vec3(-h, -h, +h), false).x;
|
||||
acc += scene(p + vec3(-h, +h, -h), false).x;
|
||||
acc += scene(p + vec3(-h, +h, +h), false).x;
|
||||
acc += scene(p + vec3(+h, -h, -h), false).x;
|
||||
acc += scene(p + vec3(+h, -h, +h), false).x;
|
||||
acc += scene(p + vec3(+h, +h, -h), false).x;
|
||||
acc += scene(p + vec3(+h ,+h, +h), false).x;
|
||||
return acc / h;
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
vec2 uv = fragCoord / iResolution.xy;
|
||||
uv = uv * 2. - 1.;
|
||||
uv.x *= iResolution.x / iResolution.y;
|
||||
|
||||
vec3 rd = normalize(vec3(uv, 1.66));
|
||||
vec3 ro = vec3(0., 1., -2.);
|
||||
float tilt = sin(iTime * .1 + 1.5) * .2 + .2;
|
||||
ro.yz = rotate(ro.yz, tilt);
|
||||
rd.yz = rotate(rd.yz, tilt);
|
||||
|
||||
ro.xz = rotate(ro.xz, sin(iTime * .1) * .5);
|
||||
rd.xz = rotate(rd.xz, sin(iTime * .1) * .5);
|
||||
|
||||
float d = 0.;
|
||||
for(int i = 0; i < 60; ++i)
|
||||
{
|
||||
d += scene(ro + rd * d, false).x;
|
||||
}
|
||||
|
||||
vec3 hit = ro + rd * d;
|
||||
vec3 nml = normal(hit);
|
||||
|
||||
vec3 lpos1 = vec3(0.5, 2., 4.);
|
||||
|
||||
float mtl = scene(hit, false).y;
|
||||
vec3 diffMap = vec3(0.);
|
||||
if(mtl < .5)
|
||||
{
|
||||
float k = .001;
|
||||
diffMap = trip(iChannel0, nml, hit * 1.111).xyz;
|
||||
vec3 diffMap2 = trip(iChannel0, nml, hit * 1.111 + vec3(.005)).xyz;
|
||||
nml = normalize(nml + (diffMap.x - diffMap2.x) * .7);
|
||||
}
|
||||
else
|
||||
{
|
||||
vec3 mov = hit + vec3(0., sin(iTime) * .1 - 1., 0.);
|
||||
//nml = normalize(nml + sin(hit * 200.) * .03);
|
||||
|
||||
float k = .001;
|
||||
diffMap = trip(iChannel0, nml, mov * 1.111).xyz;
|
||||
vec3 diffMap2 = trip(iChannel0, nml, mov * 1.111 + vec3(.005)).xyz;
|
||||
nml = normalize(nml + (diffMap.x - diffMap2.x) * .7);
|
||||
}
|
||||
|
||||
vec3 col = vec3(0.);// * exp(length(hit.xy - vec2(0., 1.)) * -1.) * exp(d * -.3);
|
||||
|
||||
for(int i = 0; i < 2; ++i)
|
||||
{
|
||||
vec3 light = i == 1 ? lpos1 : vec3(cos(iTime * .4), 2., sin(iTime) + 1.);
|
||||
vec3 vLight = light - hit;
|
||||
vec3 lcol = i == 1 ? vec3(1, 1., .7) : vec3(.3, .7, 1.);
|
||||
float lfade = exp(length(vLight) * -1.3);
|
||||
vec3 diff = max(dot(nml, normalize(vLight)), 0.) * lfade * lcol;
|
||||
vec3 ref = reflect(rd, nml);
|
||||
float spec = pow(max(0., dot(normalize(vLight), ref)), 32.);
|
||||
|
||||
vec3 ccol = vec3(1.);
|
||||
ccol *= pow(diffMap, vec3(2.));
|
||||
|
||||
ccol *= diff;
|
||||
ccol += vec3(.4) * spec * lfade;
|
||||
|
||||
col += ccol;
|
||||
}
|
||||
|
||||
col *= smoothstep(-5., 1., amb_occ(hit, .15));
|
||||
|
||||
//col = nml * .5 + .5;
|
||||
|
||||
col += exp((7. - dot(rd, lpos1 - ro)) * -6.);// * softshadow(ro, normalize(lpos1 - ro), .1, 128.);
|
||||
|
||||
float pt = iTime * .2;
|
||||
for(int i = 0; i < 20; ++i)
|
||||
{
|
||||
float pd = 2.;
|
||||
hit = ro + rd * pd;
|
||||
float h = float(i);
|
||||
if(d > pd)
|
||||
{
|
||||
col += exp(length(hit.xy - vec2(sin(h) * .4 + sin(pt + h) * .1, cos(pt + h) * .1 + fract(pt * .1 + cos(h)))) * -400.) * .05 * (1.1 + sin(h * 10.));
|
||||
}
|
||||
}
|
||||
|
||||
col = sqrt(col);
|
||||
col *= 2.9;
|
||||
|
||||
fragColor = vec4(col,1.0);
|
||||
}
|
||||
"
|
||||
iChannel0: Image {
|
||||
source: "qrc:/Qml/Contents/ShaderEffect/Planet1.png"
|
||||
}
|
||||
}
|
3
TaoQuickDemo/Qml/Contents/ShaderEffect/Planet1.png
Normal file
3
TaoQuickDemo/Qml/Contents/ShaderEffect/Planet1.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:533e3e0ed709a807b835705ba11c00de6368cbf27c0447489163015fb60623cc
|
||||
size 36678
|
817
TaoQuickDemo/Qml/Contents/ShaderEffect/Snail.qml
Normal file
817
TaoQuickDemo/Qml/Contents/ShaderEffect/Snail.qml
Normal file
@ -0,0 +1,817 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml/"
|
||||
|
||||
TShaderToy {
|
||||
anchors.fill: parent
|
||||
pixelShader:"// Created by inigo quilez - 2015
|
||||
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
||||
|
||||
|
||||
// antialiasing - make AA 2, meaning 4x AA, if you have a fast machine
|
||||
#define AA 1
|
||||
|
||||
|
||||
// http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
float sdSphere( in vec3 p, in vec4 s )
|
||||
{
|
||||
return length(p-s.xyz) - s.w;
|
||||
}
|
||||
|
||||
// http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
float sdEllipsoid( in vec3 p, in vec3 c, in vec3 r )
|
||||
{
|
||||
return (length( (p-c)/r ) - 1.0) * min(min(r.x,r.y),r.z);
|
||||
}
|
||||
|
||||
// http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
float sdCircle( in vec2 p, in vec2 c, in float r )
|
||||
{
|
||||
return length(p-c) - r;
|
||||
}
|
||||
|
||||
// http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
float sdTorus( vec3 p, vec2 t )
|
||||
{
|
||||
return length( vec2(length(p.xz)-t.x,p.y) )-t.y;
|
||||
}
|
||||
|
||||
// http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
float sdCapsule( vec3 p, vec3 a, vec3 b, float r )
|
||||
{
|
||||
vec3 pa = p-a, ba = b-a;
|
||||
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
|
||||
return length( pa - ba*h ) - r;
|
||||
}
|
||||
|
||||
// http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
||||
vec2 udSegment( vec3 p, vec3 a, vec3 b )
|
||||
{
|
||||
vec3 pa = p-a, ba = b-a;
|
||||
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
|
||||
return vec2( length( pa - ba*h ), h );
|
||||
}
|
||||
|
||||
// http://research.microsoft.com/en-us/um/people/hoppe/ravg.pdf
|
||||
float det( vec2 a, vec2 b ) { return a.x*b.y-b.x*a.y; }
|
||||
vec3 getClosest( vec2 b0, vec2 b1, vec2 b2 )
|
||||
{
|
||||
float a = det(b0,b2);
|
||||
float b = 2.0*det(b1,b0);
|
||||
float d = 2.0*det(b2,b1);
|
||||
float f = b*d - a*a;
|
||||
vec2 d21 = b2-b1;
|
||||
vec2 d10 = b1-b0;
|
||||
vec2 d20 = b2-b0;
|
||||
vec2 gf = 2.0*(b*d21+d*d10+a*d20); gf = vec2(gf.y,-gf.x);
|
||||
vec2 pp = -f*gf/dot(gf,gf);
|
||||
vec2 d0p = b0-pp;
|
||||
float ap = det(d0p,d20);
|
||||
float bp = 2.0*det(d10,d0p);
|
||||
float t = clamp( (ap+bp)/(2.0*a+b+d), 0.0 ,1.0 );
|
||||
return vec3( mix(mix(b0,b1,t), mix(b1,b2,t),t), t );
|
||||
}
|
||||
|
||||
vec4 sdBezier( vec3 a, vec3 b, vec3 c, vec3 p )
|
||||
{
|
||||
vec3 w = normalize( cross( c-b, a-b ) );
|
||||
vec3 u = normalize( c-b );
|
||||
vec3 v = ( cross( w, u ) );
|
||||
|
||||
vec2 a2 = vec2( dot(a-b,u), dot(a-b,v) );
|
||||
vec2 b2 = vec2( 0.0 );
|
||||
vec2 c2 = vec2( dot(c-b,u), dot(c-b,v) );
|
||||
vec3 p3 = vec3( dot(p-b,u), dot(p-b,v), dot(p-b,w) );
|
||||
|
||||
vec3 cp = getClosest( a2-p3.xy, b2-p3.xy, c2-p3.xy );
|
||||
|
||||
return vec4( sqrt(dot(cp.xy,cp.xy)+p3.z*p3.z), cp.z, length(cp.xy), p3.z );
|
||||
}
|
||||
|
||||
// http://iquilezles.org/www/articles/smin/smin.htm
|
||||
float smin( float a, float b, float k )
|
||||
{
|
||||
float h = clamp( 0.5 + 0.5*(b-a)/k, 0.0, 1.0 );
|
||||
return mix( b, a, h ) - k*h*(1.0-h);
|
||||
}
|
||||
|
||||
// http://iquilezles.org/www/articles/smin/smin.htm
|
||||
float smax( float a, float b, float k )
|
||||
{
|
||||
float h = clamp( 0.5 + 0.5*(b-a)/k, 0.0, 1.0 );
|
||||
return mix( a, b, h ) + k*h*(1.0-h);
|
||||
}
|
||||
|
||||
// http://iquilezles.org/www/articles/smin/smin.htm
|
||||
vec3 smax( vec3 a, vec3 b, float k )
|
||||
{
|
||||
vec3 h = clamp( 0.5 + 0.5*(b-a)/k, 0.0, 1.0 );
|
||||
return mix( a, b, h ) + k*h*(1.0-h);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
float hash1( float n )
|
||||
{
|
||||
return fract(sin(n)*43758.5453123);
|
||||
}
|
||||
|
||||
vec3 hash3( float n )
|
||||
{
|
||||
return fract(sin(n+vec3(0.0,13.1,31.3))*158.5453123);
|
||||
}
|
||||
|
||||
vec3 forwardSF( float i, float n)
|
||||
{
|
||||
const float PI = 3.141592653589793238;
|
||||
const float PHI = 1.618033988749894848;
|
||||
float phi = 2.0*PI*fract(i/PHI);
|
||||
float zi = 1.0 - (2.0*i+1.0)/n;
|
||||
float sinTheta = sqrt( 1.0 - zi*zi);
|
||||
return vec3( cos(phi)*sinTheta, sin(phi)*sinTheta, zi);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#define ZERO (min(iFrame,0))
|
||||
|
||||
const float pi = 3.1415927;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
float mapShell( in vec3 p, out vec4 matInfo )
|
||||
{
|
||||
|
||||
const float sc = 1.0/1.0;
|
||||
p -= vec3(0.05,0.12,-0.09);
|
||||
|
||||
p *= sc;
|
||||
|
||||
vec3 q = mat3(-0.6333234236, -0.7332753384, 0.2474039592,
|
||||
0.7738444477, -0.6034162289, 0.1924931824,
|
||||
0.0081370606, 0.3133626215, 0.9495986813) * p;
|
||||
|
||||
const float b = 0.1759;
|
||||
|
||||
float r = length( q.xy );
|
||||
float t = atan( q.y, q.x );
|
||||
|
||||
// https://swiftcoder.wordpress.com/2010/06/21/logarithmic-spiral-distance-field/
|
||||
float n = (log(r)/b - t)/(2.0*pi);
|
||||
|
||||
const float th = 0.11;
|
||||
float nm = (log(th)/b-t)/(2.0*pi);
|
||||
|
||||
n = min(n,nm);
|
||||
|
||||
float ni = floor( n );
|
||||
|
||||
float r1 = exp( b * (t + 2.0*pi*ni));
|
||||
float r2 = r1 * 3.019863;
|
||||
|
||||
//-------
|
||||
|
||||
float h1 = q.z + 1.5*r1 - 0.5;
|
||||
float d1 = sqrt( (r1-r)*(r1-r) + h1*h1) - r1;
|
||||
float h2 = q.z + 1.5*r2 - 0.5;
|
||||
float d2 = sqrt( (r2-r)*(r2-r) + h2*h2) - r2;
|
||||
|
||||
float d, dx, dy;
|
||||
if( d1<d2 ) { d = d1; dx=r1-r; dy=h1; }
|
||||
else { d = d2; dx=r2-r; dy=h2; }
|
||||
|
||||
|
||||
float di = textureLod( iChannel2, vec2(t+r,0.5), 0. ).x;
|
||||
d += 0.002*di;
|
||||
|
||||
matInfo = vec4(dx,dy,r/0.4,t/3.14159);
|
||||
|
||||
vec3 s = q;
|
||||
q = q - vec3(0.34,-0.1,0.03);
|
||||
q.xy = mat2(0.8,0.6,-0.6,0.8)*q.xy;
|
||||
d = smin( d, sdTorus( q, vec2(0.28,0.05) ), 0.06);
|
||||
d = smax( d, -sdEllipsoid(q,vec3(0.0,0.0,0.0),vec3(0.24,0.36,0.24) ), 0.03 );
|
||||
|
||||
d = smax( d, -sdEllipsoid(s,vec3(0.52,-0.0,0.0),vec3(0.42,0.23,0.5) ), 0.05 );
|
||||
|
||||
return d/sc;
|
||||
}
|
||||
|
||||
vec2 mapSnail( vec3 p, out vec4 matInfo )
|
||||
{
|
||||
vec3 head = vec3(-0.76,0.6,-0.3);
|
||||
|
||||
vec3 q = p - head;
|
||||
|
||||
// body
|
||||
#if 1
|
||||
vec4 b1 = sdBezier( vec3(-0.13,-0.65,0.0), vec3(0.24,0.9+0.1,0.0), head+vec3(0.04,0.01,0.0), p );
|
||||
float d1 = b1.x;
|
||||
d1 -= smoothstep(0.0,0.2,b1.y)*(0.16 - 0.07*smoothstep(0.5,1.0,b1.y));
|
||||
b1 = sdBezier( vec3(-0.085,0.0,0.0), vec3(-0.1,0.9-0.05,0.0), head+vec3(0.06,-0.08,0.0), p );
|
||||
float d2 = b1.x;
|
||||
d2 -= 0.1 - 0.06*b1.y;
|
||||
d1 = smin( d1, d2, 0.03 );
|
||||
matInfo.xyz = b1.yzw;
|
||||
#else
|
||||
vec4 b1 = sdBezier( vec3(-0.13,-0.65,0.0), vec3(0.24,0.9+0.11,0.0), head+vec3(0.05,0.01-0.02,0.0), p );
|
||||
float d1 = b1.x;
|
||||
d1 -= smoothstep(0.0,0.2,b1.y)*(0.16 - 0.75*0.07*smoothstep(0.5,1.0,b1.y));
|
||||
matInfo.xyz = b1.yzw;
|
||||
float d2;
|
||||
#endif
|
||||
d2 = sdSphere( q, vec4(0.0,-0.06,0.0,0.085) );
|
||||
d1 = smin( d1, d2, 0.03 );
|
||||
|
||||
d1 = smin( d1, sdSphere(p,vec4(0.05,0.52,0.0,0.13)), 0.07 );
|
||||
|
||||
q.xz = mat2(0.8,0.6,-0.6,0.8)*q.xz;
|
||||
|
||||
vec3 sq = vec3( q.xy, abs(q.z) );
|
||||
|
||||
// top antenas
|
||||
vec3 af = 0.05*sin(0.5*iTime+vec3(0.0,1.0,3.0) + vec3(2.0,1.0,0.0)*sign(q.z) );
|
||||
vec4 b2 = sdBezier( vec3(0.0), vec3(-0.1,0.2,0.2), vec3(-0.3,0.2,0.3)+af, sq );
|
||||
float d3 = b2.x;
|
||||
d3 -= 0.03 - 0.025*b2.y;
|
||||
d1 = smin( d1, d3, 0.04 );
|
||||
d3 = sdSphere( sq, vec4(-0.3,0.2,0.3,0.016) + vec4(af,0.0) );
|
||||
d1 = smin( d1, d3, 0.01 );
|
||||
|
||||
// bottom antenas
|
||||
vec3 bf = 0.02*sin(0.3*iTime+vec3(4.0,1.0,2.0) + vec3(3.0,0.0,1.0)*sign(q.z) );
|
||||
vec2 b3 = udSegment( sq, vec3(0.06,-0.05,0.0), vec3(-0.04,-0.2,0.18)+bf );
|
||||
d3 = b3.x;
|
||||
d3 -= 0.025 - 0.02*b3.y;
|
||||
d1 = smin( d1, d3, 0.06 );
|
||||
d3 = sdSphere( sq, vec4(-0.04,-0.2,0.18,0.008)+vec4(bf,0.0) );
|
||||
d1 = smin( d1, d3, 0.02 );
|
||||
|
||||
// bottom
|
||||
vec3 pp = p-vec3(-0.17,0.15,0.0);
|
||||
float co = 0.988771078;
|
||||
float si = 0.149438132;
|
||||
pp.xy = mat2(co,-si,si,co)*pp.xy;
|
||||
d1 = smin( d1, sdEllipsoid( pp, vec3(0.0,0.0,0.0), vec3(0.084,0.3,0.15) ), 0.05 );
|
||||
d1 = smax( d1, -sdEllipsoid( pp, vec3(-0.08,-0.0,0.0), vec3(0.06,0.55,0.1) ), 0.02 );
|
||||
|
||||
// disp
|
||||
float dis = textureLod( iChannel1, 5.0*p.xy, 0. ).x;
|
||||
float dx = 0.5 + 0.5*(1.0-smoothstep(0.5,1.0,b1.y));
|
||||
d1 -= 0.005*dis*dx*0.5;
|
||||
|
||||
return vec2(d1,1.0);
|
||||
}
|
||||
|
||||
float mapDrop( in vec3 p )
|
||||
{
|
||||
p -= vec3(-0.26,0.25,-0.02);
|
||||
p.x -= 2.5*p.y*p.y;
|
||||
return sdCapsule( p, vec3(0.0,-0.06,0.0), vec3(0.014,0.06,0.0), 0.037 );
|
||||
}
|
||||
|
||||
float mapLeaf( in vec3 p )
|
||||
{
|
||||
p -= vec3(-1.8,0.6,-0.75);
|
||||
|
||||
p = mat3(0.671212, 0.366685, -0.644218,
|
||||
-0.479426, 0.877583, 0.000000,
|
||||
0.565354, 0.308854, 0.764842)*p;
|
||||
|
||||
p.y += 0.2*exp(-abs(2.0*p.z) );
|
||||
|
||||
|
||||
float ph = 0.25*50.0*p.x - 0.25*75.0*abs(p.z);// + 1.0*sin(5.0*p.x)*sin(5.0*p.z);
|
||||
float rr = sin( ph );
|
||||
rr = rr*rr;
|
||||
rr = rr*rr;
|
||||
p.y += 0.005*rr;
|
||||
|
||||
float r = clamp((p.x+2.0)/4.0,0.0,1.0);
|
||||
r = 0.0001 + r*(1.0-r)*(1.0-r)*6.0;
|
||||
|
||||
rr = sin( ph*2.0 );
|
||||
rr = rr*rr;
|
||||
rr *= 0.5+0.5*sin( p.x*12.0 );
|
||||
|
||||
float ri = 0.035*rr;
|
||||
|
||||
float d = sdEllipsoid( p, vec3(0.0), vec3(2.0,0.25*r,r+ri) );
|
||||
|
||||
float d2 = p.y-0.02;
|
||||
d = smax( d, -d2, 0.02 );
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
vec2 mapOpaque( vec3 p, out vec4 matInfo )
|
||||
{
|
||||
matInfo = vec4(0.0);
|
||||
|
||||
//--------------
|
||||
vec2 res = mapSnail( p, matInfo );
|
||||
|
||||
//---------------
|
||||
vec4 tmpMatInfo;
|
||||
float d4 = mapShell( p, tmpMatInfo );
|
||||
if( d4<res.x ) { res = vec2(d4,2.0); matInfo = tmpMatInfo; }
|
||||
|
||||
//---------------
|
||||
|
||||
// plant
|
||||
vec4 b3 = sdBezier( vec3(-0.15,-1.5,0.0), vec3(-0.1,0.5,0.0), vec3(-0.6,1.5,0.0), p );
|
||||
d4 = b3.x;
|
||||
d4 -= 0.04 - 0.02*b3.y;
|
||||
if( d4<res.x ) { res = vec2(d4,3.0); }
|
||||
|
||||
//----------------------------
|
||||
|
||||
float d5 = mapLeaf( p );
|
||||
if( d5<res.x ) res = vec2(d5,4.0);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// http://iquilezles.org/www/articles/normalsSDF/normalsSDF.htm
|
||||
vec3 calcNormalOpaque( in vec3 pos, in float eps )
|
||||
{
|
||||
vec4 kk;
|
||||
#if 0
|
||||
vec2 e = vec2(1.0,-1.0)*0.5773*eps;
|
||||
return normalize( e.xyy*mapOpaque( pos + e.xyy, kk ).x +
|
||||
e.yyx*mapOpaque( pos + e.yyx, kk ).x +
|
||||
e.yxy*mapOpaque( pos + e.yxy, kk ).x +
|
||||
e.xxx*mapOpaque( pos + e.xxx, kk ).x );
|
||||
#else
|
||||
// inspired by klems - a way to prevent the compiler from inlining map() 4 times
|
||||
vec3 n = vec3(0.0);
|
||||
for( int i=ZERO; i<4; i++ )
|
||||
{
|
||||
vec3 e = 0.5773*(2.0*vec3((((i+3)>>1)&1),((i>>1)&1),(i&1))-1.0);
|
||||
n += e*mapOpaque(pos+eps*e,kk).x;
|
||||
}
|
||||
return normalize(n);
|
||||
#endif
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
||||
float mapLeafWaterDrops( in vec3 p )
|
||||
{
|
||||
p -= vec3(-1.8,0.6,-0.75);
|
||||
vec3 s = p;
|
||||
p = mat3(0.671212, 0.366685, -0.644218,
|
||||
-0.479426, 0.877583, 0.000000,
|
||||
0.565354, 0.308854, 0.764842)*p;
|
||||
|
||||
vec3 q = p;
|
||||
p.y += 0.2*exp(-abs(2.0*p.z) );
|
||||
|
||||
//---------------
|
||||
|
||||
float r = clamp((p.x+2.0)/4.0,0.0,1.0);
|
||||
r = r*(1.0-r)*(1.0-r)*6.0;
|
||||
float d0 = sdEllipsoid( p, vec3(0.0), vec3(2.0,0.25*r,r) );
|
||||
float d1 = sdEllipsoid( q, vec3(0.5,0.0,0.2), 1.0*vec3(0.15,0.13,0.15) );
|
||||
float d2 = sdEllipsoid( q, vec3(0.8,-0.07,-0.15), 0.5*vec3(0.15,0.13,0.15) );
|
||||
float d3 = sdEllipsoid( s, vec3(0.76,-0.8,0.6), 0.5*vec3(0.15,0.2,0.15) );
|
||||
float d4 = sdEllipsoid( q, vec3(-0.5,0.09,-0.2), vec3(0.04,0.03,0.04) );
|
||||
|
||||
d3 = max( d3, p.y-0.01);
|
||||
|
||||
return min( min(d1,d4), min(d2,d3) );
|
||||
}
|
||||
|
||||
vec2 mapTransparent( vec3 p, out vec4 matInfo )
|
||||
{
|
||||
matInfo = vec4(0.0);
|
||||
|
||||
float d5 = mapDrop( p );
|
||||
vec2 res = vec2(d5,4.0);
|
||||
|
||||
float d6 = mapLeafWaterDrops( p );
|
||||
res.x = min( res.x, d6 );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// http://iquilezles.org/www/articles/normalsSDF/normalsSDF.htm
|
||||
vec3 calcNormalTransparent( in vec3 pos, in float eps )
|
||||
{
|
||||
vec4 kk;
|
||||
vec2 e = vec2(1.0,-1.0)*0.5773*eps;
|
||||
return normalize( e.xyy*mapTransparent( pos + e.xyy, kk ).x +
|
||||
e.yyx*mapTransparent( pos + e.yyx, kk ).x +
|
||||
e.yxy*mapTransparent( pos + e.yxy, kk ).x +
|
||||
e.xxx*mapTransparent( pos + e.xxx, kk ).x );
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
||||
float calcAO( in vec3 pos, in vec3 nor )
|
||||
{
|
||||
vec4 kk;
|
||||
float ao = 0.0;
|
||||
for( int i=ZERO; i<32; i++ )
|
||||
{
|
||||
vec3 ap = forwardSF( float(i), 32.0 );
|
||||
float h = hash1(float(i));
|
||||
ap *= sign( dot(ap,nor) ) * h*0.1;
|
||||
ao += clamp( mapOpaque( pos + nor*0.01 + ap, kk ).x*3.0, 0.0, 1.0 );
|
||||
}
|
||||
ao /= 32.0;
|
||||
|
||||
return clamp( ao*6.0, 0.0, 1.0 );
|
||||
}
|
||||
|
||||
float calcSSS( in vec3 pos, in vec3 nor )
|
||||
{
|
||||
vec4 kk;
|
||||
float occ = 0.0;
|
||||
for( int i=ZERO; i<8; i++ )
|
||||
{
|
||||
float h = 0.002 + 0.11*float(i)/7.0;
|
||||
vec3 dir = normalize( sin( float(i)*13.0 + vec3(0.0,2.1,4.2) ) );
|
||||
dir *= sign(dot(dir,nor));
|
||||
occ += (h-mapOpaque(pos-h*dir, kk).x);
|
||||
}
|
||||
occ = clamp( 1.0 - 11.0*occ/8.0, 0.0, 1.0 );
|
||||
return occ*occ;
|
||||
}
|
||||
|
||||
// http://iquilezles.org/www/articles/rmshadows/rmshadows.htm
|
||||
float calcSoftShadow( in vec3 ro, in vec3 rd, float k )
|
||||
{
|
||||
vec4 kk;
|
||||
float res = 1.0;
|
||||
float t = 0.01;
|
||||
for( int i=ZERO; i<32; i++ )
|
||||
{
|
||||
float h = mapOpaque(ro + rd*t, kk ).x;
|
||||
res = min( res, smoothstep(0.0,1.0,k*h/t) );
|
||||
t += clamp( h, 0.04, 0.1 );
|
||||
if( res<0.01 ) break;
|
||||
}
|
||||
return clamp(res,0.0,1.0);
|
||||
}
|
||||
|
||||
const vec3 sunDir = normalize( vec3(0.2,0.1,0.02) );
|
||||
|
||||
vec3 shadeOpaque( in vec3 ro, in vec3 rd, in float t, in float m, in vec4 matInfo )
|
||||
{
|
||||
float eps = 0.002;
|
||||
|
||||
vec3 pos = ro + t*rd;
|
||||
vec3 nor = calcNormalOpaque( pos, eps );
|
||||
|
||||
vec3 mateD = vec3(0.0);
|
||||
vec3 mateS = vec3(0.0);
|
||||
vec2 mateK = vec2(0.0);
|
||||
vec3 mateE = vec3(0.0);
|
||||
|
||||
float focc = 1.0;
|
||||
float fsha = 1.0;
|
||||
|
||||
if( m<1.5 ) // snail body
|
||||
{
|
||||
float dis = texture( iChannel1, 5.0*pos.xy ).x;
|
||||
|
||||
float be = sdEllipsoid( pos, vec3(-0.3,-0.5,-0.1), vec3(0.2,1.0,0.5) );
|
||||
be = 1.0-smoothstep( -0.01, 0.01, be );
|
||||
|
||||
float ff = abs(matInfo.x-0.20);
|
||||
|
||||
mateS = 6.0*mix( 0.7*vec3(2.0,1.2,0.2), vec3(2.5,1.8,0.9), ff );
|
||||
mateS += 2.0*dis;
|
||||
mateS *= 1.5;
|
||||
mateS *= 1.0 + 0.5*ff*ff;
|
||||
mateS *= 1.0-0.5*be;
|
||||
|
||||
mateD = vec3(1.0,0.8,0.4);
|
||||
mateD *= dis;
|
||||
mateD *= 0.015;
|
||||
mateD += vec3(0.8,0.4,0.3)*0.15*be;
|
||||
|
||||
mateK = vec2( 60.0, 0.7 + 2.0*dis );
|
||||
|
||||
float f = clamp( dot( -rd, nor ), 0.0, 1.0 );
|
||||
f = 1.0-pow( f, 8.0 );
|
||||
f = 1.0 - (1.0-f)*(1.0-texture( iChannel2, 0.3*pos.xy ).x);
|
||||
mateS *= vec3(0.5,0.1,0.0) + f*vec3(0.5,0.9,1.0);
|
||||
|
||||
float b = 1.0-smoothstep( 0.25,0.55,abs(pos.y));
|
||||
focc = 0.2 + 0.8*smoothstep( 0.0, 0.15, sdSphere(pos,vec4(0.05,0.52,0.0,0.13)) );
|
||||
}
|
||||
else if( m<2.5 ) // shell
|
||||
{
|
||||
mateK = vec2(0.0);
|
||||
|
||||
float tip = 1.0-smoothstep(0.05,0.4, length(pos-vec3(0.17,0.2,0.35)) );
|
||||
mateD = mix( 0.7*vec3(0.2,0.21,0.22), 0.2*vec3(0.15,0.1,0.0), tip );
|
||||
|
||||
vec2 uv = vec2( .5*atan(matInfo.x,matInfo.y)/3.1416, 1.5*matInfo.w );
|
||||
|
||||
vec3 ral = texture( iChannel1, vec2(2.0*matInfo.w+matInfo.z*0.5,0.5) ).xxx;
|
||||
mateD *= 0.25 + 0.75*ral;
|
||||
|
||||
float pa = smoothstep(-0.2,0.2, 0.3+sin(2.0+40.0*uv.x + 3.0*sin(11.0*uv.x)) );
|
||||
float bar = mix(pa,1.0,smoothstep(0.7,1.0,tip));
|
||||
bar *= (matInfo.z<0.6) ? 1.0 : smoothstep( 0.17, 0.21, abs(matInfo.w) );
|
||||
mateD *= vec3(0.06,0.03,0.0)+vec3(0.94,0.97,1.0)*bar;
|
||||
|
||||
mateK = vec2( 64.0, 0.2 );
|
||||
mateS = 1.5*vec3(1.0,0.65,0.6) * (1.0-tip);//*0.5;
|
||||
}
|
||||
else if( m<3.5 ) // plant
|
||||
{
|
||||
mateD = vec3(0.05,0.1,0.0)*0.2;
|
||||
mateS = vec3(0.1,0.2,0.02)*25.0;
|
||||
mateK = vec2(5.0,1.0);
|
||||
|
||||
float fre = clamp(1.0+dot(nor,rd), 0.0, 1.0 );
|
||||
mateD += 0.2*fre*vec3(1.0,0.5,0.1);
|
||||
|
||||
vec3 te = texture( iChannel2, pos.xy*0.2 ).xyz;
|
||||
mateS *= 0.5 + 1.5*te;
|
||||
mateE = 0.5*vec3(0.1,0.1,0.03)*(0.2+0.8*te.x);
|
||||
}
|
||||
else //if( m<4.5 ) // leave
|
||||
{
|
||||
vec3 p = pos - vec3(-1.8,0.6,-0.75);
|
||||
vec3 s = p;
|
||||
p = mat3(0.671212, 0.366685, -0.644218,
|
||||
-0.479426, 0.877583, 0.000000,
|
||||
0.565354, 0.308854, 0.764842)*p;
|
||||
|
||||
vec3 q = p;
|
||||
p.y += 0.2*exp(-abs(2.0*p.z) );
|
||||
|
||||
float v = smoothstep( 0.01, 0.02, abs(p.z));
|
||||
|
||||
float rr = sin( 4.0*0.25*50.0*p.x - 4.0*0.25*75.0*abs(p.z) );
|
||||
|
||||
vec3 te = texture( iChannel2, p.xz*0.35 ).xyz;
|
||||
|
||||
float r = clamp((p.x+2.0)/4.0,0.0,1.0);
|
||||
r = r*(1.0-r)*(1.0-r)*6.0;
|
||||
float ff = length(p.xz/vec2(2.0,r));
|
||||
|
||||
mateD = mix( vec3(0.07,0.1,0.0), vec3(0.05,0.2,0.01)*0.25, v );
|
||||
mateD = mix( mateD, vec3(0.16,0.2,0.01)*0.25, ff );
|
||||
mateD *= 1.0 + 0.25*te;
|
||||
mateD *= 0.8;
|
||||
|
||||
mateS = vec3(0.15,0.2,0.02)*0.8;
|
||||
mateS *= 1.0 + 0.2*rr;
|
||||
mateS *= 0.8;
|
||||
|
||||
mateK = vec2(64.0,0.25);
|
||||
|
||||
//---------------------
|
||||
|
||||
nor.xz += v*0.15*(-1.0+2.0*texture( iChannel3, 1.0*p.xz ).xy);
|
||||
nor = normalize( nor );
|
||||
|
||||
float d1 = sdEllipsoid( q, vec3( 0.5-0.07, 0.0, 0.20), 1.0*vec3(1.4*0.15,0.13,0.15) );
|
||||
float d2 = sdEllipsoid( q, vec3( 0.8-0.05,-0.07,-0.15), 0.5*vec3(1.3*0.15,0.13,0.15) );
|
||||
float d4 = sdEllipsoid( q, vec3(-0.5-0.07, 0.09,-0.20), 1.0*vec3(1.4*0.04,0.03,0.04) );
|
||||
float dd = min(d1,min(d2,d4));
|
||||
fsha = 0.05 + 0.95*smoothstep(0.0,0.05,dd);
|
||||
|
||||
d1 = abs( sdCircle( q.xz, vec2( 0.5, 0.20), 1.0*0.15 ));
|
||||
d2 = abs( sdCircle( q.xz, vec2( 0.8,-0.15), 0.5*0.15 ));
|
||||
d4 = abs( sdCircle( q.xz, vec2(-0.5,-0.20), 1.0*0.04 ));
|
||||
dd = min(d1,min(d2,d4));
|
||||
focc *= 0.55 + 0.45*smoothstep(0.0,0.08,dd);
|
||||
|
||||
d1 = distance( q.xz, vec2( 0.5-0.07, 0.20) );
|
||||
d2 = distance( q.xz, vec2( 0.8-0.03,-0.15) );
|
||||
fsha += (1.0-smoothstep(0.0,0.10,d1))*1.5;
|
||||
fsha += (1.0-smoothstep(0.0,0.05,d2))*1.5;
|
||||
}
|
||||
|
||||
|
||||
vec3 hal = normalize( sunDir-rd );
|
||||
float fre = clamp(1.0+dot(nor,rd), 0.0, 1.0 );
|
||||
float occ = calcAO( pos, nor )*focc;
|
||||
float sss = calcSSS( pos, nor );
|
||||
sss = sss*occ + fre*occ + (0.5+0.5*fre)*pow(abs(matInfo.x-0.2),1.0)*occ;
|
||||
|
||||
float dif1 = clamp( dot(nor,sunDir), 0.0, 1.0 );
|
||||
float sha = calcSoftShadow( pos, sunDir, 20.0 );
|
||||
dif1 *= sha*fsha;
|
||||
float spe1 = clamp( dot(nor,hal), 0.0, 1.0 );
|
||||
|
||||
float bou = clamp( 0.3-0.7*nor.y, 0.0, 1.0 );
|
||||
|
||||
// illumination
|
||||
|
||||
vec3 col = vec3(0.0);
|
||||
col += 7.0*vec3(1.7,1.2,0.6)*dif1*2.0; // sun
|
||||
col += 4.0*vec3(0.2,1.2,1.6)*occ*(0.5+0.5*nor.y); // sky
|
||||
col += 1.8*vec3(0.1,2.0,0.1)*bou*occ; // bounce
|
||||
|
||||
col *= mateD;
|
||||
|
||||
col += 0.4*sss*(vec3(0.15,0.1,0.05)+vec3(0.85,0.9,0.95)*dif1)*(0.05+0.95*occ)*mateS; // sss
|
||||
col = pow(col,vec3(0.6,0.8,1.0));
|
||||
|
||||
col += vec3(1.0,1.0,1.0)*0.2*pow( spe1, 1.0+mateK.x )*dif1*(0.04+0.96*pow(fre,4.0))*mateK.x*mateK.y; // sun lobe1
|
||||
col += vec3(1.0,1.0,1.0)*0.1*pow( spe1, 1.0+mateK.x/3.0 )*dif1*(0.1+0.9*pow(fre,4.0))*mateK.x*mateK.y; // sun lobe2
|
||||
col += 0.1*vec3(1.0,max(1.5-0.7*col.y,0.0),2.0)*occ*occ*smoothstep( 0.0, 0.3, reflect( rd, nor ).y )*mateK.x*mateK.y*(0.04+0.96*pow(fre,5.0)); // sky
|
||||
|
||||
col += mateE;
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
vec3 shadeTransparent( in vec3 ro, in vec3 rd, in float t, in float m, in vec4 matInfo, in vec3 col, in float depth )
|
||||
{
|
||||
vec3 oriCol = col;
|
||||
|
||||
float dz = depth - t;
|
||||
float ao = clamp(dz*50.0,0.0,1.0);
|
||||
vec3 pos = ro + t*rd;
|
||||
vec3 nor = calcNormalTransparent( pos, 0.002 );
|
||||
float fre = clamp( 1.0 + dot( rd, nor ), 0.0, 1.0 );
|
||||
vec3 hal = normalize( sunDir-rd );
|
||||
vec3 ref = reflect( -rd, nor );
|
||||
float spe1 = clamp( dot(nor,hal), 0.0, 1.0 );
|
||||
float spe2 = clamp( dot(ref,sunDir), 0.0, 1.0 );
|
||||
|
||||
|
||||
float ds = 1.6 - col.y;
|
||||
|
||||
col *= mix( vec3(0.0,0.0,0.0), vec3(0.4,0.6,0.4), ao );
|
||||
|
||||
col += ds*1.5*vec3(1.0,0.9,0.8)*pow( spe1, 80.0 );
|
||||
col += ds*0.2*vec3(0.9,1.0,1.0)*smoothstep(0.4,0.8,fre);
|
||||
col += ds*0.9*vec3(0.6,0.7,1.0)*smoothstep( -0.5, 0.5, -reflect( rd, nor ).y )*smoothstep(0.2,0.4,fre);
|
||||
col += ds*0.5*vec3(1.0,0.9,0.8)*pow( spe2, 80.0 );
|
||||
col += ds*0.5*vec3(1.0,0.9,0.8)*pow( spe2, 16.0 );
|
||||
col += vec3(0.8,1.0,0.8)*0.5*smoothstep(0.3,0.6,texture( iChannel1, 0.8*nor.xy ).x)*(0.1+0.9*fre*fre);
|
||||
|
||||
// hide aliasing a bit
|
||||
return mix( col, oriCol, smoothstep(0.6,1.0,fre) );
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
|
||||
vec2 intersectOpaque( in vec3 ro, in vec3 rd, const float mindist, const float maxdist, out vec4 matInfo )
|
||||
{
|
||||
vec2 res = vec2(-1.0);
|
||||
|
||||
float t = mindist;
|
||||
for( int i=ZERO; i<64; i++ )
|
||||
{
|
||||
vec3 p = ro + t*rd;
|
||||
vec2 h = mapOpaque( p, matInfo );
|
||||
res = vec2(t,h.y);
|
||||
|
||||
if( h.x<(0.001*t) || t>maxdist ) break;
|
||||
|
||||
t += h.x*0.9;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
vec2 intersectTransparent( in vec3 ro, in vec3 rd, const float mindist, const float maxdist, out vec4 matInfo )
|
||||
{
|
||||
vec2 res = vec2(-1.0);
|
||||
|
||||
float t = mindist;
|
||||
for( int i=ZERO; i<64; i++ )
|
||||
{
|
||||
vec3 p = ro + t*rd;
|
||||
vec2 h = mapTransparent( p, matInfo );
|
||||
res = vec2(t,h.y);
|
||||
|
||||
if( h.x<(0.001*t) || t>maxdist ) break;
|
||||
|
||||
t += h.x;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
vec3 background( in vec3 d )
|
||||
{
|
||||
// cheap cubemap
|
||||
vec3 n = abs(d);
|
||||
vec2 uv = (n.x>n.y && n.x>n.z) ? d.yz/d.x:
|
||||
(n.y>n.x && n.y>n.z) ? d.zx/d.y:
|
||||
d.xy/d.z;
|
||||
|
||||
// fancy blur
|
||||
vec3 col = vec3( 0.0 );
|
||||
for( int i=ZERO; i<200; i++ )
|
||||
{
|
||||
float h = float(i)/200.0;
|
||||
float an = 31.0*6.2831*h;
|
||||
vec2 of = vec2( cos(an), sin(an) ) * h;
|
||||
|
||||
vec3 tmp = texture( iChannel2, uv*0.25 + 0.0075*of, 4.0 ).yxz;
|
||||
col = smax( col, tmp, 0.5 );
|
||||
}
|
||||
|
||||
return pow(col,vec3(3.5,3.0,6.0))*0.2;
|
||||
}
|
||||
|
||||
|
||||
vec3 render( in vec3 ro, in vec3 rd, in vec2 q )
|
||||
{
|
||||
//-----------------------------
|
||||
|
||||
vec3 col = background( rd );
|
||||
|
||||
//-----------------------------
|
||||
|
||||
float mindist = 1.0;
|
||||
float maxdist = 4.0;
|
||||
|
||||
vec4 matInfo;
|
||||
vec2 tm = intersectOpaque( ro, rd, mindist, maxdist, matInfo );
|
||||
if( tm.y>-0.5 && tm.x < maxdist )
|
||||
{
|
||||
col = shadeOpaque( ro, rd, tm.x, tm.y, matInfo );
|
||||
maxdist = tm.x;
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
|
||||
tm = intersectTransparent( ro, rd, mindist, maxdist, matInfo );
|
||||
if( tm.y>-0.5 && tm.x < maxdist )
|
||||
{
|
||||
col = shadeTransparent( ro, rd, tm.x, tm.y, matInfo, col, maxdist );
|
||||
}
|
||||
|
||||
//-----------------------------
|
||||
|
||||
float sun = clamp(dot(rd,sunDir),0.0,1.0);
|
||||
col += 1.0*vec3(1.5,0.8,0.7)*pow(sun,4.0);
|
||||
|
||||
//-----------------------------
|
||||
|
||||
col = pow( col, vec3(0.45) );
|
||||
|
||||
col = vec3(1.05,1.0,1.0)*col*(0.7+0.3*col*max(3.0-2.0*col,0.0)) + vec3(0.0,0.0,0.04);
|
||||
|
||||
col *= 0.3 + 0.7*pow(16.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.1);
|
||||
|
||||
return clamp( col, 0.0, 1.0 );
|
||||
}
|
||||
|
||||
mat3 setCamera( in vec3 ro, in vec3 rt )
|
||||
{
|
||||
vec3 w = normalize(ro-rt);
|
||||
|
||||
float m = sqrt(1.0-w.y*w.y);
|
||||
|
||||
return mat3( w.z, 0.0, -w.x,
|
||||
0.0, m*m, -w.z*w.y,
|
||||
w.x*m, w.y*m, w.z*m );
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
|
||||
#if AA<2
|
||||
|
||||
vec2 p = (-iResolution.xy+2.0*fragCoord.xy)/iResolution.y;
|
||||
vec2 q = fragCoord.xy/iResolution.xy;
|
||||
float an = 1.87 - 0.04*(1.0-cos(0.5*iTime));
|
||||
|
||||
vec3 ro = vec3(-0.4,0.2,0.0) + 2.2*vec3(cos(an),0.0,sin(an));
|
||||
vec3 ta = vec3(-0.6,0.2,0.0);
|
||||
mat3 ca = setCamera( ro, ta );
|
||||
vec3 rd = normalize( ca * vec3(p,-2.8) );
|
||||
|
||||
vec3 col = render( ro, rd, q );
|
||||
|
||||
#else
|
||||
|
||||
vec3 col = vec3(0.0);
|
||||
for( int m=ZERO; m<AA; m++ )
|
||||
for( int n=ZERO; n<AA; n++ )
|
||||
{
|
||||
vec2 rr = vec2( float(m), float(n) ) / float(AA);
|
||||
|
||||
vec2 p = (-iResolution.xy+2.0*(fragCoord.xy+rr))/iResolution.y;
|
||||
float an = 1.87 - 0.04*(1.0-cos(0.5*iTime));
|
||||
vec2 q = (fragCoord.xy+rr)/iResolution.xy;
|
||||
|
||||
vec3 ro = vec3(-0.4,0.2,0.0) + 2.2*vec3(cos(an),0.0,sin(an));
|
||||
vec3 ta = vec3(-0.6,0.2,0.0);
|
||||
mat3 ca = setCamera( ro, ta );
|
||||
vec3 rd = normalize( ca * vec3(p,-2.8) );
|
||||
|
||||
col += render( ro, rd, q );
|
||||
}
|
||||
col /= float(AA*AA);
|
||||
#endif
|
||||
|
||||
|
||||
fragColor = vec4( col, 1.0 );
|
||||
}"
|
||||
}
|
1437
TaoQuickDemo/Qml/Contents/ShaderEffect/SuperMario.qml
Normal file
1437
TaoQuickDemo/Qml/Contents/ShaderEffect/SuperMario.qml
Normal file
File diff suppressed because it is too large
Load Diff
22
TaoQuickDemo/Qml/Contents/Welcome/Welcome.qml
Normal file
22
TaoQuickDemo/Qml/Contents/Welcome/Welcome.qml
Normal file
@ -0,0 +1,22 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Item {
|
||||
TextArea {
|
||||
text: qsTr(
|
||||
"
|
||||
<p>
|
||||
欢迎使用TaoQuick演示程序,此程序罗列了<br/>
|
||||
TaoQuick的所有功能,并全面支持动态切换UI风格<br/>
|
||||
(换皮肤)、动态翻译多国语言等功能。<br/>
|
||||
</p>
|
||||
<p>
|
||||
更多功能正在路上,敬请期待。
|
||||
</p>
|
||||
")
|
||||
font.pixelSize: 20
|
||||
textFormat: TextEdit.RichText
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
readOnly: true
|
||||
}
|
||||
}
|
75
TaoQuickDemo/Qml/MainPage.qml
Normal file
75
TaoQuickDemo/Qml/MainPage.qml
Normal file
@ -0,0 +1,75 @@
|
||||
import QtQuick 2.12
|
||||
import "./Page"
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml"
|
||||
|
||||
Item {
|
||||
ContentData {
|
||||
id: gConfig
|
||||
objectName: "gConfig"
|
||||
}
|
||||
QtObject {
|
||||
id: appInfo
|
||||
objectName: "appInfo"
|
||||
property string appName
|
||||
property string appVersion
|
||||
property string latestVersion
|
||||
property string buildDateTime
|
||||
property string buildRevision
|
||||
property string copyRight
|
||||
property string descript
|
||||
property string compilerVendor
|
||||
}
|
||||
AboutDialog {
|
||||
id: aboutDialog
|
||||
|
||||
}
|
||||
Connections {
|
||||
target: view
|
||||
onPluginReady: {
|
||||
console.log("onPluginReady")
|
||||
var arr = null
|
||||
try {
|
||||
arr = JSON.parse(pluginInfo)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return
|
||||
}
|
||||
gConfig.contentData.append(arr)
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
view.initAppInfo()
|
||||
view.loadPlugin("TaoPlugin")
|
||||
}
|
||||
TitlePage {
|
||||
id: titleRect
|
||||
width: root.width
|
||||
height: 60
|
||||
color: gConfig.titleBackground
|
||||
TMoveArea {
|
||||
height: parent.height
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
rightMargin: 200
|
||||
}
|
||||
control: view
|
||||
}
|
||||
}
|
||||
TResizeBorder {
|
||||
control: view
|
||||
anchors.fill: parent
|
||||
}
|
||||
ContentPage {
|
||||
id: contentRect
|
||||
width: parent.width
|
||||
color: gConfig.background
|
||||
anchors.top: titleRect.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
NotifyBox {
|
||||
id: notifyBox
|
||||
}
|
||||
}
|
124
TaoQuickDemo/Qml/Page/AboutDialog.qml
Normal file
124
TaoQuickDemo/Qml/Page/AboutDialog.qml
Normal file
@ -0,0 +1,124 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml"
|
||||
|
||||
Popup {
|
||||
id: root
|
||||
width: 600
|
||||
height: 340
|
||||
|
||||
background: Rectangle {
|
||||
id: back
|
||||
width: root.width
|
||||
height: root.height
|
||||
radius: 8
|
||||
color: gConfig.titleBackground
|
||||
border.width: 1
|
||||
border.color: gConfig.reserverColor
|
||||
TMoveArea {
|
||||
anchors.fill: parent
|
||||
control: root
|
||||
}
|
||||
Image {
|
||||
id: img
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
source: "qrc:/Image/logo/milk.png"
|
||||
}
|
||||
TTextBtn {
|
||||
id: closeBtn
|
||||
text: qsTr("Close")
|
||||
width: 80
|
||||
height: 38
|
||||
radius: 8
|
||||
color: containsPress ? Qt.darker(gConfig.background, 1.2) : (containsMouse ? Qt.lighter(gConfig.background, 1.2) : gConfig.background)
|
||||
textColor: gConfig.textColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 4
|
||||
onClicked: {
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
Column {
|
||||
anchors.left: img.right
|
||||
anchors.leftMargin: 4
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 4
|
||||
anchors.bottom: closeBtn.top
|
||||
anchors.right: parent.right
|
||||
spacing: 18
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text: appInfo.appName + " " + appInfo.appVersion
|
||||
|
||||
font.pixelSize: 20
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
wrapMode: Text.WordWrap
|
||||
text: "Base on Qt " + appInfo.compilerVendor
|
||||
font.pixelSize: 16
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text: "Build on " + appInfo.buildDateTime
|
||||
font.pixelSize: 16
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
TextInput {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
text: "From revision " + appInfo.buildRevision
|
||||
font.pixelSize: 16
|
||||
font.underline: true
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text: appInfo.copyRight
|
||||
font.pixelSize: 16
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
textFormat: Text.RichText
|
||||
|
||||
text: "Author JaredTao <a href=\"https://jaredtao.github.io\">JaredTao Blog</a>"
|
||||
onLinkActivated: {
|
||||
Qt.openUrlExternally("https://jaredtao.github.io")
|
||||
}
|
||||
font.pixelSize: 16
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
TextArea {
|
||||
readOnly: true
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text: appInfo.descript
|
||||
font.pixelSize: 16
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show()
|
||||
{
|
||||
x = (parent.width - width) / 2
|
||||
y = (parent.height - height) / 2
|
||||
open()
|
||||
}
|
||||
|
||||
}
|
76
TaoQuickDemo/Qml/Page/ContentData.qml
Normal file
76
TaoQuickDemo/Qml/Page/ContentData.qml
Normal file
@ -0,0 +1,76 @@
|
||||
import QtQuick 2.12
|
||||
QtObject {
|
||||
|
||||
property color titleBackground: "#c62f2f"
|
||||
property color background: "#f6f6f6"
|
||||
property color reserverColor: "#ffffff"
|
||||
property color textColor: "black"
|
||||
property color splitColor: "gray"
|
||||
|
||||
property int currentTheme: 0
|
||||
onCurrentThemeChanged: {
|
||||
var t = themes.get(currentTheme)
|
||||
titleBackground = t.titleBackground
|
||||
background = t.background
|
||||
textColor = t.textColor
|
||||
}
|
||||
property ListModel themes: ListModel {
|
||||
ListElement {
|
||||
name: qsTr("一品红")
|
||||
titleBackground: "#c62f2f"
|
||||
background: "#f6f6f6"
|
||||
textColor: "#5c5c5c"
|
||||
}
|
||||
ListElement {
|
||||
name: qsTr("高冷黑")
|
||||
titleBackground: "#222225"
|
||||
background: "#272c25"
|
||||
textColor: "#adafb2"
|
||||
}
|
||||
ListElement {
|
||||
name: qsTr("淑女粉")
|
||||
titleBackground: "#faa0c5"
|
||||
background: "#f6f6f6"
|
||||
textColor: "#5c5c5c"
|
||||
}
|
||||
ListElement {
|
||||
name: qsTr("富贵金")
|
||||
titleBackground: "#fed98f"
|
||||
background: "#f6f6f6"
|
||||
textColor: "#5c5c5c"
|
||||
}
|
||||
ListElement {
|
||||
name: qsTr(" 清爽绿")
|
||||
titleBackground: "#58c979"
|
||||
background: "#f6f6f6"
|
||||
textColor: "#5c5c5c"
|
||||
}
|
||||
ListElement {
|
||||
name: qsTr("苍穹蓝")
|
||||
titleBackground: "#67c1fd"
|
||||
background: "#f6f6f6"
|
||||
textColor: "#5c5c5c"
|
||||
}
|
||||
}
|
||||
|
||||
property ListModel contentData: ListModel {
|
||||
ListElement { name: qsTr("首页"); title: qsTr("欢迎"); url: "qrc:/Qml/Contents/Welcome/Welcome.qml"; children: []}
|
||||
ListElement {
|
||||
name: qsTr("基础组件"); title: qsTr("基础组件"); children: [
|
||||
ListElement { name: qsTr("按钮组件"); title: qsTr("按钮组件"); url: "qrc:/Qml/Contents/BaseComponent/Buttons.qml"},
|
||||
ListElement { name: qsTr("拖动组件"); title: qsTr("拖动组件"); url: "qrc:/Qml/Contents/BaseComponent/Drags.qml"},
|
||||
ListElement { name: qsTr("渐变"); title: qsTr("渐变"); url: "qrc:/Qml/Contents/BaseComponent/Gradiants.qml"},
|
||||
ListElement { name: qsTr("进度条组件"); title: qsTr("进度条组件"); url: "qrc:/Qml/Contents/BaseComponent/Progresses.qml"},
|
||||
ListElement { name: qsTr("对话框"); title: qsTr("对话框"); url: "qrc:/Qml/Contents/BaseComponent/Dialogs.qml"}
|
||||
]
|
||||
}
|
||||
ListElement {
|
||||
name: qsTr("ShaderEffect"); title: qsTr("ShaderEffect"); children: [
|
||||
ListElement { name: qsTr("穿云洞"); title: qsTr("穿云洞"); url: "qrc:/Qml/Contents/ShaderEffect/CloudHole.qml"},
|
||||
ListElement { name: qsTr("星球之光"); title: qsTr("星球之光"); url: "qrc:/Qml/Contents/ShaderEffect/Planet.qml"},
|
||||
ListElement { name: qsTr("蜗牛"); title: qsTr("蜗牛"); url: "qrc:/Qml/Contents/ShaderEffect/Snail.qml"},
|
||||
ListElement { name: qsTr("超级马里奥"); title: qsTr("超级马里奥"); url: "qrc:/Qml/Contents/ShaderEffect/SuperMario.qml"}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
133
TaoQuickDemo/Qml/Page/ContentPage.qml
Normal file
133
TaoQuickDemo/Qml/Page/ContentPage.qml
Normal file
@ -0,0 +1,133 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
SequentialAnimation {
|
||||
running: s.checked
|
||||
loops: Animation.Infinite
|
||||
ParallelAnimation {
|
||||
PropertyAnimation { target: img1; property: "x"; to: -root.width; duration: 50000}
|
||||
PropertyAnimation { target: img2; property: "x"; to: 0; duration: 50000}
|
||||
}
|
||||
ScriptAction {
|
||||
script: { img1.x = root.width}
|
||||
}
|
||||
ParallelAnimation {
|
||||
PropertyAnimation { target: img2; property: "x"; to: -root.width; duration: 50000}
|
||||
PropertyAnimation { target: img1; property: "x"; to: 0; duration: 50000}
|
||||
}
|
||||
ScriptAction {
|
||||
script: { img2.x = root.width}
|
||||
}
|
||||
}
|
||||
Switch {
|
||||
id: s
|
||||
text: "Background"
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 40
|
||||
}
|
||||
Image {
|
||||
id: img1
|
||||
x: 0
|
||||
y: 0
|
||||
opacity: 0.2
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
source: "qrc:/Image/Window/flower.jpg"
|
||||
}
|
||||
Image {
|
||||
id: img2
|
||||
x: root.width
|
||||
y: 0
|
||||
opacity: 0.2
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
source: "qrc:/Image/Window/flower.jpg"
|
||||
}
|
||||
Rectangle {
|
||||
id: vLine
|
||||
width: parent.width - 2
|
||||
height: 1
|
||||
y: parent.height / 8
|
||||
x: 1
|
||||
color: gConfig.splitColor
|
||||
}
|
||||
Rectangle {
|
||||
id: hLine
|
||||
width: 1
|
||||
height: parent.height - 2
|
||||
y: 1
|
||||
x: parent.width / 4
|
||||
color: gConfig.splitColor
|
||||
}
|
||||
Item {
|
||||
id: logoFrame
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
right: hLine.left
|
||||
bottom: vLine.top
|
||||
}
|
||||
Text {
|
||||
text: qsTr("菜单")
|
||||
anchors.centerIn: parent
|
||||
color: gConfig.textColor
|
||||
}
|
||||
}
|
||||
Item {
|
||||
id: titleFrame
|
||||
anchors {
|
||||
left: hLine.right
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: vLine.top
|
||||
}
|
||||
Text {
|
||||
id: titleText
|
||||
text: qsTr(menuPage.currentTitle)
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 26
|
||||
color: gConfig.titleBackground
|
||||
}
|
||||
TFPS {
|
||||
width: 100
|
||||
height: 40
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
textColor: gConfig.titleBackground
|
||||
}
|
||||
}
|
||||
Item {
|
||||
id: menuFrame
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: hLine.left
|
||||
top: vLine.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
MenuPage {
|
||||
id: menuPage
|
||||
anchors.fill: parent
|
||||
model:gConfig.contentData
|
||||
}
|
||||
}
|
||||
Item {
|
||||
id: contentFrame
|
||||
anchors {
|
||||
left: hLine.right
|
||||
right: parent.right
|
||||
top: vLine.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
clip: true
|
||||
Loader {
|
||||
id: contentPage
|
||||
anchors.fill: parent
|
||||
source: menuPage.currentUrl
|
||||
}
|
||||
}
|
||||
}
|
93
TaoQuickDemo/Qml/Page/MenuPage.qml
Normal file
93
TaoQuickDemo/Qml/Page/MenuPage.qml
Normal file
@ -0,0 +1,93 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml"
|
||||
ListView {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
property string currentTitle
|
||||
property string currentUrl
|
||||
property int rowHeight: 40
|
||||
clip: true
|
||||
onModelChanged: {
|
||||
var f = model.get(0)
|
||||
currentTitle = f.name
|
||||
currentUrl = f.url
|
||||
mainIndex = 0
|
||||
}
|
||||
property var mainIndex: -1
|
||||
property var subIndex: -1
|
||||
Connections{
|
||||
target: view
|
||||
onReTransed: {
|
||||
var m = model.get(mainIndex)
|
||||
if (subIndex != -1) {
|
||||
var s = m.children.get(subIndex)
|
||||
currentTitle = s.name
|
||||
} else {
|
||||
currentTitle = m.name
|
||||
}
|
||||
}
|
||||
}
|
||||
delegate: Item {
|
||||
id: delegateItem
|
||||
width: root.width
|
||||
height: rowHeight
|
||||
clip: true
|
||||
Behavior on height {
|
||||
NumberAnimation { duration: 200 }
|
||||
}
|
||||
TGradientBtn {
|
||||
id: btn
|
||||
width: root.width
|
||||
height: rowHeight
|
||||
text: model.name
|
||||
textItem.leftPadding: 6
|
||||
textHorizontalAlignment: Text.AlignLeft
|
||||
textColor: text === currentTitle ? gConfig.titleBackground : gConfig.textColor
|
||||
onClicked: {
|
||||
if (model.url)
|
||||
{
|
||||
currentTitle = model.name
|
||||
currentUrl = model.url
|
||||
} else {
|
||||
if (!subListView.initOnce) {
|
||||
var subData = model.children
|
||||
subListView.model = subData
|
||||
subListView.initOnce = true;
|
||||
}
|
||||
if (subListView.visible)
|
||||
{
|
||||
subListView.visible = false
|
||||
delegateItem.height = rowHeight
|
||||
} else {
|
||||
delegateItem.height =subListView.height + rowHeight
|
||||
subListView.visible = true
|
||||
}
|
||||
}
|
||||
mainIndex = index
|
||||
subIndex = -1
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: subListView
|
||||
visible: false
|
||||
x: 20
|
||||
y: rowHeight
|
||||
width: root.width
|
||||
height: count * rowHeight
|
||||
property bool initOnce: false
|
||||
delegate: TGradientBtn {
|
||||
width: root.width
|
||||
height: rowHeight
|
||||
text: model.name
|
||||
textColor: text === currentTitle ? gConfig.titleBackground : gConfig.textColor
|
||||
onClicked: {
|
||||
currentTitle = model.name
|
||||
currentUrl = model.url
|
||||
subIndex = index
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
44
TaoQuickDemo/Qml/Page/NotifyBox.qml
Normal file
44
TaoQuickDemo/Qml/Page/NotifyBox.qml
Normal file
@ -0,0 +1,44 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
implicitWidth: 200
|
||||
implicitHeight: 40
|
||||
property var control: parent
|
||||
x: control.width * 0.7
|
||||
y: control.height * 1.1
|
||||
color: gConfig.reserverColor
|
||||
opacity: 0.7
|
||||
Text {
|
||||
id: t
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
SequentialAnimation {
|
||||
id: ani
|
||||
alwaysRunToEnd: false
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "y"
|
||||
duration: 500
|
||||
easing.type: Easing.Linear
|
||||
to: control.height * 0.8
|
||||
}
|
||||
|
||||
PauseAnimation {
|
||||
duration: 2400
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "y"
|
||||
duration: 500
|
||||
easing.type: Easing.Linear
|
||||
to: control.height * 1.1
|
||||
}
|
||||
|
||||
}
|
||||
function notify(msg) {
|
||||
t.text = msg
|
||||
ani.start()
|
||||
}
|
||||
}
|
195
TaoQuickDemo/Qml/Page/TitlePage.qml
Normal file
195
TaoQuickDemo/Qml/Page/TitlePage.qml
Normal file
@ -0,0 +1,195 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import TaoQuick 1.0
|
||||
import "qrc:/Tao/Qml"
|
||||
Rectangle {
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
height: parent.height
|
||||
spacing: 4
|
||||
Image {
|
||||
source: "qrc:/Image/logo/milk.png"
|
||||
}
|
||||
Text {
|
||||
id: t
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pixelSize: 28
|
||||
font.bold: true
|
||||
text: "TaoQuick"
|
||||
}
|
||||
}
|
||||
|
||||
property bool isMaxed: false
|
||||
Row {
|
||||
id: controlButtons
|
||||
height: 20
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
spacing: 10
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
imageUrl: containsMouse ? "qrc:/Image/Window/minimal_white.png" : "qrc:/Image/Window/minimal_gray.png"
|
||||
onClicked: {
|
||||
view.showMinimized()
|
||||
}
|
||||
}
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
visible: !isMaxed
|
||||
imageUrl: containsMouse ? "qrc:/Image/Window/max_white.png" : "qrc:/Image/Window/max_gray.png"
|
||||
onClicked: {
|
||||
view.showMaximized()
|
||||
isMaxed = true
|
||||
}
|
||||
}
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
visible: isMaxed
|
||||
imageUrl: containsMouse ? "qrc:/Image/Window/normal_white.png" : "qrc:/Image/Window/normal_gray.png"
|
||||
onClicked: {
|
||||
view.showNormal()
|
||||
isMaxed = false
|
||||
}
|
||||
}
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
imageUrl: containsMouse ? "qrc:/Image/Window/close_white.png" : "qrc:/Image/Window/close_gray.png"
|
||||
onClicked: {
|
||||
view.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: splitLine
|
||||
height: 16
|
||||
width: 1
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: controlButtons.left
|
||||
anchors.rightMargin: 10
|
||||
}
|
||||
Row {
|
||||
height: 20
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: splitLine.left
|
||||
anchors.rightMargin: 10
|
||||
spacing: 10
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
imageUrl: containsMouse ? "qrc:/Image/Window/skin_white.png" : "qrc:/Image/Window/skin_gray.png"
|
||||
onClicked: {
|
||||
skinBox.show()
|
||||
}
|
||||
TPopup {
|
||||
id: skinBox
|
||||
barColor: gConfig.reserverColor
|
||||
backgroundWidth: 280
|
||||
backgroundHeight: 180
|
||||
contentItem: GridView {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
model: gConfig.themes
|
||||
cellWidth: 80
|
||||
cellHeight: 80
|
||||
clip: true
|
||||
delegate: Item {
|
||||
width: 80
|
||||
height: 80
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
height: width
|
||||
color: model.titleBackground
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
border.color: model.titleBackground
|
||||
border.width: 2
|
||||
visible: a.containsMouse
|
||||
}
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
leftMargin: 8
|
||||
bottomMargin: 8
|
||||
}
|
||||
color: "white"
|
||||
text: model.name
|
||||
}
|
||||
Rectangle {
|
||||
x: parent.width - width
|
||||
y: parent.height - height
|
||||
width: 20
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: model.titleBackground
|
||||
border.width: 3
|
||||
border.color: gConfig.reserverColor
|
||||
visible: gConfig.currentTheme === index
|
||||
}
|
||||
MouseArea {
|
||||
id: a
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
gConfig.currentTheme = index
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
imageUrl: containsMouse ? "qrc:/Image/Window/lang_white.png" : "qrc:/Image/Window/lang_gray.png"
|
||||
onClicked: {
|
||||
// notifyBox.notify("change language")
|
||||
pop.show()
|
||||
}
|
||||
TPopup {
|
||||
id: pop
|
||||
barColor: gConfig.reserverColor
|
||||
backgroundWidth: 100
|
||||
backgroundHeight: 400
|
||||
contentItem: ListView {
|
||||
id: langListView
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
model: view.languageList
|
||||
clip: true
|
||||
delegate: TTextBtn {
|
||||
width: langListView.width
|
||||
height: 36
|
||||
text: modelData
|
||||
color: containsMouse ? "lightgray" : pop.barColor
|
||||
onClicked: {
|
||||
pop.hide()
|
||||
view.reTrans(modelData)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TImageBtn {
|
||||
width: 20
|
||||
height: 20
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
imageUrl: containsMouse ? "qrc:/Image/Window/about_white.png" : "qrc:/Image/Window/about_gray.png"
|
||||
onClicked: {
|
||||
aboutDialog.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
TaoQuickDemo/Qml/Splash.qml
Normal file
15
TaoQuickDemo/Qml/Splash.qml
Normal file
@ -0,0 +1,15 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
Item {
|
||||
width: 1024
|
||||
height: 768
|
||||
opacity: 1.0
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 500 }
|
||||
}
|
||||
|
||||
AnimatedImage {
|
||||
anchors.fill: parent
|
||||
source: "qrc:/Image/logo/splash.gif"
|
||||
}
|
||||
}
|
38
TaoQuickDemo/Qml/main.qml
Normal file
38
TaoQuickDemo/Qml/main.qml
Normal file
@ -0,0 +1,38 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import "./Page"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 1440
|
||||
height: 960
|
||||
|
||||
Splash {
|
||||
id: splash
|
||||
anchors.fill: parent
|
||||
}
|
||||
Loader {
|
||||
id: loader
|
||||
source: "qrc:/Qml/MainPage.qml"
|
||||
asynchronous: true
|
||||
opacity: 0
|
||||
anchors.fill: parent
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 600 }
|
||||
}
|
||||
onLoaded: {
|
||||
timer.start()
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 600
|
||||
repeat: false
|
||||
triggeredOnStart: false
|
||||
onTriggered: {
|
||||
loader.opacity = 1
|
||||
splash.visible = false
|
||||
}
|
||||
}
|
||||
}
|
23
TaoQuickDemo/Src/ITaoQuickPlugin.h
Normal file
23
TaoQuickDemo/Src/ITaoQuickPlugin.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include <QJsonArray>
|
||||
#include <QtPlugin>
|
||||
//ITaoQuickPlugin 插件接口
|
||||
class ITaoQuickPlugin {
|
||||
public:
|
||||
virtual ~ITaoQuickPlugin() {}
|
||||
//插件初始化
|
||||
virtual void init() = 0;
|
||||
//获取插件内容,Json格式为
|
||||
// [name: qsTr("首页"), title: qsTr("欢迎"), url: "qrc:/Qml/Contents/Welcome/Welcome.qml", children: []]
|
||||
//或者
|
||||
// [
|
||||
// name: qsTr("基础组件"); title: qsTr("基础组件"); children: [
|
||||
// { name: qsTr("按钮组件"); title: qsTr("按钮组件"); url: "qrc:/Qml/Contents/BaseComponent/Buttons.qml"}
|
||||
// ]
|
||||
// ]
|
||||
virtual QJsonArray infos() const = 0;
|
||||
//翻译
|
||||
virtual void replaceTranslater(const QString &oldLang, const QString &newLang) const = 0;
|
||||
};
|
||||
#define TaoQuickInterface_iid "jaredtao.github.io/TaoQuick/1.0"
|
||||
Q_DECLARE_INTERFACE(ITaoQuickPlugin, TaoQuickInterface_iid)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user