Compare commits

..

112 Commits
1.0.6 ... 1.1.5

Author SHA1 Message Date
ff4ec71379 update 2023-03-29 18:10:34 +08:00
76ed63eaf0 Merge branch 'main' of https://github.com/zhuzichu520/FluentUI 2023-03-29 15:44:39 +08:00
825a6f4461 update 2023-03-29 15:44:36 +08:00
98f4d970c6 update 2023-03-29 15:43:23 +08:00
38f4ae92db update 2023-03-28 22:41:43 +08:00
2e31ab902d update 2023-03-28 21:56:36 +08:00
850a1ba8d8 update 2023-03-28 21:53:55 +08:00
a298f43388 update 2023-03-28 21:37:10 +08:00
b70a982586 update 2023-03-28 18:14:14 +08:00
6a2a93561a update 2023-03-28 17:53:46 +08:00
96ad06c2e4 update 2023-03-28 13:10:30 +08:00
e7f6ad8b26 update 2023-03-28 13:01:28 +08:00
6174cbc2a4 update 2023-03-28 12:52:35 +08:00
e5bdd36e27 update 2023-03-28 12:37:03 +08:00
038cc37c12 update 2023-03-28 11:53:25 +08:00
f0f58ca2dd update 2023-03-27 22:58:33 +08:00
3a32d66d6a update 2023-03-27 18:24:35 +08:00
a2c23231f2 update 2023-03-25 23:28:48 +08:00
dae49a5bfc update 2023-03-25 22:46:15 +08:00
5e61af99ba update 2023-03-25 20:45:33 +08:00
e2d72d4510 update 2023-03-25 19:38:36 +08:00
fcdb05b7d1 update 2023-03-25 14:23:16 +08:00
a59010ec72 update 2023-03-25 13:35:21 +08:00
36d7c714a5 update 2023-03-25 12:41:56 +08:00
2f95bdf649 update 2023-03-25 12:21:00 +08:00
faa6c625cb update 2023-03-25 12:14:45 +08:00
0176f14469 update 2023-03-25 12:04:10 +08:00
128869f46e update 2023-03-25 11:54:07 +08:00
14ceb3a4c6 update 2023-03-25 11:49:12 +08:00
a1d8581768 update 2023-03-25 11:34:26 +08:00
e7146bf2ca update 2023-03-25 11:15:29 +08:00
432023aee3 update 2023-03-25 10:49:31 +08:00
a1959641c2 update 2023-03-25 10:47:42 +08:00
0f7c5f4ff5 update 2023-03-25 10:31:12 +08:00
b6befc4416 update 2023-03-25 01:14:23 +08:00
901c83e499 update 2023-03-25 00:56:30 +08:00
7e60bfd37f update 2023-03-25 00:52:37 +08:00
d2e1a6fef9 update 2023-03-25 00:46:07 +08:00
ffd7d3bce5 update 2023-03-25 00:41:40 +08:00
424a6137c5 update 2023-03-25 00:36:31 +08:00
57d453d574 update 2023-03-25 00:33:36 +08:00
697c379ee1 update 2023-03-25 00:31:23 +08:00
f5adefb0f1 update 2023-03-25 00:28:39 +08:00
00f08eaf99 update 2023-03-25 00:25:12 +08:00
795fc26777 update 2023-03-25 00:21:07 +08:00
603bab5d93 update 2023-03-25 00:15:20 +08:00
d570acf5a7 update 2023-03-25 00:11:48 +08:00
758f8ccb9c update 2023-03-25 00:03:11 +08:00
dfd8ef875c update 2023-03-25 00:00:50 +08:00
8b156699fb update 2023-03-24 23:56:45 +08:00
183f105776 update 2023-03-24 23:52:51 +08:00
162c4851ea update 2023-03-24 23:49:27 +08:00
6f38bb9985 update 2023-03-24 23:44:38 +08:00
30b8c19f52 update 2023-03-24 23:37:04 +08:00
64d636d391 update 2023-03-24 23:31:54 +08:00
4ba19a5bf2 update 2023-03-24 23:21:42 +08:00
3c978f1655 update 2023-03-24 23:18:33 +08:00
592abd3cab update 2023-03-24 22:22:31 +08:00
8b0a0c7c98 update 2023-03-24 22:13:41 +08:00
09bf3cf0ab update 2023-03-24 21:52:37 +08:00
753d1cdd30 update 2023-03-24 21:40:31 +08:00
11cd46ba18 update 2023-03-24 21:34:07 +08:00
587b422275 update 2023-03-24 21:19:15 +08:00
fb68455ded update 2023-03-24 20:52:59 +08:00
d2d2e97d28 update 2023-03-24 20:44:38 +08:00
6d809efd4b update 2023-03-24 18:25:13 +08:00
d8d95399cd update 2023-03-24 15:21:47 +08:00
1f1e8b0ed0 update 2023-03-24 14:16:35 +08:00
a3fb672cc7 update 2023-03-24 14:15:06 +08:00
f20dc1edcb update 2023-03-23 18:05:42 +08:00
bfaffd3dab update 2023-03-23 17:52:08 +08:00
2c63eb21f0 update 2023-03-23 17:46:53 +08:00
f4e5316987 update 2023-03-23 17:40:10 +08:00
d3d6e64af1 update 2023-03-22 12:10:19 +08:00
82a7aa167a update 2023-03-22 11:54:19 +08:00
83f97159e9 update 2023-03-21 23:52:29 +08:00
5fcd95611f update 2023-03-21 18:19:46 +08:00
b83e70ba24 update 2023-03-20 21:28:12 +08:00
e29cb7433e update 2023-03-20 18:22:32 +08:00
9545175445 update 2023-03-18 22:52:24 +08:00
a447b260e7 update 2023-03-18 20:41:21 +08:00
8eb7e1df4a update 2023-03-18 20:20:59 +08:00
c622f80659 update 2023-03-18 01:25:49 +08:00
c0ed9cb41c update 2023-03-18 01:18:13 +08:00
e5a24ec642 update 2023-03-18 00:53:06 +08:00
6553584c3d update 2023-03-18 00:50:09 +08:00
1ea043ee13 update 2023-03-18 00:39:08 +08:00
0d6b0d9d25 update 2023-03-17 23:33:02 +08:00
5f71ad57d0 update 2023-03-17 23:03:46 +08:00
c789d53d6a update 2023-03-17 23:01:48 +08:00
f2bbbd5250 update 2023-03-17 22:59:21 +08:00
4e95923847 update 2023-03-17 17:56:50 +08:00
5fadb582c9 update 2023-03-17 14:33:46 +08:00
6b54401371 update 2023-03-17 14:29:13 +08:00
28b65e2f33 update 2023-03-17 14:09:16 +08:00
0689c3b9d9 Merge branch 'main' of https://github.com/zhuzichu520/FluentUI 2023-03-17 14:05:42 +08:00
9c121c6ba9 update 2023-03-17 14:05:27 +08:00
f2a66221e6 updaet 2023-03-16 22:06:08 +08:00
2de9d78f41 update 2023-03-16 18:11:03 +08:00
96355b0a97 update 2023-03-16 14:34:20 +08:00
47597471dd Merge branch 'main' of https://github.com/zhuzichu520/FluentUI 2023-03-15 20:40:30 +08:00
184f52c896 update 2023-03-15 20:40:09 +08:00
31b2b0b004 update 2023-03-15 18:45:14 +08:00
1e4f939de7 update 2023-03-15 14:49:33 +08:00
926132a285 update 2023-03-15 14:48:48 +08:00
9e245fb533 update 2023-03-15 00:36:49 +08:00
8bfbfd63fb update 2023-03-15 00:33:38 +08:00
51a206e583 update 2023-03-14 18:23:12 +08:00
ee3ddf7732 update 2023-03-13 21:32:29 +08:00
6d238871ee update 2023-03-13 21:28:35 +08:00
9d3de073c0 update 2023-03-13 21:18:51 +08:00
7282a6f8d1 update 2023-03-13 18:23:46 +08:00
237 changed files with 4790 additions and 811 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -16,7 +16,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-10.15,macos-11.0]
os: [macos-11.0]
qt_ver: [5.15.2]
qt_arch: [clang_64]
env:

