Compare commits

...

27 Commits
1.1.7 ... 1.1.9

Author SHA1 Message Date
47ab4dabbd update 2023-04-04 16:39:41 +08:00
206669e5f0 update 2023-04-04 15:09:34 +08:00
08457dc75e update 2023-04-04 09:08:10 +08:00
0c59a233ea update 2023-04-04 03:15:10 +08:00
fcb8da2c50 update 2023-04-04 02:37:20 +08:00
a8701256d4 update 2023-04-04 00:37:37 +08:00
8eaa4b6cbb update 2023-04-04 00:33:24 +08:00
af80a882d0 update 2023-04-04 00:18:39 +08:00
9d89328a43 update 2023-04-03 22:45:18 +08:00
0d4477437f update 2023-04-03 21:16:07 +08:00
6b3e73ce0b update 2023-04-03 21:13:50 +08:00
625bc74e26 update 2023-04-03 21:04:41 +08:00
731e4f27b4 update 2023-04-03 20:04:46 +08:00
fce64eccc6 Merge pull request #12 from JesseGuoX/main
add tag name into workflow release assets
2023-04-03 15:58:00 +08:00
689e0805e7 add tag name into update workflow release assets
before: example_ubuntu-20.04_6.4.3.AppImage

after: example_v1.1.8_ubuntu-20.04_Qt6.4.3.AppImage
2023-04-03 14:22:01 +08:00
986f1242dd update 2023-04-03 09:32:06 +08:00
a9c97a5c56 Merge pull request #10 from JesseGuoX/main
update workflow, speed up ci
2023-04-03 08:41:22 +08:00
81e78834d0 update workflow, speed up ci 2023-04-02 23:36:23 +08:00
5279a2c7b2 update 2023-04-02 14:05:54 +08:00
6391fc8dc6 update 2023-04-01 21:51:59 +08:00
9cf4b4b1af update 2023-04-01 21:42:32 +08:00
32c0b4ccd6 update 2023-04-01 21:37:07 +08:00
b2bfdd17da update 2023-04-01 21:06:39 +08:00
27db8160d4 update 2023-04-01 21:01:46 +08:00
ed0c9048b0 update 2023-04-01 10:22:05 +08:00
de2c891912 Create License 2023-04-01 09:31:18 +08:00
16daeb5268 update 2023-03-31 22:54:23 +08:00
55 changed files with 1200 additions and 417 deletions

View File

@ -16,24 +16,23 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11.0]
os: [macos-12]
qt_ver: [6.4.3]
qt_arch: [clang_64]
env:
targetName: example
steps:
# macos 11.0 默认环境变了,要指定
- name: prepare env
if: ${{ matrix.os == 'macos-11.0' }}
run: |
softwareupdate --all --install --force
sudo xcode-select --print-path
sudo xcode-select --switch /Library/Developer/CommandLineTools
- name: '⚙️ Cache Qt'
id: cache-qt
uses: actions/cache@v3
with:
path: ${{ runner.workspace }}/Qt
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
cached: 'false'
cache: ${{steps.cache-qt.outputs.cache-hit}}
arch: ${{ matrix.qt_arch }}
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
- uses: actions/checkout@v2
@ -60,6 +59,6 @@ jobs:
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: bin/release/${{ env.targetName }}.dmg
asset_name: ${{ env.targetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.dmg
asset_name: ${{ env.targetName }}_${{ github.ref_name }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}.dmg
tag: ${{ github.ref }}
overwrite: true

View File

@ -24,11 +24,17 @@ jobs:
env:
targetName: example
steps:
- name: '⚙️ Cache Qt'
id: cache-qt
uses: actions/cache@v3
with:
path: ${{ runner.workspace }}/Qt
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
cached: 'false'
cache: ${{steps.cache-qt.outputs.cache-hit}}
arch: ${{ matrix.qt_arch }}
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
- name: ubuntu install GL library
@ -44,6 +50,8 @@ jobs:
uses: miurahr/install-linuxdeploy-action@v1
with:
plugins: qt appimage
- name: Check if svg file exists
run: if [ ! -f "${targetName}.svg" ]; then echo "File not found, creating..."; touch ${targetName}.svg; fi
# 打包
- name: package
run: |
@ -64,6 +72,6 @@ jobs:
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.targetName }}.AppImage
asset_name: ${{ env.targetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.AppImage
asset_name: ${{ env.targetName }}_${{ github.ref_name }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}.AppImage
tag: ${{ github.ref }}
overwrite: true

76
.github/workflows/windows-mingw.yml vendored Normal file
View File

@ -0,0 +1,76 @@
name: Windows MinGW
on:
push:
paths:
- '*.pro'
- 'src/**'
- '.github/workflows/windows-mingw.yml'
pull_request:
paths:
- '*.pro'
- 'src/**'
- '.github/workflows/windows-mingw.yml'
jobs:
build:
name: Build
runs-on: windows-2022
strategy:
matrix:
include:
- qt_arch: win64_mingw
qt_ver: 6.4.3
qt_tools: "tools_mingw,9.0.0-1-202203221220,qt.tools.win64_mingw900"
qt_tools_mingw_install: mingw900_64
env:
targetName: example.exe
fileName: example
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
cache: ${{steps.cache-qt.outputs.cache-hit}}
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Qt6 environment configuration
if: ${{ startsWith( matrix.qt_ver, 6 ) }}
shell: pwsh
run: |
Write-Output "${{ env.Qt6_DIR }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Write-Output "${{ env.Qt6_DIR }}/../../Tools/${{ matrix.qt_tools_mingw_install }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: where is qmake & where is mingw32-make
shell: pwsh
run: |
Get-Command -Name 'qmake' | Format-List
Get-Command -Name 'mingw32-make' | Format-List
- name: mingw-build
id: build
shell: cmd
run: |
qmake
mingw32-make
- name: package
id: package
env:
archiveName: ${{ env.fileName }}-${{ matrix.qt_arch }}-${{ matrix.qt_ver }}
shell: pwsh
run: |
& scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:targetName}
$name = ${env:archiveName}
echo "::set-output name=packageName::$name"
- uses: actions/upload-artifact@v2
with:
name: ${{ steps.package.outputs.packageName }}
path: ${{ steps.package.outputs.packageName }}
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ env.fileName }}_${{ github.ref_name }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}.zip
tag: ${{ github.ref }}
overwrite: true

View File