View File

@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04,ubuntu-20.04]
os: [ubuntu-20.04]
qt_ver: [5.15.2]
qt_arch: [gcc_64]
env:

View File

@ -1,87 +0,0 @@
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-2019
strategy:
matrix:
include:
- qt_arch: win32_mingw81
qt_ver: 5.15.2
qt_tools: "tools_mingw,8.1.0-1-202004170606,qt.tools.win32_mingw810"
qt_tools_mingw_install: mingw810_32
- qt_arch: win64_mingw81
qt_ver: 5.15.2
qt_tools: "tools_mingw,8.1.0-1-202004170606,qt.tools.win64_mingw810"
qt_tools_mingw_install: mingw810_64
env:
targetName: example.exe
fileName: example
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ matrix.qt_ver }}
aqtversion: '==2.0.5'
arch: ${{ matrix.qt_arch }}
tools: ${{ matrix.qt_tools }}
cached: 'false'
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Qt 5 environment configuration
if: ${{ startsWith( matrix.qt_ver, 5 ) }}
shell: pwsh
run: |
Write-Output "${{ env.Qt5_DIR }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Write-Output "${{ env.Qt5_DIR }}/../../Tools/${{ matrix.qt_tools_mingw_install }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Qt 6 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_ver }}-${{ matrix.qt_arch }}
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: ${{ steps.package.outputs.packageName }}.zip
tag: ${{ github.ref }}
overwrite: true

View File

@ -67,7 +67,7 @@ jobs:
- name: package
id: package
env:
archiveName: ${{ env.fileName }}-${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
archiveName: ${{ env.fileName }}-${{ matrix.qt_arch }}-${{ matrix.qt_ver }}
msvcArch: ${{ matrix.msvc_arch }}
shell: pwsh
run: |

11
.gitignore vendored
View File

@ -1,14 +1,3 @@
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug

View File

@ -57,12 +57,21 @@
|FluTooltip|tooltip提示框||
|FluTreeView|树控件||
|FluTheme|主题设置|支持主题颜色切换,夜间模式|
|FluCarousel|轮播图组件|支持无限轮播|
|FluTimePicker|时间选择器||
|FluDatePicker|日期选择器||
|FluMenu|菜单Popup||
|FluNavigationView|响应式导航布局||
# 部分效果预览
## 主页
## 一个聊天Demo调用了ChatGPT的接口
![](doc/preview/main.png)
![](doc/preview/chatgpt.png)
## 各种Button按钮
![](doc/preview/buttons.png)
## 主题颜色切换、夜间模式
@ -72,10 +81,17 @@
![](doc/preview/treeview.png)
## Toast组件
## 轮播图组件
![](doc/preview/carousel.png)
## InfoBar提示框组件
![](doc/preview/infobar.png)
## Rectangle组件
## 多窗口路由跳转
![](doc/preview/rectangle.png)
![](doc/preview/multiwindow.png)
### ⚡ Visitor count
![](https://profile-counter.glitch.me/zhuzichu520-FluentUI/count.svg)

BIN
doc/preview/buttons.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
doc/preview/carousel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

BIN
doc/preview/chatgpt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

BIN
doc/preview/multiwindow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 703 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -10,11 +10,13 @@ Window {
color: "#00000000"
Component.onCompleted: {
FluApp.init(app,properties)
FluTheme.isDark = false
FluTheme.frameless = ("windows" === Qt.platform.os)
FluTheme.dark = false
FluApp.routes = {
"/":"qrc:/MainPage.qml",
"/Setting":"qrc:/SettingPage.qml",
"/About":"qrc:/AboutPage.qml",
"/":"qrc:/page/MainPage.qml",
"/about":"qrc:/page/AboutPage.qml",
"/login":"qrc:/page/LoginPage.qml",
"/chat":"qrc:/page/ChatPage.qml",
}
FluApp.initialRoute = "/"
FluApp.run()

View File

@ -0,0 +1,56 @@
#include "ChatController.h"
ChatController::ChatController(QObject *parent)
: QObject{parent}
{
isLoading(false);
networkManager = new QNetworkAccessManager(this);
}
void ChatController::sendMessage(const QString& text){
isLoading(true);
QUrl apiUrl("https://api.openai.com/v1/chat/completions");
QNetworkRequest request(apiUrl);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
request.setRawHeader("Authorization", QString::fromStdString("Bearer %1").arg(QString::fromUtf8(QByteArray::fromBase64(baseKey.toUtf8()))).toUtf8());
QJsonObject requestData;
requestData.insert("model", "gpt-3.5-turbo");
messages.append(createMessage("user",text));
requestData.insert("messages", messages);
QJsonDocument requestDoc(requestData);
QByteArray requestDataBytes = requestDoc.toJson();
QNetworkReply* reply = networkManager->post(request, requestDataBytes);
connect(reply, &QNetworkReply::finished,this, [=]() {
if (reply->error() == QNetworkReply::NoError) {
QString responseString = QString::fromUtf8(reply->readAll());
qDebug() << responseString;
QJsonDocument doc = QJsonDocument::fromJson(responseString.toUtf8());
QJsonObject jsonObj = doc.object();
QString text = jsonObj.value("choices").toArray().at(0).toObject().value("message").toObject().value("content").toString();
if(text.isEmpty()){
text = "响应错误content为空数据";
}else{
messages.append(createMessage("assistant",text));
}
responseData(text.trimmed());
} else {
responseData("网络错误:"+reply->errorString());
}
isLoading(false);
reply->deleteLater();
});
}
QJsonObject ChatController::createMessage(const QString& role,const QString& content){
QJsonObject message;
message.insert("role",role);
message.insert("content",content);
return message;
}
void ChatController::clipText(const QString& text){
qDebug()<<text;
QClipboard *clipboard = QGuiApplication::clipboard();
clipboard->setText(text);
}

35
example/ChatController.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef CHATCONTROLLER_H
#define CHATCONTROLLER_H
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>
#include <QGuiApplication>
#include <QClipboard>
#include <QByteArray>
#include <QFile>
#include "stdafx.h"
class ChatController : public QObject
{
Q_OBJECT
Q_PROPERTY_AUTO(bool,isLoading)
Q_PROPERTY_AUTO(QString,responseData);
public:
explicit ChatController(QObject *parent = nullptr);
Q_INVOKABLE void sendMessage(const QString& text);
Q_INVOKABLE void clipText(const QString& text);
private:
QJsonObject createMessage(const QString& role,const QString& content);
private:
QNetworkAccessManager* networkManager;
QJsonArray messages;
QString baseKey = "c2stbXgxWm5MQkZ5TzhNYzNmRWl6eDZUM0JsYmtGSnNBWjNiakJjSXB6WGN3QW9KSk11";
};
#endif // CHATCONTROLLER_H

29
example/Info.plist Normal file
View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleExecutable</key>
<string>example</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.zhuzichu.example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>

View File

@ -1,29 +0,0 @@
import QtQuick 2.15
import FluentUI 1.0
FluWindow {
width: 500
height: 600
title:"设置"
FluAppBar{
id:appbar
title:"设置"
}
FluText{
text:"设置"
fontStyle: FluText.Display
anchors.centerIn: parent
MouseArea{
anchors.fill: parent
onClicked: {
FluApp.navigate("/About")
}
}
}
}

View File

@ -8,6 +8,10 @@ FluContentPage {
title:"Awesome"
leftPadding:10
rightPadding:10
bottomPadding:20
FluTextBox{
id:text_box
placeholderText: "请输入关键字"

104
example/T_Badge.qml Normal file
View File

@ -0,0 +1,104 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Badge"
leftPadding:10
rightPadding:10
bottomPadding:20
FluArea{
width: parent.width
Layout.topMargin: 20
height: 106
paddings: 10
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text:"一般出现在通知图标或头像的右上角,用于显示需要处理的消息条数"
}
Row{
spacing: 20
Rectangle{
width: 40
height: 40
radius: 8
color: Qt.rgba(191/255,191/255,191/255,1)
FluBadge{
count:0
}
}
Rectangle{
width: 40
height: 40
radius: 8
color: Qt.rgba(191/255,191/255,191/255,1)
FluBadge{
count:5
}
}
Rectangle{
width: 40
height: 40
radius: 8
color: Qt.rgba(191/255,191/255,191/255,1)
FluBadge{
count:50
}
}
Rectangle{
width: 40
height: 40
radius: 8
color: Qt.rgba(191/255,191/255,191/255,1)
FluBadge{
count:100
}
}
Rectangle{
width: 40
height: 40
radius: 8
color: Qt.rgba(191/255,191/255,191/255,1)
FluBadge{
isDot:true
}
}
Rectangle{
width: 40
height: 40
radius: 8
color: Qt.rgba(191/255,191/255,191/255,1)
FluBadge{
count:99
color: Qt.rgba(250/255,173/255,20/255,1)
}
}
Rectangle{
width: 40
height: 40
radius: 8
color: Qt.rgba(191/255,191/255,191/255,1)
FluBadge{
count:99
color: Qt.rgba(82/255,196/255,26/255,1)
}
}
}
}
}
}

View File

@ -9,11 +9,47 @@ FluScrollablePage{
spacing: 20
leftPadding:10
rightPadding:10
bottomPadding:20
FluText{
Layout.topMargin: 20
text:"支持Tab键切换焦点空格键执行点击事件"
}
FluArea{
width: parent.width
height: 68
paddings: 10
FluTextButton{
disabled:text_button_switch.selected
text:"Text Button"
onClicked: {
console.debug(Screen.devicePixelRatio)
showInfo("点击Text Button")
}
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
}
FluToggleSwitch{
id:text_button_switch
Layout.alignment: Qt.AlignRight
text:"Disabled"
}
}
}
FluArea{
width: parent.width
height: 68
@ -40,8 +76,6 @@ FluScrollablePage{
FluToggleSwitch{
id:button_switch
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
@ -73,8 +107,6 @@ FluScrollablePage{
FluToggleSwitch{
id:filled_button_switch
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
@ -108,8 +140,47 @@ FluScrollablePage{
FluToggleSwitch{
id:icon_button_switch
Layout.alignment: Qt.AlignRight
text:"Disabled"
}
FluText{
}
}
FluArea{
width: parent.width
height: 68
paddings: 10
FluDropDownButton{
disabled:drop_down_button_switch.selected
text:"DropDownButton"
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
items:[
FluMenuItem{
text:"Menu_1"
},
FluMenuItem{
text:"Menu_2"
},
FluMenuItem{
text:"Menu_3"
},
FluMenuItem{
text:"Menu_4"
}
]
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
}
FluToggleSwitch{
id:drop_down_button_switch
Layout.alignment: Qt.AlignRight
text:"Disabled"
}
}
@ -151,8 +222,6 @@ FluScrollablePage{
FluToggleSwitch{
id:radio_button_switch
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
@ -183,10 +252,10 @@ FluScrollablePage{
FluToggleSwitch{
id:check_box_switch
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
}
}

View File

@ -0,0 +1,38 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import FluentUI 1.0
FluScrollablePage{
title:"CalendarPicker"
leftPadding:10
rightPadding:10
bottomPadding:20
FluArea{
width: parent.width
Layout.topMargin: 20
height: 350
paddings: 10
FluCalendarView{
}
}
FluArea{
width: parent.width
Layout.topMargin: 20
height: 80
paddings: 10
ColumnLayout{
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluCalendarPicker{
}
}
}
}

39
example/T_Carousel.qml Normal file
View File

@ -0,0 +1,39 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Carousel"
leftPadding:10
rightPadding:10
bottomPadding:20
FluArea{
width: parent.width
height: 370
paddings: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left:parent.left
}
FluText{
text:"轮播图支持无限轮播无限滑动用ListView实现的组件"
}
FluCarousel{
id:carousel
Layout.topMargin: 20
Layout.leftMargin: 5
Component.onCompleted: {
carousel.setData([{url:"qrc:/res/image/banner_1.jpg"},{url:"qrc:/res/image/banner_2.jpg"},{url:"qrc:/res/image/banner_3.jpg"}])
}
}
}
}
}

19
example/T_CheckBox.qml Normal file
View File

@ -0,0 +1,19 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
FluScrollablePage{
title:"CheckBox"
leftPadding:10
rightPadding:10
bottomPadding:20
FluCheckBox{
Layout.topMargin: 20
Layout.leftMargin: 10
Layout.bottomMargin: 20
}
}

60
example/T_ColorPicker.qml Normal file
View File

@ -0,0 +1,60 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"ColorPicker"
leftPadding:10
rightPadding:10
bottomPadding:20
FluArea{
width: parent.width
height: 280
Layout.topMargin: 20
paddings: 10
ColumnLayout{
anchors{
verticalCenter: parent.verticalCenter
left:parent.left
}
FluText{
text:"此颜色组件是Github上的开源项目"
}
FluTextButton{
leftPadding: 0
rightPadding: 0
text:"https://github.com/rshest/qml-colorpicker"
onClicked: {
Qt.openUrlExternally(text)
}
}
FluColorView{
}
}
}
FluArea{
width: parent.width
Layout.topMargin: 20
height: 60
paddings: 10
RowLayout{
FluText{
text:"点击选择颜色->"
Layout.alignment: Qt.AlignVCenter
}
FluColorPicker{
}
}
}
}

View File

@ -7,7 +7,9 @@ import FluentUI 1.0
FluScrollablePage{
title:"TimePicker"
leftPadding:10
rightPadding:10
bottomPadding:20
FluArea{
width: parent.width

View File

@ -6,7 +6,11 @@ import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Dialog"
leftPadding:10
rightPadding:10
bottomPadding:20
FluContentDialog{
id:dialog

View File

@ -6,7 +6,11 @@ import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Expander"
leftPadding:10
rightPadding:10
bottomPadding:20
FluExpander{
headerText:"打开一个单选框"

295
example/T_Home.qml Normal file
View File

@ -0,0 +1,295 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
FluScrollablePage{
leftPadding:10
rightPadding:0
bottomPadding:20
ListModel{
id:model_header
ListElement{
icon:"qrc:/res/image/ic_home_github.png"
title:"FluentUI GitHub"
desc:"The latest FluentUI controls and styles for your applications."
url:"https://github.com/zhuzichu520/FluentUI"
}
}
Item{
Layout.fillWidth: true
height: 320
Image {
fillMode:Image.PreserveAspectCrop
anchors.fill: parent
verticalAlignment: Qt.AlignTop
source: "qrc:/res/image/bg_home_header.png"
}
Rectangle{
anchors.fill: parent
gradient: Gradient{
GradientStop { position: 0.8; color: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(1,1,1,0) }
GradientStop { position: 1.0; color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1) }
}
}
FluText{
text:"FluentUI Gallery"
fontStyle: FluText.TitleLarge
anchors{
top: parent.top
left: parent.left
topMargin: 20
leftMargin: 20
}
}
ListView{
anchors{
left: parent.left
right: parent.right
bottom: parent.bottom
}
orientation: ListView.Horizontal
boundsBehavior: ListView.StopAtBounds
height: 240
model: model_header
header: Item{height: 10;width: 10}
footer: Item{height: 10;width: 10}
ScrollBar.horizontal: FluScrollBar{
id: scrollbar_header
}
clip: false
delegate:Item{
width: 220
height: 240
FluArea{
radius: 8
width: 200
height: 220
anchors.centerIn: parent
Rectangle{
anchors.fill: parent
radius: 8
color:{
if(FluTheme.dark){
if(item_mouse.containsMouse){
return Qt.rgba(1,1,1,0.03)
}
return Qt.rgba(0,0,0,0)
}else{
if(item_mouse.containsMouse){
return Qt.rgba(0,0,0,0.03)
}
return Qt.rgba(0,0,0,0)
}
}
}
ColumnLayout{
Image {
Layout.topMargin: 20
Layout.leftMargin: 20
Layout.preferredWidth: 50
Layout.preferredHeight: 50
source: model.icon
}
FluText{
text: model.title
fontStyle: FluText.BodyLarge
Layout.topMargin: 20
Layout.leftMargin: 20
}
FluText{
text: model.desc
Layout.topMargin: 5
Layout.preferredWidth: 160
Layout.leftMargin: 20
color: FluColors.Grey100
font.pixelSize: 12
wrapMode: Text.WrapAnywhere
}
}
FluIcon{
iconSource: FluentIcons.OpenInNewWindow
iconSize: 15
anchors{
bottom: parent.bottom
right: parent.right
rightMargin: 10
bottomMargin: 10
}
}
MouseArea{
id:item_mouse
anchors.fill: parent
hoverEnabled: true
onWheel: {
if (wheel.angleDelta.y > 0) scrollbar_header.decrease()
else scrollbar_header.increase()
}
onClicked: {
Qt.openUrlExternally(model.url)
}
}
}
}
}
}
ListModel{
id:model_added
ListElement{
title:"TabView"
icon:"qrc:/res/image/control/TabView.png"
desc:"A control that displays a collection of tabs thatcan be used to display several documents."
}
ListElement{
title:"MediaPlayer"
icon:"qrc:/res/image/control/MediaPlayerElement.png"
desc:"A control to display video and image content"
}
}
ListModel{
id:model_update
ListElement{
title:"Buttons"
icon:"qrc:/res/image/control/Button.png"
desc:"A control that responds to user input and raisesa Click event."
}
ListElement{
title:"InfoBar"
icon:"qrc:/res/image/control/InfoBar.png"
desc:"An inline message to display app-wide statuschange information."
}
ListElement{
title:"Slider"
icon:"qrc:/res/image/control/Slider.png"
desc:"A control that lets the user select from a rangeof values by moving a Thumb control along atrack."
}
ListElement{
title:"CheckBox"
icon:"qrc:/res/image/control/Checkbox.png"
desc:"A control that a user can select or clear."
}
}
Component{
id:com_item
Item{
width: 320
height: 120
FluArea{
radius: 8
width: 300
height: 100
anchors.centerIn: parent
Rectangle{
anchors.fill: parent
radius: 8
color:{
if(FluTheme.dark){
if(item_mouse.containsMouse){
return Qt.rgba(1,1,1,0.03)
}
return Qt.rgba(0,0,0,0)
}else{
if(item_mouse.containsMouse){
return Qt.rgba(0,0,0,0.03)
}
return Qt.rgba(0,0,0,0)
}
}
}
Image{
id:item_icon
height: 40
width: 40
source: model.icon
anchors{
left: parent.left
leftMargin: 20
verticalCenter: parent.verticalCenter
}
}
FluText{
id:item_title
text:model.title
fontStyle: FluText.Subtitle
anchors{
left: item_icon.right
leftMargin: 20
top: item_icon.top
}
}
FluText{
id:item_desc
text:model.desc
color:FluColors.Grey100
wrapMode: Text.WrapAnywhere
elide: Text.ElideRight
maximumLineCount: 2
anchors{
left: item_title.left
right: parent.right
rightMargin: 20
top: item_title.bottom
topMargin: 5
}
}
MouseArea{
id:item_mouse
anchors.fill: parent
hoverEnabled: true
onClicked: {
rootwindow.startPageByTitle(model.title)
}
}
}
}
}
FluText{
text: "Recently added samples"
fontStyle: FluText.TitleLarge
Layout.topMargin: 20
Layout.leftMargin: 20
}
GridView{
Layout.fillWidth: true
implicitHeight: contentHeight
cellHeight: 120
cellWidth: 320
boundsBehavior: GridView.StopAtBounds
model:model_added
delegate: com_item
}
FluText{
text: "Recently updated samples"
fontStyle: FluText.TitleLarge
Layout.topMargin: 20
Layout.leftMargin: 20
}
GridView{
Layout.fillWidth: true
implicitHeight: contentHeight
cellHeight: 120
cellWidth: 320
boundsBehavior: GridView.StopAtBounds
model: model_update
delegate: com_item
}
}

View File

@ -6,7 +6,11 @@ import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"InfoBar"
leftPadding:10
rightPadding:10
bottomPadding:20
FluButton{
text:"Info"

46
example/T_MediaPlayer.qml Normal file
View File

@ -0,0 +1,46 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"MediaPlayer"
leftPadding:10
rightPadding:10
bottomPadding:20
onVisibleChanged: {
if(visible){
player.play()
}else{
player.pause()
}
}
FluArea{
width: parent.width
height: 320
Layout.topMargin: 20
paddings: 10
ColumnLayout{
anchors{
verticalCenter: parent.verticalCenter
left:parent.left
}
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"
}
}
}
}

55
example/T_Menu.qml Normal file
View File

@ -0,0 +1,55 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Menu"
leftPadding:10
rightPadding:10
bottomPadding:20
FluButton{
text:"左击菜单"
Layout.topMargin: 20
onClicked:{
menu.popup()
}
}
FluButton{
text:"右击菜单"
Layout.topMargin: 20
onClicked: {
showSuccess("请按鼠标右击")
}
MouseArea{
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: {
menu.popup()
}
}
}
FluMenu{
id:menu
FluMenuItem{
text:"删除"
onClicked: {
showError("删除")
}
}
FluMenuItem{
text:"修改"
onClicked: {
showError("修改")
}
}
}
}

80
example/T_MultiWindow.qml Normal file
View File

@ -0,0 +1,80 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
FluScrollablePage{
title:"MultiWindow"
leftPadding:10
rightPadding:10
bottomPadding:20
property string password: ""
property var loginPageRegister: registerForPageResult("/login")
Connections{
target: loginPageRegister
function onResult(data)
{
password = data.password
}
}
FluArea{
width: parent.width
height: 100
paddings: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text:"页面跳转,不携带任何参数"
}
FluButton{
text:"点击跳转"
onClicked: {
FluApp.navigate("/about")
}
}
}
}
FluArea{
width: parent.width
height: 130
paddings: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text:"页面跳转并携带参数用户名zhuzichu"
}
FluButton{
text:"点击跳转到登录"
onClicked: {
loginPageRegister.launch({username:"zhuzichu"})
}
}
FluText{
text:"登录窗口返回过来的密码->"+password
}
}
}
}

View File

@ -6,7 +6,11 @@ import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Progress"
leftPadding:10
rightPadding:10
bottomPadding:20
FluProgressBar{
Layout.topMargin: 20

View File

@ -6,7 +6,11 @@ import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Rectangle"
leftPadding:10
rightPadding:10
bottomPadding:20
RowLayout{
Layout.topMargin: 20

View File

@ -2,22 +2,25 @@
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Slider"
leftPadding:10
rightPadding:10
bottomPadding:20
FluSlider{
Layout.topMargin: 20
Layout.leftMargin: 15
value: 50
Layout.leftMargin: 10
}
FluSlider{
orientation:FluSlider.Vertical
Layout.topMargin: 20
Layout.leftMargin: 15
Layout.leftMargin: 10
Layout.bottomMargin: 20
value: 50
}
}

44
example/T_TabView.qml Normal file
View File

@ -0,0 +1,44 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import FluentUI 1.0
FluScrollablePage{
title:"TabView"
leftPadding:10
rightPadding:10
bottomPadding:20
Component{
id:com_page
Rectangle{
anchors.fill: parent
color: argument
}
}
Component.onCompleted: {
var colors = [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
for(var i =0;i<colors.length;i++){
tab_view.appendTab("","Document "+i,com_page,colors[i].dark)
}
}
FluArea{
width: parent.width
Layout.topMargin: 20
height: 400
paddings: 10
FluTabView{
id:tab_view
}
}
}

View File

@ -8,22 +8,34 @@ import FluentUI 1.0
FluScrollablePage{
title:"TextBox"
leftPadding:10
rightPadding:10
bottomPadding:20
FluTextBox{
Layout.topMargin: 20
placeholderText: "单行输入框"
Layout.preferredWidth: 300
disabled:toggle_switch.selected
}
FluMultiLineTextBox{
Layout.topMargin: 20
Layout.preferredWidth: 300
placeholderText: "多行输入框"
disabled:toggle_switch.selected
}
FluAutoSuggestBox{
Layout.topMargin: 20
values:generateRandomNames(100)
placeholderText: "AutoSuggestBox"
Layout.preferredWidth: 300
disabled:toggle_switch.selected
}
FluToggleSwitch{
id:toggle_switch
text:"Disabled"
Layout.topMargin: 20
}
function generateRandomNames(numNames) {

View File

@ -8,22 +8,25 @@ import FluentUI 1.0
FluScrollablePage{
title:"Theme"
leftPadding:10
rightPadding:10
bottomPadding:20
RowLayout{
Layout.topMargin: 20
Repeater{
model: [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
delegate: Rectangle{
delegate: FluRectangle{
width: 42
height: 42
radius: 4
radius: [4,4,4,4]
color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal
FluIcon {
anchors.centerIn: parent
iconSource: FluentIcons.AcceptMedium
iconSize: 15
visible: modelData === FluTheme.primaryColor
color: FluTheme.isDark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
}
MouseArea{
id:mouse_item
@ -41,19 +44,9 @@ FluScrollablePage{
Layout.topMargin: 20
}
FluToggleSwitch{
selected: FluTheme.isDark
selected: FluTheme.dark
clickFunc:function(){
FluTheme.isDark = !FluTheme.isDark
}
}
FluText{
text:"无边框"
Layout.topMargin: 20
}
FluToggleSwitch{
selected: FluTheme.isFrameless
clickFunc:function(){
FluTheme.isFrameless = !FluTheme.isFrameless
FluTheme.dark = !FluTheme.dark
}
}
FluText{
@ -61,9 +54,9 @@ FluScrollablePage{
Layout.topMargin: 20
}
FluToggleSwitch{
selected: FluTheme.isNativeText
selected: FluTheme.nativeText
clickFunc:function(){
FluTheme.isNativeText = !FluTheme.isNativeText
FluTheme.nativeText = !FluTheme.nativeText
}
}
}

View File

@ -7,7 +7,9 @@ import FluentUI 1.0
FluScrollablePage{
title:"TimePicker"
leftPadding:10
rightPadding:10
bottomPadding:20
FluArea{
width: parent.width

View File

@ -8,8 +8,15 @@ import FluentUI 1.0
FluScrollablePage{
title:"ToggleSwitch"
leftPadding:10
rightPadding:10
bottomPadding:20
FluToggleSwitch{
Layout.topMargin: 20
}
FluToggleSwitch{
Layout.topMargin: 20
text:"Disabled"
}
}

78
example/T_Tooltip.qml Normal file
View File

@ -0,0 +1,78 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Tooltip"
leftPadding:10
rightPadding:10
bottomPadding:20
FluText{
Layout.topMargin: 20
text:"鼠标悬停不动弹出Tooltip"
}
FluArea{
width: parent.width
Layout.topMargin: 20
height: 68
paddings: 10
Column{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text:"FluIconButton的text属性自带Tooltip效果"
}
FluIconButton{
iconSource:FluentIcons.ChromeCloseContrast
iconSize: 15
text:"删除"
onClicked:{
showSuccess("点击IconButton")
}
}
}
}
FluArea{
width: parent.width
Layout.topMargin: 20
height: 68
paddings: 10
Column{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text:"给一个Button添加Tooltip效果"
}
FluButton{
id:button_1
text:"删除"
onClicked:{
showSuccess("点击一个Button")
}
FluTooltip{
visible: button_1.hovered
text:button_1.text
delay: 1000
}
}
}
}
}

View File

@ -7,6 +7,9 @@ import FluentUI 1.0
FluContentPage {
title:"TreeView"
leftPadding:10
rightPadding:10
bottomPadding:20
function randomName() {
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]

View File

@ -7,6 +7,13 @@ FluContentPage {
title: "Typography"
property int textSize: 13
leftPadding:10
rightPadding:10
bottomPadding:20
Component.onCompleted: {
slider.seek(31)
}
ScrollView{
clip: true
@ -68,17 +75,17 @@ FluContentPage {
FluSlider{
id:slider
orientation:FluSlider.Vertical
anchors{
right: parent.right
rightMargin: 30
rightMargin: 45
top: parent.top
topMargin: 30
}
onValueChanged:{
textSize = value/100*16+8
}
value: 31
}
}

View File

@ -1,24 +1,49 @@
QT += quick concurrent
QT += quick concurrent network multimedia
CONFIG += c++11
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
HEADERS += \
ChatController.h
SOURCES += \
ChatController.cpp \
main.cpp
RESOURCES += qml.qrc
#qnx: target.path = /tmp/$${TARGET}/bin
#else: unix:!android: target.path = /opt/$${TARGET}/bin
#!isEmpty(target.path): INSTALLS += target
RC_ICONS = favicon.ico
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
CONFIG(debug,debug|release) {
DESTDIR = $$absolute_path($${_PRO_FILE_PWD_}/../bin/debug)
} else {
DESTDIR = $$absolute_path($${_PRO_FILE_PWD_}/../bin/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
}
} 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
}
}
}
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
mac: {
QMAKE_INFO_PLIST = Info.plist
}

BIN
example/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

View File

@ -4,6 +4,7 @@
#include <QDir>
#include <QQuickWindow>
#include <QProcess>
#include "ChatController.h"
QMap<QString, QVariant> properties(){
QMap<QString, QVariant> map;
@ -20,6 +21,9 @@ int main(int argc, char *argv[])
// QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
QMapIterator<QString, QVariant> iterator(properties());
while (iterator.hasNext()) {
iterator.next();

View File

@ -1,4 +1,5 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import FluentUI 1.0
@ -34,7 +35,7 @@ FluWindow {
fontStyle: FluText.Title
}
FluText{
text:"v1.0.6"
text:"v1.1.5"
fontStyle: FluText.Body
Layout.alignment: Qt.AlignBottom
}
@ -69,7 +70,6 @@ FluWindow {
}
}
}
RowLayout{
spacing: 14
Layout.topMargin: 20
@ -78,22 +78,17 @@ FluWindow {
id:text_info
text:"如果该项目对你有作用就请点击上方链接给一个免费的star吧"
ColorAnimation {
id: animation
target: text_info
property: "color"
from: "red"
to: "blue"
duration: 1000
running: true
loops: Animation.Infinite
easing.type: Easing.InOutQuad
}
id: animation
target: text_info
property: "color"
from: "red"
to: "blue"
duration: 1000
running: true
loops: Animation.Infinite
easing.type: Easing.InOutQuad
}
}
}
}
}

261
example/page/ChatPage.qml Normal file
View File

@ -0,0 +1,261 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import Controller 1.0
import QtQuick.Dialogs 1.3
FluWindow {
width: 680
height: 600
minimumWidth: 500
minimumHeight: 600
title:"ChatGPT"
onInitArgument:
(argument)=>{
scrollview.focus = true
}
ChatController{
id:controller
onResponseDataChanged: {
appendMessage(false,responseData)
}
}
ListModel{
id:model_message
ListElement{
isMy:false
text:"欢迎使用ChatGPT"
}
ListElement{
isMy:true
text:"好的3Q"
}
}
FluAppBar{
id:appbar
title:"ChatGPT"
}
Component{
id:com_text
TextEdit {
id:item_text
text: message
wrapMode: Text.WrapAnywhere
readOnly: true
selectByMouse: true
selectByKeyboard: true
selectedTextColor: Qt.rgba(51,153,255,1)
color:FluColors.Black
selectionColor: {
if(FluTheme.dark){
return FluTheme.primaryColor.lighter
}else{
return FluTheme.primaryColor.dark
}
}
width: Math.min(list_message.width-200,600,implicitWidth)
TapHandler{
acceptedButtons: Qt.RightButton
onTapped: {
menu_item.showMenu(item_text.selectedText)
}
}
}
}
FluArea{
id:layout_content
anchors{
top: appbar.bottom
left: parent.left
right: parent.right
bottom: layout_bottom.top
margins: 10
}
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(245/255,245/255,245/255,1)
ListView{
id:list_message
anchors.fill: parent
model:model_message
clip: true
ScrollBar.vertical: FluScrollBar {}
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 0
header:Item{
width: list_message.width
height:20
}
footer:Item{
width: list_message.width
height:20
}
delegate: Item{
width: ListView.view.width
height: childrenRect.height
FluRectangle{
id:item_avatar
width: 30
height: 30
radius:[15,15,15,15]
anchors{
right: isMy ? parent.right : undefined
rightMargin: isMy ? 20 : undefined
left: isMy ? undefined : parent.left
leftMargin: isMy ? undefined : 20
top:parent.top
}
Image {
asynchronous: true
anchors.fill: parent
sourceSize: Qt.size(100,100)
source: isMy ? "qrc:/res/svg/avatar_2.svg" : "qrc:/res/image/logo_openai.png"
}
}
Rectangle{
id:item_layout_content
color: isMy ? "#FF95EC69" : "#FFFFFF"
width: item_msg_loader.width+10
height: item_msg_loader.height+10
radius: 3
anchors{
top: item_avatar.top
right: isMy ? item_avatar.left : undefined
rightMargin: isMy ? 10 : undefined
left: isMy ? undefined : item_avatar.right
leftMargin: isMy ? undefined : 10
}
Loader{
id:item_msg_loader
property var message: model.text
anchors.centerIn: parent
sourceComponent: com_text
}
}
Item{
id:item_layout_bottom
width: parent.width
anchors.top: item_layout_content.bottom
height: 20
}
}
}
}
FluArea{
id:layout_bottom
height: 90
anchors{
bottom: parent.bottom
bottomMargin: 10
left: parent.left
right: parent.right
leftMargin: 10
rightMargin: 10
}
ScrollView{
id:scrollview
anchors{
bottom: parent.bottom
left: parent.left
right: button_send.left
bottomMargin: 10
leftMargin: 10
rightMargin: 10
}
height: Math.min(textbox.implicitHeight,64)
FluMultiLineTextBox{
id:textbox
focus:true
placeholderText: "请输入消息"
}
}
FluFilledButton{
id:button_send
text:controller.isLoading ? timer_loading.loadingText :"发送"
anchors{
bottom: parent.bottom
right: parent.right
bottomMargin: 10
rightMargin: 10
}
width: 60
disabled: controller.isLoading
onClicked:{
var text = textbox.text
appendMessage(true,text)
controller.sendMessage(text)
textbox.clear()
}
Timer{
id:timer_loading
property int count : 0
property string loadingText : ""
interval: 500
running: controller.isLoading
repeat: true
onTriggered: {
switch(count%3){
case 0:
loadingText = "."
break
case 1:
loadingText = ".."
break
case 2:
loadingText = "..."
break
default:
loadingText = ""
break
}
count++
}
}
}
}
FluMenu{
id:menu_item
focus: false
property string selectedText: ""
FluMenuItem{
text:"复制"
onClicked: {
controller.clipText(menu_item.selectedText)
showSuccess("复制成功")
}
}
function showMenu(text){
menu_item.selectedText = text
menu_item.popup()
}
}
function appendMessage(isMy,text){
model_message.append({isMy:isMy,text:text})
list_message.positionViewAtEnd()
}
}

View File

@ -0,0 +1,72 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import FluentUI 1.0
FluWindow {
id:window
width: 400
height: 400
minimumWidth: 400
minimumHeight: 400
maximumWidth: 400
maximumHeight: 400
modality:2
title:"登录"
onInitArgument:
(argument)=>{
textbox_uesrname.text = argument.username
textbox_password.focus = true
}
FluAppBar{
id:appbar
title:"登录"
}
ColumnLayout{
anchors{
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
FluAutoSuggestBox{
id:textbox_uesrname
values:["Admin","User"]
placeholderText: "请输入账号"
Layout.preferredWidth: 260
Layout.alignment: Qt.AlignHCenter
}
FluTextBox{
id:textbox_password
Layout.topMargin: 20
Layout.preferredWidth: 260
placeholderText: "请输入密码"
echoMode:TextInput.Password
Layout.alignment: Qt.AlignHCenter
}
FluFilledButton{
text:"登录"
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 20
onClicked:{
if(textbox_password.text === ""){
showError("请随便输入一个密码")
return
}
onResult({password:textbox_password.text})
window.close()
}
}
}
}

View File

@ -8,21 +8,29 @@ import FluentUI 1.0
FluWindow {
id:rootwindow
width: 860
height: 680
width: 1000
height: 640
title: "FluentUI"
minimumWidth: 500
minimumWidth: 520
minimumHeight: 400
FluAppBar{
id:appbar
title: "FluentUI"
z:10
showDark: true
}
FluObject{
id:original_items
FluPaneItem{
title:"Home"
icon:FluentIcons.Home
onTap:{
nav_view.push("qrc:/T_Home.qml")
}
}
FluPaneItemHeader{
title:"Inputs"
}
@ -41,6 +49,13 @@ FluWindow {
}
}
FluPaneItem{
title:"CheckBox"
onTap:{
nav_view.push("qrc:/T_CheckBox.qml")
}
}
FluPaneItem{
title:"ToggleSwitch"
onTap:{
@ -73,6 +88,20 @@ FluWindow {
}
}
FluPaneItem{
title:"CalendarPicker"
onTap:{
nav_view.push("qrc:/T_CalendarPicker.qml")
}
}
FluPaneItem{
title:"ColorPicker"
onTap:{
nav_view.push("qrc:/T_ColorPicker.qml")
}
}
FluPaneItemHeader{
title:"Surface"
}
@ -90,12 +119,28 @@ FluWindow {
nav_view.push("qrc:/T_Progress.qml")
}
}
FluPaneItem{
title:"Badge"
onTap:{
nav_view.push("qrc:/T_Badge.qml")
}
}
FluPaneItem{
title:"Rectangle"
onTap:{
nav_view.push("qrc:/T_Rectangle.qml")
}
}
FluPaneItem{
title:"Carousel"
onTap:{
nav_view.push("qrc:/T_Carousel.qml")
}
}
FluPaneItem{
title:"Expander"
onTap:{
@ -107,7 +152,6 @@ FluWindow {
title:"Popus"
}
FluPaneItem{
title:"Dialog"
onTap:{
@ -115,10 +159,31 @@ FluWindow {
}
}
FluPaneItem{
title:"Tooltip"
onTap:{
nav_view.push("qrc:/T_Tooltip.qml")
}
}
FluPaneItem{
title:"Menu"
onTap:{
nav_view.push("qrc:/T_Menu.qml")
}
}
FluPaneItemHeader{
title:"Navigation"
}
FluPaneItem{
title:"TabView"
onTap:{
nav_view.push("qrc:/T_TabView.qml")
}
}
FluPaneItem{
title:"TreeView"
onTap:{
@ -126,6 +191,14 @@ FluWindow {
}
}
FluPaneItem{
title:"MultiWindow"
onTap:{
nav_view.push("qrc:/T_MultiWindow.qml")
}
}
FluPaneItemHeader{
title:"Theming"
}
@ -150,6 +223,17 @@ FluWindow {
}
}
FluPaneItemHeader{
title:"Media"
}
FluPaneItem{
title:"MediaPlayer"
onTap:{
nav_view.push("qrc:/T_MediaPlayer.qml")
}
}
}
FluObject{
@ -164,30 +248,27 @@ FluWindow {
FluPaneItem{
title:"关于"
onTap:{
FluApp.navigate("/About")
FluApp.navigate("/about")
}
}
}
FluNavigationView{
id:nav_view
anchors{
top: appbar.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
items:original_items
anchors.fill: parent
items: original_items
footerItems:footer_items
logo: "qrc:/res/image/favicon.ico"
z: 11
Component.onCompleted: {
nav_view.setCurrentIndex(1)
nav_view.push("qrc:/T_Buttons.qml")
nav_view.setCurrentIndex(0)
nav_view.push("qrc:/T_Home.qml")
}
}
function startPageByTitle(title){
console.debug(title)
nav_view.startPageByTitle(title)
}
}

View File

@ -1,15 +1,6 @@
<RCC>
<qresource prefix="/">
<file>T_ToggleSwitch.qml</file>
<file>T_Typography.qml</file>
<file>App.qml</file>
<file>SettingPage.qml</file>
<file>AboutPage.qml</file>
<file>T_Buttons.qml</file>
<file>T_Rectangle.qml</file>
<file>T_InfoBar.qml</file>
<file>T_Progress.qml</file>
<file>T_Slider.qml</file>
<file>res/image/image_huoyin.webp</file>
<file>res/svg/avatar_1.svg</file>
<file>res/svg/avatar_2.svg</file>
@ -23,14 +14,140 @@
<file>res/svg/avatar_10.svg</file>
<file>res/svg/avatar_11.svg</file>
<file>res/svg/avatar_12.svg</file>
<file>page/AboutPage.qml</file>
<file>page/MainPage.qml</file>
<file>page/LoginPage.qml</file>
<file>T_ToggleSwitch.qml</file>
<file>T_Typography.qml</file>
<file>T_Awesome.qml</file>
<file>T_Buttons.qml</file>
<file>T_Rectangle.qml</file>
<file>T_InfoBar.qml</file>
<file>T_Progress.qml</file>
<file>T_Slider.qml</file>
<file>T_TextBox.qml</file>
<file>T_Theme.qml</file>
<file>T_Dialog.qml</file>
<file>T_TreeView.qml</file>
<file>T_Expander.qml</file>
<file>MainPage.qml</file>
<file>T_TimePicker.qml</file>
<file>T_DatePicker.qml</file>
<file>T_MultiWindow.qml</file>
<file>T_Menu.qml</file>
<file>res/image/banner_1.jpg</file>
<file>res/image/banner_2.jpg</file>
<file>res/image/banner_3.jpg</file>
<file>res/image/logo_openai.png</file>
<file>page/ChatPage.qml</file>
<file>T_Tooltip.qml</file>
<file>T_Badge.qml</file>
<file>T_CalendarPicker.qml</file>
<file>T_ColorPicker.qml</file>
<file>T_Carousel.qml</file>
<file>T_MediaPlayer.qml</file>
<file>T_TabView.qml</file>
<file>res/image/favicon.ico</file>
<file>T_Home.qml</file>
<file>res/image/bg_home_header.png</file>
<file>res/image/ic_home_github.png</file>
<file>res/image/control/Acrylic.png</file>
<file>res/image/control/AnimatedIcon.png</file>
<file>res/image/control/AnimatedVisualPlayer.png</file>
<file>res/image/control/AnimationInterop.png</file>
<file>res/image/control/AppBarButton.png</file>
<file>res/image/control/AppBarSeparator.png</file>
<file>res/image/control/AppBarToggleButton.png</file>
<file>res/image/control/AutomationProperties.png</file>
<file>res/image/control/AutoSuggestBox.png</file>
<file>res/image/control/Border.png</file>
<file>res/image/control/BreadcrumbBar.png</file>
<file>res/image/control/Button.png</file>
<file>res/image/control/CalendarDatePicker.png</file>
<file>res/image/control/CalendarView.png</file>
<file>res/image/control/Canvas.png</file>
<file>res/image/control/Checkbox.png</file>
<file>res/image/control/Clipboard.png</file>
<file>res/image/control/ColorPaletteResources.png</file>
<file>res/image/control/ColorPicker.png</file>
<file>res/image/control/ComboBox.png</file>
<file>res/image/control/CommandBar.png</file>
<file>res/image/control/CommandBarFlyout.png</file>
<file>res/image/control/CompactSizing.png</file>
<file>res/image/control/ConnectedAnimation.png</file>
<file>res/image/control/ContentDialog.png</file>
<file>res/image/control/CreateMultipleWindows.png</file>
<file>res/image/control/DataGrid.png</file>
<file>res/image/control/DatePicker.png</file>
<file>res/image/control/DropDownButton.png</file>
<file>res/image/control/EasingFunction.png</file>
<file>res/image/control/Expander.png</file>
<file>res/image/control/FilePicker.png</file>
<file>res/image/control/FlipView.png</file>
<file>res/image/control/Flyout.png</file>
<file>res/image/control/Grid.png</file>
<file>res/image/control/GridView.png</file>
<file>res/image/control/HyperlinkButton.png</file>
<file>res/image/control/IconElement.png</file>
<file>res/image/control/Image.png</file>
<file>res/image/control/ImplicitTransition.png</file>
<file>res/image/control/InfoBadge.png</file>
<file>res/image/control/InfoBar.png</file>
<file>res/image/control/InkCanvas.png</file>
<file>res/image/control/InkToolbar.png</file>
<file>res/image/control/InputValidation.png</file>
<file>res/image/control/ItemsRepeater.png</file>
<file>res/image/control/Line.png</file>
<file>res/image/control/ListBox.png</file>
<file>res/image/control/ListView.png</file>
<file>res/image/control/MediaPlayerElement.png</file>
<file>res/image/control/MenuBar.png</file>
<file>res/image/control/MenuFlyout.png</file>
<file>res/image/control/NavigationView.png</file>
<file>res/image/control/NumberBox.png</file>
<file>res/image/control/PageTransition.png</file>
<file>res/image/control/ParallaxView.png</file>
<file>res/image/control/PasswordBox.png</file>
<file>res/image/control/PersonPicture.png</file>
<file>res/image/control/PipsPager.png</file>
<file>res/image/control/Pivot.png</file>
<file>res/image/control/ProgressBar.png</file>
<file>res/image/control/ProgressRing.png</file>
<file>res/image/control/PullToRefresh.png</file>
<file>res/image/control/RadialGradientBrush.png</file>
<file>res/image/control/RadioButton.png</file>
<file>res/image/control/RadioButtons.png</file>
<file>res/image/control/RatingControl.png</file>
<file>res/image/control/RelativePanel.png</file>
<file>res/image/control/RepeatButton.png</file>
<file>res/image/control/RevealFocus.png</file>
<file>res/image/control/RichEditBox.png</file>
<file>res/image/control/RichTextBlock.png</file>
<file>res/image/control/ScrollViewer.png</file>
<file>res/image/control/SemanticZoom.png</file>
<file>res/image/control/Shape.png</file>
<file>res/image/control/Slider.png</file>
<file>res/image/control/Sound.png</file>
<file>res/image/control/SplitButton.png</file>
<file>res/image/control/SplitView.png</file>
<file>res/image/control/StackPanel.png</file>
<file>res/image/control/StandardUICommand.png</file>
<file>res/image/control/SwipeControl.png</file>
<file>res/image/control/TabView.png</file>
<file>res/image/control/TeachingTip.png</file>
<file>res/image/control/TextBlock.png</file>
<file>res/image/control/TextBox.png</file>
<file>res/image/control/ThemeTransition.png</file>
<file>res/image/control/TimePicker.png</file>
<file>res/image/control/TitleBar.png</file>
<file>res/image/control/ToggleButton.png</file>
<file>res/image/control/ToggleSplitButton.png</file>
<file>res/image/control/ToggleSwitch.png</file>
<file>res/image/control/ToolTip.png</file>
<file>res/image/control/TreeView.png</file>
<file>res/image/control/VariableSizedWrapGrid.png</file>
<file>res/image/control/Viewbox.png</file>
<file>res/image/control/WebView.png</file>
<file>res/image/control/XamlUICommand.png</file>
<file>T_CheckBox.qml</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Some files were not shown because too many files have changed in this diff Show More