@ -16,10 +16,11 @@ jobs:
name: Build
# 运行平台, windows-latest目前是windows server 2019
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
runs-on: windows-2019
runs-on: ${{ matrix.os }}
strategy:
# 矩阵配置
matrix:
os: [windows-2019]
include:
- qt_ver: 6.4.3
qt_arch: win64_msvc2019_64
@ -30,6 +31,12 @@ jobs:
fileName: example
# 步骤
steps:
- name: '⚙️ Cache Qt'
id: cache-qt
uses: actions/cache@v3
with:
path: ${{ runner.workspace }}\Qt
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
# 安装Qt
- name: Install Qt
# 使用外部action。这个action专门用来安装Qt
@ -37,7 +44,7 @@ jobs:
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
cached: 'false'
cache: ${{steps.cache-qt.outputs.cache-hit}}
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
# 拉取代码
- uses: actions/checkout@v2
@ -80,6 +87,6 @@ jobs:
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ steps.package.outputs.packageName }}.zip
asset_name: ${{ env.fileName }}_${{ github.ref_name }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}.zip
tag: ${{ github.ref }}
overwrite: true

3
.gitignore vendored
View File

@ -32,4 +32,5 @@ target_wrapper.*
CMakeLists.txt.user*
src/build-preset/plugins.qmltypes
bin
bin
.DS_Store

5
CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project(FluentUI VERSION 0.1 LANGUAGES CXX)
add_subdirectory(src)
add_subdirectory(example)

21
License Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 zhuzichu
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.

View File

@ -2,11 +2,14 @@
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
import QtMultimedia
import FluentUI
Window {
id:app
color: "#00000000"
//初始化一个MediaPlayer解决macos切换到T_MediaPalyer页面崩溃问题
MediaPlayer{}
Component.onCompleted: {
FluApp.init(app,properties)
FluTheme.frameless = ("windows" === Qt.platform.os)

86
example/CMakeLists.txt Normal file
View File

@ -0,0 +1,86 @@
cmake_minimum_required(VERSION 3.16)
project(example)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 17)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(platform 64)
else()
set(platform 32)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin/debug)
else()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin/release)
endif()
find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multimedia REQUIRED)
set(SOURCES
ChatController.cpp
main.cpp
)
set(HEADERS
ChatController.h
)
set(RESOURCES
qml.qrc
)
set(RC_ICONS
favicon.ico
)
qt_add_resources(QT_RESOURCES ${RESOURCES})
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${QT_RESOURCES} ${RC_ICONS})
if(WIN32)
if(platform EQUAL 32)
file(GLOB DLL_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../third/Win_x86/*.dll)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${DLL_FILES}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
else()
file(GLOB DLL_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../third/Win_x64/*.dll)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${DLL_FILES}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
endif()
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE
QT_DEPRECATED_WARNINGS
QT_NO_WARNING_OUTPUT
)
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt6::Core
Qt6::Quick
Qt6::QuickControls2
Qt6::Concurrent
Qt6::Network
Qt6::Multimedia
)
if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE UNICODE WIN32 _WINDOWS)
target_link_libraries(${PROJECT_NAME} PRIVATE dwmapi user32)
endif()
if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST Info.plist
)
endif()

View File

@ -67,7 +67,6 @@ FluContentPage {
width:parent.width
wrapMode: Text.WrapAnywhere
text: modelData.name
horizontalAlignment: Text.AlignHCenter
}
}

View File

@ -13,7 +13,7 @@ FluScrollablePage{
bottomPadding:20
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 106
paddings: 10

View File

@ -19,7 +19,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
height: 68
paddings: 10
@ -50,7 +50,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
height: 68
paddings: 10
@ -81,7 +81,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
height: 68
paddings: 10
@ -113,7 +113,7 @@ FluScrollablePage{
FluArea{
width: parent.width
Layout.fillWidth: true
height: 68
paddings: 10
@ -145,7 +145,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
height: 68
paddings: 10
@ -186,7 +186,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
height: 100
paddings: 10
@ -228,7 +228,7 @@ FluScrollablePage{
FluArea{
width: parent.width
Layout.fillWidth: true
height: 68
paddings: 10
@ -255,6 +255,4 @@ FluScrollablePage{
}
}
}
}

View File

@ -12,7 +12,7 @@ FluScrollablePage{
bottomPadding:20
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 350
paddings: 10
@ -21,7 +21,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 80
paddings: 10

View File

@ -12,7 +12,7 @@ FluScrollablePage{
bottomPadding:20
FluArea{
width: parent.width
Layout.fillWidth: true
height: 370
paddings: 10
Layout.topMargin: 20

View File

@ -12,7 +12,7 @@ FluScrollablePage{
bottomPadding:20
FluArea{
width: parent.width
Layout.fillWidth: true
height: 280
Layout.topMargin: 20
paddings: 10
@ -39,7 +39,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 60
paddings: 10

View File

@ -12,7 +12,7 @@ FluScrollablePage{
bottomPadding:20
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 80
paddings: 10
@ -36,7 +36,7 @@ FluScrollablePage{
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 80
paddings: 10

78
example/T_FlipView.qml Normal file
View File

@ -0,0 +1,78 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import FluentUI
FluScrollablePage{
title:"FlipView"
leftPadding:10
rightPadding:10
bottomPadding:20
FluArea{
Layout.fillWidth: true
height: 340
paddings: 10
Layout.topMargin: 20
ColumnLayout{
anchors.verticalCenter: parent.verticalCenter
FluText{
text:"水平方向的FlipView"
}
FluFlipView{
Image{
source: "qrc:/res/image/banner_1.jpg"
asynchronous: true
sourceSize: Qt.size(400,300)
fillMode:Image.PreserveAspectCrop
}
Image{
source: "qrc:/res/image/banner_2.jpg"
asynchronous: true
fillMode:Image.PreserveAspectCrop
}
Image{
source: "qrc:/res/image/banner_3.jpg"
asynchronous: true
fillMode:Image.PreserveAspectCrop
}
}
}
}
FluArea{
Layout.fillWidth: true
height: 340
paddings: 10
Layout.topMargin: 20
ColumnLayout{
anchors.verticalCenter: parent.verticalCenter
FluText{
text:"垂直方向的FlipView"
}
FluFlipView{
vertical:true
Image{
source: "qrc:/res/image/banner_1.jpg"
asynchronous: true
sourceSize: Qt.size(400,300)
fillMode:Image.PreserveAspectCrop
}
Image{
source: "qrc:/res/image/banner_2.jpg"
asynchronous: true
fillMode:Image.PreserveAspectCrop
}
Image{
source: "qrc:/res/image/banner_3.jpg"
asynchronous: true
fillMode:Image.PreserveAspectCrop
}
}
}
}
}

View File

@ -129,7 +129,7 @@ FluScrollablePage{
id:item_mouse
anchors.fill: parent
hoverEnabled: true
onWheel: {
onWheel: (wheel)=>{
if (wheel.angleDelta.y > 0) scrollbar_header.decrease()
else scrollbar_header.increase()
}

View File

@ -20,7 +20,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
height: 320
Layout.topMargin: 20
paddings: 10
@ -31,11 +31,26 @@ FluScrollablePage{
}
FluMediaPlayer{
id:player
// source:"http://mirror.aarnet.edu.au/pub/TED-talks/911Mothers_2010W-480p.mp4"
source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
// source:"http://video.chinanews.com/flv/2019/04/23/400/111773_web.mp4"
}
}
}
FluArea{
Layout.fillWidth: true
height: 68
Layout.topMargin: 20
paddings: 10
FluButton{
text:"跳转到视频播放器窗口"
anchors.verticalCenter: parent.verticalCenter
onClicked:{
FluApp.navigate("/media",{source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"})
}
}
}
}

View File

@ -24,7 +24,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
height: 100
paddings: 10
Layout.topMargin: 20
@ -48,7 +48,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
height: 130
paddings: 10
Layout.topMargin: 20
@ -75,6 +75,4 @@ FluScrollablePage{
}
}
}

51
example/T_Pivot.qml Normal file
View File

@ -0,0 +1,51 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import FluentUI
FluScrollablePage{
title:"Pivot"
leftPadding:10
rightPadding:10
bottomPadding:20
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 400
paddings: 10
FluPivot{
anchors.fill: parent
FluPivotItem{
title:"All"
contentItem:FluText{
text:"All emails go here."
}
}
FluPivotItem{
title:"Unread"
contentItem:FluText{
text:"Unread emails go here."
}
}
FluPivotItem{
title:"Flagged"
contentItem:FluText{
text:"Flagged emails go here."
}
}
FluPivotItem{
title:"Urgent"
contentItem:FluText{
text:"Urgent emails go here."
}
}
}
}
}

View File

@ -32,7 +32,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 50
paddings: 10
@ -69,7 +69,7 @@ FluScrollablePage{
FluDropDownButton{
id:btn_close_button_visibility
text:"Always"
Layout.preferredWidth: 120
Layout.preferredWidth: 120
items:[
FluMenuItem{
text:"Nerver"
@ -98,7 +98,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 5
height: 400
paddings: 10

View File

@ -17,7 +17,7 @@ FluScrollablePage{
Layout.preferredWidth: 300
disabled:toggle_switch.selected
}
FluMultiLineTextBox{
FluMultilineTextBox{
Layout.topMargin: 20
Layout.preferredWidth: 300
placeholderText: "多行输入框"

View File

@ -12,7 +12,7 @@ FluScrollablePage{
bottomPadding:20
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 80
paddings: 10
@ -36,7 +36,7 @@ FluScrollablePage{
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 80
paddings: 10

View File

@ -18,7 +18,7 @@ FluScrollablePage{
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 68
paddings: 10
@ -44,7 +44,7 @@ FluScrollablePage{
}
FluArea{
width: parent.width
Layout.fillWidth: true
Layout.topMargin: 20
height: 68
paddings: 10

View File

@ -25,18 +25,10 @@ CONFIG(debug,debug|release) {
win32 {
contains(QT_ARCH, i386) {
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/Win_x86/*.dll) $$DESTDIR
contains(QMAKE_CC, cl) {
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, \\)
} else {
QMAKE_PRE_LINK += $$QMAKE_COPY $$COPYDLL
}
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
} else {
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/Win_x64/*.dll) $$DESTDIR
contains(QMAKE_CC, cl) {
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, \\)
} else {
QMAKE_PRE_LINK += $$QMAKE_COPY $$COPYDLL
}
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
}
}

View File

@ -172,10 +172,22 @@ FluObject{
FluPaneItemExpander{
title:"Navigation"
icon:FluentIcons.AllApps
FluPaneItem{
title:"Pivot"
image:"qrc:/res/image/control/Pivot.png"
recentlyAdded:true
order:3
desc:"Presents information from different sources in atabbed view."
onTap:{
navigationView.push("qrc:/T_Pivot.qml")
}
}
FluPaneItem{
title:"TabView"
image:"qrc:/res/image/control/TabView.png"
recentlyAdded:true
order:1
desc:"A control that displays a collection of tabs thatcan be used to display several documents."
onTap:{
navigationView.push("qrc:/T_TabView.qml")
@ -187,16 +199,24 @@ FluObject{
navigationView.push("qrc:/T_TreeView.qml")
}
}
FluPaneItem{
title:"MultiWindow"
onTap:{
navigationView.push("qrc:/T_MultiWindow.qml")
}
}
FluPaneItem{
title:"FlipView"
image:"qrc:/res/image/control/FlipView.png"
recentlyAdded:true
order:2
desc:"Presents a collection of items that the user canflip through, one item at a time."
onTap:{
navigationView.push("qrc:/T_FlipView.qml")
}
}
}
FluPaneItemExpander{
title:"Theming"
icon:FluentIcons.Brightness
@ -228,6 +248,7 @@ FluObject{
title:"MediaPlayer"
image:"qrc:/res/image/control/MediaPlayerElement.png"
recentlyAdded:true
order:0
desc:"A control to display video and image content."
onTap:{
navigationView.push("qrc:/T_MediaPlayer.qml")
@ -251,6 +272,7 @@ FluObject{
}
}
}
arr.sort(function(o1,o2){ return o2.order-o1.order })
return arr
}
@ -289,7 +311,7 @@ FluObject{
item.tap()
navigationView.setCurrentIndex(i)
if(item.parent){
item.parent.isExpand = true
item.parent.isExpand = true
}
return
}

View File

@ -36,7 +36,7 @@ FluWindow {
fontStyle: FluText.Title
}
FluText{
text:"v1.1.7"
text:"v1.1.9"
fontStyle: FluText.Body
Layout.alignment: Qt.AlignBottom
}

View File

@ -1,5 +1,6 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import FluentUI
FluWindow {

View File

@ -20,7 +20,6 @@ FluWindow {
width:parent.width
}
FluNavigationView{
id:nav_view
anchors.fill: parent

View File

@ -12,6 +12,10 @@ FluWindow {
title:"视频播放器"
onInitArgument:
(argument)=>{
player.source = argument.source
}
FluAppBar{
id:appbar
@ -28,10 +32,6 @@ FluWindow {
top: appbar.bottom
bottom: parent.bottom
}
// source:"http://mirror.aarnet.edu.au/pub/TED-talks/911Mothers_2010W-480p.mp4"
source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
// source:"http://video.chinanews.com/flv/2019/04/23/400/111773_web.mp4"
}
}

View File

@ -153,5 +153,7 @@
<file>global/qmldir</file>
<file>global/ItemsFooter.qml</file>
<file>page/MediaPage.qml</file>
<file>T_FlipView.qml</file>
<file>T_Pivot.qml</file>
</qresource>
</RCC>

View File

@ -0,0 +1,34 @@
[CmdletBinding()]
param (
[string] $archiveName, [string] $targetName
)
# 外部环境变量包括:
# archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
# archiveName: 5.15.2-win64_mingw81
$scriptDir = $PSScriptRoot
$currentDir = Get-Location
Write-Host "currentDir" $currentDir
Write-Host "scriptDir" $scriptDir
function Main() {
New-Item -ItemType Directory $archiveName
# 拷贝exe
Copy-Item bin\release\* $archiveName\
# 拷贝依赖
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
# 删除不必要的文件
$excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb")
Remove-Item -Path $archiveName -Include $excludeList -Recurse -Force
# 打包zip
Compress-Archive -Path $archiveName $archiveName'.zip'
}
if ($null -eq $archiveName || $null -eq $targetName) {
Write-Host "args missing, archiveName is" $archiveName ", targetName is" $targetName
return
}
Main

68
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 3.16)
project(FluentUI)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt6 COMPONENTS Core Quick Svg REQUIRED)
set(QT_INSTALL_QML ${Qt6Core_DIR}/../../../qml)
set(TARGET_TYPE SHARED)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
set(TARGET_RESOURCES res.qrc)
set(TARGET_SOURCES
Def.cpp
FluApp.cpp
FluColorSet.cpp
FluColors.cpp
FluRegister.cpp
FluTheme.cpp
Fluent.cpp
FluentUI.cpp
WindowHelper.cpp
qml_plugin.cpp
)
set(TARGET_HEADERS
Def.h
FluApp.h
FluColorSet.h
FluColors.h
FluRegister.h
FluTheme.h
Fluent.h
FluentUI.h
FramelessView.h
WindowHelper.h
qml_plugin.h
stdafx.h
)
if(WIN32)
set(TARGET_SOURCES ${TARGET_SOURCES} FramelessView_win.cpp)
else()
set(TARGET_SOURCES ${TARGET_SOURCES} FramelessView_unix.cpp)
endif()
add_definitions(-DVERSION_IN="1.0.0")
add_definitions(-DVURI_STR="FluentUI")
add_library(${PROJECT_NAME} ${TARGET_TYPE} ${TARGET_SOURCES} ${TARGET_HEADERS} ${TARGET_RESOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE dwmapi user32)
else()
endif()
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick Qt6::Svg)
if(WIN32)
include(build_windows.cmake)
else()
include(build_macos.cmake)
endif()

View File

@ -33,6 +33,9 @@ void Fluent::registerTypes(const char *uri){
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivotItem.qml"),uri,major,minor,"FluPivotItem");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivot.qml"),uri,major,minor,"FluPivot");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFlipView.qml"),uri,major,minor,"FluFlipView");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItemExpander.qml"),uri,major,minor,"FluPaneItemExpander");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTabView.qml"),uri,major,minor,"FluTabView");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluArea.qml"),uri,major,minor,"FluArea");
@ -59,7 +62,7 @@ void Fluent::registerTypes(const char *uri){
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMenu.qml"),uri,major,minor,"FluMenu");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluScrollBar.qml"),uri,major,minor,"FluScrollBar");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTextButton.qml"),uri,major,minor,"FluTextButton");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMultiLineTextBox.qml"),uri,major,minor,"FluMultiLineTextBox");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMultilineTextBox.qml"),uri,major,minor,"FluMultilineTextBox");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTooltip.qml"),uri,major,minor,"FluTooltip");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluDivider.qml"),uri,major,minor,"FluDivider");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluIcon.qml"),uri,major,minor,"FluIcon");

32
src/build_macos.cmake Normal file
View File

@ -0,0 +1,32 @@
set(OUTP ${CMAKE_BINARY_DIR}/bin/FluentUI/)
add_definitions(-DMACOS)
set(CMAKE_INSTALL_PREFIX ${OUTP})
set(CMAKE_INSTALL_DESTDIR ${OUTP})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(QMAKE_MOC_OPTIONS -Muri=${uri})
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND chmod -R 777 ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh
)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh PRESET ${CMAKE_CURRENT_SOURCE_DIR}/ ${OUTP}
)
if(${TARGET_TYPE} STREQUAL "SHARED")
set(INST_QMLPATH ${QT_INSTALL_QML}/FluentUI)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/macos_install.sh INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/ ${OUTP} ${INST_QMLPATH}
)
endif()

27
src/build_windows.cmake Normal file
View File

@ -0,0 +1,27 @@
set(OUTP "${CMAKE_BINARY_DIR}/bin/FluentUI")
set(BUILDBIN_PATH "${OUTP}")
set(QTQMLFLUENT_PATH "${QT_INSTALL_QML}/FluentUI")
set(PRESET_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build-preset")
set(SOLIBFILE_PATH "${CMAKE_BINARY_DIR}/libFluentUI.so")
set(ANDROID NO)
if (ANDROID)
set(ANDROID YES)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTP})
else()
set(CMAKE_INSTALL_PREFIX "${OUTP}")
endif()
set(SHAREDSCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/win_install.bat SHARED ${CMAKE_CURRENT_SOURCE_DIR} ${PRESET_PATH} ${BUILDBIN_PATH} ${QTQMLFLUENT_PATH} ${ANDROID} ${SOLIBFILE_PATH})
set(STATICSCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/win_install.bat STATIC ${CMAKE_CURRENT_SOURCE_DIR} ${PRESET_PATH} ${BUILDBIN_PATH} ${QTQMLFLUENT_PATH} ${ANDROID} ${SOLIBFILE_PATH})
string(REPLACE "/" "\\" SHAREDSCRIPT "${SHAREDSCRIPT}")
string(REPLACE "/" "\\" STATICSCRIPT "${STATICSCRIPT}")
if (${TARGET_TYPE} STREQUAL "SHARED")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${SHAREDSCRIPT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
else()
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${STATICSCRIPT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()

View File

@ -4,17 +4,14 @@ QTQMLFLUENT_PATH = $$[QT_INSTALL_QML]/FluentUI
PRESET_PATH = $$PWD/build-preset
SOLIBFILE_PATH = $$OUT_PWD/libFluentUI.so
ANDROID = NO
android{
ANDROID=YES
QMAKE_PRE_LINK *= md $$replace(OUTP, /, \\)
}else{
DESTDIR += $$OUTP
}
SHAREDSCRIPT = "$$PWD\win_install.bat" SHARED "$$PWD" "$$PRESET_PATH" "$$BUILDBIN_PATH" "$$QTQMLFLUENT_PATH" $$ANDROID "$$SOLIBFILE_PATH"
STATICSCRIPT = "$$PWD\win_install.bat" STATIC "$$PWD" "$$PRESET_PATH" "$$BUILDBIN_PATH" "$$QTQMLFLUENT_PATH" $$ANDROID "$$SOLIBFILE_PATH"
CONFIG(sharedlib){
QMAKE_POST_LINK *= $$replace(SHAREDSCRIPT, /, \\)
}

View File

@ -30,10 +30,10 @@ Item {
pickerCursor.y = Math.max(0, Math.min(height, mouse.y)-cursorHeight)
}
}
onPositionChanged: {
onPositionChanged:(mouse)=> {
handleMouse(mouse)
}
onPressed: handleMouse(mouse)
onPressed:(mouse)=> handleMouse(mouse)
}
function setValue(val) {

View File

@ -7,23 +7,35 @@ import FluentUI
Rectangle{
property string title: ""
property string darkText : "夜间模式"
property string minimizeText : "最小化"
property string restoreText : "向下还原"
property string maximizeText : "最大化"
property string closeText : "关闭"
property color textColor: FluTheme.dark ? "#FFFFFF" : "#000000"
property color minimizeNormalColor: Qt.rgba(0,0,0,0)
property color minimizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.1) : Qt.rgba(0,0,0,0.06)
property color maximizeNormalColor: Qt.rgba(0,0,0,0)
property color maximizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.1) : Qt.rgba(0,0,0,0.06)
property color closeNormalColor: Qt.rgba(0,0,0,0)
property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1)
property bool showDark: false
property bool showFps: false
property var window: Window.window
property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
property bool resizable: {
if(window == null){
return false
}
return !(window.minimumHeight === window.maximumHeight && window.maximumWidth === window.minimumWidth)
Item{
id:d
property var win: Window.window
property bool isRestore: win && Window.Maximized === win.visibility
property bool resizable: win && !(win.minimumHeight === win.maximumHeight && win.maximumWidth === win.minimumWidth)
}
id:root
color: Qt.rgba(0,0,0,0)
visible: FluTheme.frameless
height: visible ? 30 : 0
clip: true
opacity: visible
z: 65535
TapHandler {
@ -34,7 +46,7 @@ Rectangle{
DragHandler {
target: null
grabPermissions: TapHandler.CanTakeOverFromAnything
onActiveChanged: if (active) { window.startSystemMove(); }
onActiveChanged: if (active) { d.win.startSystemMove(); }
}
FluText {
@ -62,7 +74,7 @@ Rectangle{
visible: showDark
spacing: 5
FluText{
text:"夜间模式"
text:darkText
color:root.textColor
}
FluToggleSwitch{
@ -79,53 +91,24 @@ Rectangle{
iconSource : FluentIcons.ChromeMinimize
Layout.alignment: Qt.AlignVCenter
iconSize: 11
text:"最小化"
text:minimizeText
radius: 0
textColor: root.textColor
color:{
if(FluTheme.dark){
if(hovered){
return Qt.rgba(1,1,1,0.06)
}
return Qt.rgba(0,0,0,0)
}else{
if(hovered){
return Qt.rgba(0,0,0,0.06)
}
return Qt.rgba(0,0,0,0)
}
}
iconColor: root.textColor
color: hovered ? minimizeHoverColor : minimizeNormalColor
onClicked: {
window.showMinimized()
d.win.showMinimized()
}
}
FluIconButton{
width: 40
height: 30
property bool isRestore:{
if(window == null)
return false
return Window.Maximized === window.visibility
}
iconSource : isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
color:{
if(FluTheme.dark){
if(hovered){
return Qt.rgba(1,1,1,0.06)
}
return Qt.rgba(0,0,0,0)
}else{
if(hovered){
return Qt.rgba(0,0,0,0.06)
}
return Qt.rgba(0,0,0,0)
}
}
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
color: hovered ? maximizeHoverColor : maximizeNormalColor
Layout.alignment: Qt.AlignVCenter
visible: resizable
visible: d.resizable
radius: 0
textColor: root.textColor
text:isRestore?"向下还原":"最大化"
iconColor: root.textColor
text:d.isRestore?restoreText:maximizeText
iconSize: 11
onClicked: {
toggleMaximized()
@ -134,26 +117,26 @@ Rectangle{
FluIconButton{
iconSource : FluentIcons.ChromeClose
Layout.alignment: Qt.AlignVCenter
text:"关闭"
text:closeText
width: 40
height: 30
radius: 0
iconSize: 10
textColor: hovered ? Qt.rgba(1,1,1,1) : root.textColor
color:hovered ? Qt.rgba(251/255,115/255,115/255,1) : "#00000000"
iconColor: hovered ? Qt.rgba(1,1,1,1) : root.textColor
color:hovered ? closeHoverColor : closeNormalColor
onClicked: {
Window.window.close()
d.win.close()
}
}
}
function toggleMaximized() {
if(!resizable)
if(!d.resizable)
return
if (window.visibility === Window.Maximized) {
window.showNormal();
if (d.win.visibility === Window.Maximized) {
d.win.showNormal();
} else {
window.showMaximized();
d.win.showMaximized();
}
}

View File

@ -2,138 +2,29 @@
import QtQuick.Controls
import FluentUI
TextField{
FluTextBox{
property var items:[]
property int fontStyle: FluText.Body
property int pixelSize : FluTheme.textSize
property int iconSource: 0
property bool disabled: false
property string emptyText: "没有找到结果"
signal itemClicked(var data)
signal handleClicked
QtObject{
id:d
property bool flagVisible: true
}
id:input
id:control
width: 300
enabled: !disabled
color: {
if(disabled){
return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
}
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
}
selectionColor: FluTheme.primaryColor.lightest
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
placeholderTextColor: {
if(disabled){
return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
}
if(focus){
return FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
}
return FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
}
rightPadding: icon_right.visible ? 50 : 30
selectByMouse: true
Keys.onUpPressed: {
list_view.currentIndex = Math.max(list_view.currentIndex-1,0)
}
Keys.onDownPressed: {
list_view.currentIndex = Math.min(list_view.currentIndex+1,list_view.count-1)
}
Keys.onEnterPressed:handleClicked()
Keys.onReturnPressed:handleClicked()
font.bold: {
switch (fontStyle) {
case FluText.Display:
return true
case FluText.TitleLarge:
return true
case FluText.Title:
return true
case FluText.SubTitle:
return true
case FluText.BodyStrong:
return true
case FluText.Body:
return false
case FluText.Caption:
return false
default:
return false
}
}
font.pixelSize: {
switch (fontStyle) {
case FluText.Display:
return text.pixelSize * 4.857
case FluText.TitleLarge:
return text.pixelSize * 2.857
case FluText.Title:
return text.pixelSize * 2
case FluText.SubTitle:
return text.pixelSize * 1.428
case FluText.Body:
return text.pixelSize * 1.0
case FluText.BodyStrong:
return text.pixelSize * 1.0
case FluText.Caption:
return text.pixelSize * 0.857
default:
return text.pixelSize * 1.0
}
}
FluIconButton{
iconSource:FluentIcons.ChromeClose
iconSize: 10
width: 20
height: 20
opacity: 0.5
visible: input.text !== ""
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: icon_right.visible ? 25 : 5
}
onClicked:{
input.text = ""
}
}
background: FluTextBoxBackground{
inputItem: input
FluIcon{
id:icon_right
iconSource: input.iconSource
iconSize: 15
opacity: 0.5
visible: input.iconSource != 0
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 5
}
}
}
Component.onCompleted: {
searchData()
loadData()
}
Popup{
id:input_popup
y:input.height
id:control_popup
y:control.height
focus: false
enter: Transition {
NumberAnimation {
property: "y"
from:0
to:input_popup.y
to:control_popup.y
duration: 150
}
NumberAnimation {
@ -149,7 +40,7 @@ TextField{
}
}
background: Rectangle{
width: input.width
width: control.width
radius: 4
FluShadow{
radius: 4
@ -163,11 +54,11 @@ TextField{
currentIndex: -1
ScrollBar.vertical: FluScrollBar {}
header: Item{
width: input.width
width: control.width
height: visible ? 38 : 0
visible: list_view.count === 0
FluText{
text:"没有找到结果"
text:emptyText
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
@ -176,7 +67,7 @@ TextField{
}
}
delegate:Control{
width: input.width
width: control.width
padding:10
background: Rectangle{
color: {
@ -192,7 +83,7 @@ TextField{
id:mouse_area
anchors.fill: parent
Connections{
target: input
target: control
function onHandleClicked(){
if((list_view.currentIndex === index)){
handleClick(modelData)
@ -223,72 +114,41 @@ TextField{
}
}
}
onTextChanged: {
loadData()
if(d.flagVisible){
control_popup.visible = true
}
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: control.echoMode !== TextInput.Password && menu.popup()
}
FluTextBoxMenu{
id:menu
inputItem: control
}
function handleClick(modelData){
input_popup.visible = false
input.itemClicked(modelData)
control_popup.visible = false
control.itemClicked(modelData)
updateText(modelData.title)
}
function updateText(text){
d.flagVisible = false
input.text = text
control.text = text
d.flagVisible = true
}
onTextChanged: {
searchData()
if(d.flagVisible){
input_popup.visible = true
}
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: input.echoMode !== TextInput.Password && menu.popup()
}
FluMenu{
id:menu
focus: false
FluMenuItem{
text: "剪切"
visible: input.text !== ""
onClicked: {
input.cut()
}
}
FluMenuItem{
text: "复制"
visible: input.selectedText !== ""
onClicked: {
input.copy()
}
}
FluMenuItem{
text: "粘贴"
visible: input.canPaste
onClicked: {
input.paste()
}
}
FluMenuItem{
text: "全选"
visible: input.text !== ""
onClicked: {
input.selectAll()
}
}
}
function searchData(){
function loadData(){
var result = []
if(items==null){
list_view.model = result
return
}
items.map(function(item){
if(item.title.indexOf(input.text)!==-1){
if(item.title.indexOf(control.text)!==-1){
result.push(item)
}
})
@ -296,4 +156,3 @@ TextField{
}
}

View File

@ -9,9 +9,10 @@ Rectangle {
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property string text: "请选择日期"
property var window : Window.window
id:root
id:control
color: {
if(mouse_area.containsMouse){
return hoverColor
@ -44,7 +45,7 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"请选择日期"
text:control.text
}
FluIcon{
@ -95,15 +96,15 @@ Rectangle {
}
background: Item{}
function showPopup() {
var pos = root.mapToItem(null, 0, 0)
if(window.height>pos.y+root.height+popup.height){
popup.y = root.height
var pos = control.mapToItem(null, 0, 0)
if(window.height>pos.y+control.height+popup.height){
popup.y = control.height
} else if(pos.y>popup.height){
popup.y = -popup.height
} else {
popup.y = window.height-(pos.y+popup.height)
}
popup.x = -(popup.width-root.width)/2
popup.x = -(popup.width-control.width)/2
popup.open()
}
}

View File

@ -0,0 +1,116 @@
import QtQuick
import QtQuick.Controls
import FluentUI
Item{
property bool vertical: false
default property alias content : swipe.contentData
property alias currentIndex: swipe.currentIndex
id:control
width: 400
height: 300
implicitWidth: width
implicitHeight: height
QtObject{
id:d
property bool flag: true
}
MouseArea{
anchors.fill: parent
preventStealing: true
onWheel:
(wheel)=>{
if(!d.flag)
return
if (wheel.angleDelta.y > 0){
btn_start.clicked()
}else{
btn_end.clicked()
}
d.flag = false
timer.restart()
}
}
Timer{
id:timer
interval: 250
onTriggered: {
d.flag = true
}
}
SwipeView {
id:swipe
clip: true
interactive: false
orientation:control.vertical ? Qt.Vertical : Qt.Horizontal
anchors.fill: parent
}
Button{
id:btn_start
height: vertical ? 20 : 40
width: vertical ? 40 : 20
anchors{
left: vertical ? undefined : parent.left
leftMargin: vertical ? undefined : 2
verticalCenter: vertical ? undefined : parent.verticalCenter
horizontalCenter: !vertical ? undefined : parent.horizontalCenter
top: !vertical ? undefined :parent.top
topMargin: !vertical ? undefined :2
}
background: Rectangle{
radius: 4
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,0.97) : Qt.rgba(237/255,237/255,237/255,0.97)
}
contentItem:FluIcon{
iconSource: vertical ? FluentIcons.CaretUpSolid8 : FluentIcons.CaretLeftSolid8
width: 10
height: 10
iconSize: 10
iconColor: btn_start.hovered ? FluColors.Grey220 : FluColors.Grey120
anchors.centerIn: parent
}
visible: swipe.currentIndex !==0
onClicked: {
swipe.currentIndex = Math.max(swipe.currentIndex - 1, 0)
}
}
Button{
id:btn_end
height: vertical ? 20 : 40
width: vertical ? 40 : 20
anchors{
right: vertical ? undefined : parent.right
rightMargin: vertical ? undefined : 2
verticalCenter: vertical ? undefined : parent.verticalCenter
horizontalCenter: !vertical ? undefined : parent.horizontalCenter
bottom: !vertical ? undefined :parent.bottom
bottomMargin: !vertical ? undefined :2
}
background: Rectangle{
radius: 4
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,0.97) : Qt.rgba(237/255,237/255,237/255,0.97)
}
visible: swipe.currentIndex !== swipe.count - 1
contentItem:FluIcon{
iconSource: vertical ? FluentIcons.CaretDownSolid8 : FluentIcons.CaretRightSolid8
width: 10
height: 10
iconSize: 10
iconColor: btn_end.hovered ? FluColors.Grey220 : FluColors.Grey120
anchors.centerIn: parent
}
onClicked: {
swipe.currentIndex = Math.min(swipe.currentIndex + 1,swipe.count-1)
}
}
}

View File

@ -17,7 +17,7 @@ Button {
}
return hovered ? hoverColor : normalColor
}
property color textColor: {
property color iconColor: {
if(FluTheme.dark){
if(disabled){
return Qt.rgba(130/255,130/255,130/255,1)
@ -57,7 +57,7 @@ Button {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.centerIn: parent
color:control.textColor
color:control.iconColor
text: (String.fromCharCode(iconSource).toString(16));
}
FluTooltip{

View File

@ -121,7 +121,6 @@ Rectangle {
text: formatDuration(slider.value*mediaplayer.duration/slider.maxValue)
}
FluText{
id:end_time
anchors{
@ -132,7 +131,6 @@ Rectangle {
text: formatDuration(mediaplayer.duration)
}
Row{
spacing: 10
anchors{

View File

@ -7,31 +7,32 @@ TextArea{
property int fontStyle: FluText.Body
property int pixelSize : FluTheme.textSize
property bool disabled: false
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
id:input
id:control
width: 300
enabled: !disabled
color: {
if(disabled){
return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
return disableColor
}
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
return normalColor
}
enabled: !disabled
wrapMode: Text.WrapAnywhere
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectByMouse: true
selectionColor: FluTheme.primaryColor.lightest
background: FluTextBoxBackground{
inputItem: input
}
placeholderTextColor: {
if(disabled){
return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
return placeholderDisableColor
}
if(focus){
return FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
return placeholderFocusColor
}
return FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
return placeholderNormalColor
}
font.bold: {
switch (fontStyle) {
@ -73,40 +74,15 @@ TextArea{
return text.pixelSize * 1.0
}
}
selectByMouse: true
background: FluTextBoxBackground{ inputItem: control }
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: input.echoMode !== TextInput.Password && menu.popup()
onTapped: control.echoMode !== TextInput.Password && menu.popup()
}
FluMenu{
FluTextBoxMenu{
id:menu
focus: false
FluMenuItem{
text: "剪切"
visible: input.text !== ""
onClicked: {
input.cut()
}
}
FluMenuItem{
text: "复制"
visible: input.selectedText !== ""
onClicked: {
input.copy()
}
}
FluMenuItem{
text: "粘贴"
visible: input.canPaste
onClicked: {
input.paste()
}
}
FluMenuItem{
text: "全选"
visible: input.text !== ""
onClicked: {
input.selectAll()
}
}
inputItem: control
}
}

View File

@ -227,16 +227,6 @@ Item {
leftMargin: 6
rightMargin: 6
}
Rectangle{
width: 3
height: 18
radius: 1.5
color: FluTheme.primaryColor.dark
visible: nav_list.currentIndex === position && type===0
anchors{
verticalCenter: parent.verticalCenter
}
}
MouseArea{
id:item_mouse
hoverEnabled: true
@ -468,8 +458,21 @@ Item {
stackIndex.push(currentIndex)
}
}
highlight: Item{
clip: true
Rectangle{
height: 18
radius: 1.5
color: FluTheme.primaryColor.dark
width: 3
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 6
}
}
}
ScrollBar.vertical: FluScrollBar {}
model:handleItems()
delegate: Loader{
property var model: modelData

View File

@ -5,6 +5,7 @@ QtObject {
readonly property string key : FluApp.uuid()
readonly property int flag : 0
property string title
property int order : 0
property int icon
property bool recentlyAdded: false
property bool recentlyUpdated: false

104
src/controls/FluPivot.qml Normal file
View File

@ -0,0 +1,104 @@
import QtQuick
import QtQuick.Controls
import FluentUI
Item {
id:control
default property alias content: d.children
property color normalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
property color hoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
width: 400
height: 300
implicitHeight: height
implicitWidth: width
MouseArea{
anchors.fill: parent
preventStealing: true
}
FluObject{
id:d
}
ListView{
id:nav_list
height: 40
width: control.width
model:d.children
clip: true
spacing: 20
interactive: false
orientation:ListView.Horizontal
highlight: Item{
clip: true
Rectangle{
height: 3
radius: 1.5
color: FluTheme.primaryColor.dark
width: nav_list.currentItem ? nav_list.currentItem.width : 0
y:37
Behavior on width {
NumberAnimation{
duration: 150
}
}
}
}
delegate: Button{
id:item_button
width: item_title.width
height: nav_list.height
background:Item{
}
contentItem: Item{
FluText {
id:item_title
fontStyle: FluText.Title
font.bold: false
text: modelData.title
anchors.centerIn: parent
color: {
if(item_button.hovered)
return hoverColor
return normalColor
}
}
transitions: Transition {
NumberAnimation{
duration: 400;
}
}
}
onClicked: {
nav_list.currentIndex = index
}
}
}
Item{
id:container
anchors{
top: nav_list.bottom
topMargin: 10
left: parent.left
right: parent.right
bottom: parent.bottom
}
Repeater{
model:d.children
Loader{
property var argument: modelData.argument
anchors.fill: parent
sourceComponent: modelData.contentItem
visible: nav_list.currentIndex === index
}
}
}
}

View File

@ -0,0 +1,8 @@
import QtQuick
import FluentUI
QtObject {
property string title
property Component contentItem
property var argument
}

View File

@ -1,34 +1,133 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.impl 2.15
import QtQuick.Templates 2.15 as T
import FluentUI
T.ScrollBar {
ScrollBar {
id: control
property color handleNormalColor: Qt.rgba(134/255,134/255,134/255,1)
property color handleHoverColor: Qt.lighter(handleNormalColor)
property color handlePressColor: Qt.darker(handleNormalColor)
property bool expand: false
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
padding: 4
visible: control.policy !== T.ScrollBar.AlwaysOff
visible: control.policy !== ScrollBar.AlwaysOff
minimumSize: 0.3
topPadding:{
if(vertical){
if(expand)
return 15
return 2
}else{
if(expand){
return 2
}
return 4
}
}
bottomPadding:{
if(vertical){
if(expand)
return 15
return 2
}else{
if(expand){
return 2
}
return 4
}
}
leftPadding:{
if(vertical){
if(expand){
return 2
}
return 4
}else{
if(expand)
return 15
return 2
}
}
rightPadding:{
if(vertical){
if(expand){
return 2
}
return 4
}else{
if(expand)
return 15
return 2
}
}
Behavior on topPadding {
NumberAnimation{
duration: 150
}
}
Behavior on bottomPadding {
NumberAnimation{
duration: 150
}
}
Behavior on leftPadding {
NumberAnimation{
duration: 150
}
}
Behavior on rightPadding {
NumberAnimation{
duration: 150
}
}
contentItem: Rectangle {
implicitWidth: hovered || pressed ? 6 : 2
implicitHeight: hovered || pressed ? 6 : 2
id:item_react
implicitWidth: expand ? 8 : 2
implicitHeight: expand ? 8 : 2
radius: width / 2
layer.samples: 4
layer.enabled: true
layer.smooth: true
color: control.pressed?handlePressColor:control.hovered?handleHoverColor:handleNormalColor
opacity:(control.policy === T.ScrollBar.AlwaysOn || control.size < 1.0)?1.0:0.0
opacity:(control.policy === ScrollBar.AlwaysOn || control.size < 1.0)?1.0:0.0
}
background: Rectangle{
radius: 5
color: {
if(expand && item_react.opacity){
if(FluTheme.dark){
return Qt.rgba(0,0,0,1)
}
return Qt.rgba(1,1,1,1)
}
return Qt.rgba(0,0,0,0)
}
MouseArea{
id:mouse_item
hoverEnabled: true
anchors.fill: parent
onEntered: {
timer.restart()
console.debug("onEntered")
}
onExited: {
timer.restart()
console.debug("onExited")
}
}
}
Timer{
id:timer
interval: 800
onTriggered: {
expand = mouse_item.containsMouse || btn_top.hovered || btn_bottom.hovered || btn_left.hovered || btn_right.hovered
}
}
Behavior on implicitWidth {
NumberAnimation{
@ -36,4 +135,66 @@ T.ScrollBar {
}
}
FluIconButton{
id:btn_top
iconSource: FluentIcons.CaretSolidUp
anchors.horizontalCenter: parent.horizontalCenter
width:10
height:10
z:100
iconColor: hovered ? FluColors.Black : FluColors.Grey120
iconSize: 8
anchors.top: parent.top
anchors.topMargin: 4
visible:vertical && expand
onClicked:{
decrease()
}
}
FluIconButton{
id:btn_bottom
iconSource: FluentIcons.CaretSolidDown
visible:vertical && expand
width:10
height:10
iconSize: 8
iconColor: hovered ? FluColors.Black : FluColors.Grey120
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 4
onClicked:{
increase()
}
}
FluIconButton{
id:btn_left
iconSource: FluentIcons.CaretSolidLeft
visible:!vertical && expand
width:10
height:10
iconSize: 8
iconColor: hovered ? FluColors.Black : FluColors.Grey120
anchors.leftMargin: 4
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
onClicked:{
decrease()
}
}
FluIconButton{
id:btn_right
iconSource: FluentIcons.CaretSolidRight
visible:!vertical && expand
width:10
height:10
iconSize: 8
iconColor: hovered ? FluColors.Black : FluColors.Grey120
anchors.rightMargin: 4
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
onClicked:{
increase()
}
}
}

View File

@ -131,7 +131,7 @@ Item {
drag.target: item_container
drag.axis: Drag.XAxis
onWheel: {
onWheel: (wheel)=>{
if (wheel.angleDelta.y > 0) scroll_nav.decrease()
else scroll_nav.increase()
}
@ -198,7 +198,7 @@ Item {
}
}
function updatePosition(pos){
var idx = tab_nav.indexAt(pos.x+tab_nav.contentX, pos.y)
var idx = tab_nav.indexAt(pos.x+tab_nav.contentX+1, pos.y)
var firstIdx = tab_nav.indexAt(tab_nav.contentX+1, pos.y)
var lastIdx = tab_nav.indexAt(tab_nav.width+tab_nav.contentX-1, pos.y)
if(lastIdx === -1){

View File

@ -7,26 +7,32 @@ TextField{
property int fontStyle: FluText.Body
property int pixelSize : FluTheme.textSize
property bool disabled: false
property int iconSource: 0
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
id:input
id:control
width: 300
enabled: !disabled
color: {
if(disabled){
return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
return disableColor
}
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
return normalColor
}
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTheme.primaryColor.lightest
placeholderTextColor: {
if(disabled){
return FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
return placeholderDisableColor
}
if(focus){
return FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
return placeholderFocusColor
}
return FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
return placeholderNormalColor
}
font.bold: {
switch (fontStyle) {
@ -69,44 +75,45 @@ TextField{
}
}
selectByMouse: true
rightPadding: icon_end.visible ? 50 : 30
background: FluTextBoxBackground{
inputItem: input
inputItem: control
FluIcon{
id:icon_end
iconSource: control.iconSource
iconSize: 15
opacity: 0.5
visible: control.iconSource != 0
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 5
}
}
}
FluIconButton{
iconSource:FluentIcons.ChromeClose
iconSize: 10
width: 20
height: 20
opacity: 0.5
visible: control.text !== ""
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: icon_end.visible ? 25 : 5
}
onClicked:{
control.text = ""
}
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: input.echoMode !== TextInput.Password && menu.popup()
onTapped: control.echoMode !== TextInput.Password && menu.popup()
}
FluMenu{
FluTextBoxMenu{
id:menu
focus: false
FluMenuItem{
text: "剪切"
visible: input.text !== ""
onClicked: {
input.cut()
}
}
FluMenuItem{
text: "复制"
visible: input.selectedText !== ""
onClicked: {
input.copy()
}
}
FluMenuItem{
text: "粘贴"
visible: input.canPaste
onClicked: {
input.paste()
}
}
FluMenuItem{
text: "全选"
visible: input.text !== ""
onClicked: {
input.selectAll()
}
}
inputItem: control
}
}

View File

@ -0,0 +1,40 @@
import QtQuick
import FluentUI
FluMenu{
property string cutText : "剪切"
property string copyText : "复制"
property string pasteText : "粘贴"
property string selectAllText : "全选"
property var inputItem
id:menu
focus: false
FluMenuItem{
text: cutText
visible: inputItem.text !== ""
onClicked: {
inputItem.cut()
}
}
FluMenuItem{
text: copyText
visible: inputItem.selectedText !== ""
onClicked: {
inputItem.copy()
}
}
FluMenuItem{
text: pasteText
visible: inputItem.canPaste
onClicked: {
inputItem.paste()
}
}
FluMenuItem{
text: selectAllText
visible: inputItem.text !== ""
onClicked: {
inputItem.selectAll()
}
}
}

View File

@ -1,4 +1,4 @@
<RCC>
<RCC>
<qresource prefix="/com.zhuzichu">
<file>controls/FluButton.qml</file>
<file>controls/FluFilledButton.qml</file>
@ -23,7 +23,6 @@
<file>controls/FluDivider.qml</file>
<file>controls/FluTooltip.qml</file>
<file>controls/FluTextBoxBackground.qml</file>
<file>controls/FluMultiLineTextBox.qml</file>
<file>controls/FluWindowResize.qml</file>
<file>controls/FluScrollBar.qml</file>
<file>controls/FluMenu.qml</file>
@ -60,5 +59,10 @@
<file>controls/FluTabView.qml</file>
<file>controls/FluItem.qml</file>
<file>controls/FluPaneItemExpander.qml</file>
<file>controls/FluTextBoxMenu.qml</file>
<file>controls/FluMultilineTextBox.qml</file>
<file>controls/FluFlipView.qml</file>
<file>controls/FluPivot.qml</file>
<file>controls/FluPivotItem.qml</file>
</qresource>
</RCC>