This commit is contained in:
朱子楚\zhuzi 2024-01-29 20:19:17 +08:00
parent 6a19b47508
commit 3b1ab88b6d
10 changed files with 263 additions and 8 deletions

View File

@ -9,4 +9,76 @@ FluContentPage{
title:"SplitLayout"
RowLayout{
id:layout_dropdown
anchors{
top: parent.top
topMargin: 20
}
FluText{
text:"orientation:"
}
FluDropDownButton{
id:btn_orientation
Layout.preferredWidth: 100
text:"Horizontal"
FluMenuItem{
text:"Horizontal"
onClicked: {
btn_orientation.text = text
split_layout.orientation = Qt.Horizontal
}
}
FluMenuItem{
text:"Vertical"
onClicked: {
btn_orientation.text = text
split_layout.orientation = Qt.Vertical
}
}
}
}
FluSplitLayout {
id:split_layout
anchors{
top: layout_dropdown.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
topMargin: 8
}
orientation: Qt.Horizontal
Item {
clip: true
implicitWidth: 200
implicitHeight: 200
SplitView.maximumWidth: 400
SplitView.maximumHeight: 400
FluText {
text: "Page 1"
anchors.centerIn: parent
}
}
Item {
clip: true
id: centerItem
SplitView.minimumWidth: 50
SplitView.minimumHeight: 50
SplitView.fillWidth: true
SplitView.fillHeight: true
FluText {
text: "Page 2"
anchors.centerIn: parent
}
}
Item {
clip: true
implicitWidth: 200
implicitHeight: 200
FluText {
text: "Page 3"
anchors.centerIn: parent
}
}
}
}

View File

@ -9,4 +9,76 @@ FluContentPage{
title:"SplitLayout"
RowLayout{
id:layout_dropdown
anchors{
top: parent.top
topMargin: 20
}
FluText{
text:"orientation:"
}
FluDropDownButton{
id:btn_orientation
Layout.preferredWidth: 100
text:"Horizontal"
FluMenuItem{
text:"Horizontal"
onClicked: {
btn_orientation.text = text
split_layout.orientation = Qt.Horizontal
}
}
FluMenuItem{
text:"Vertical"
onClicked: {
btn_orientation.text = text
split_layout.orientation = Qt.Vertical
}
}
}
}
FluSplitLayout {
id:split_layout
anchors{
top: layout_dropdown.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
topMargin: 8
}
orientation: Qt.Horizontal
Item {
clip: true
implicitWidth: 200
implicitHeight: 200
SplitView.maximumWidth: 400
SplitView.maximumHeight: 400
FluText {
text: "Page 1"
anchors.centerIn: parent
}
}
Item {
clip: true
id: centerItem
SplitView.minimumWidth: 50
SplitView.minimumHeight: 50
SplitView.fillWidth: true
SplitView.fillHeight: true
FluText {
text: "Page 2"
anchors.centerIn: parent
}
}
Item {
clip: true
implicitWidth: 200
implicitHeight: 200
FluText {
text: "Page 3"
anchors.centerIn: parent
}
}
}
}

View File

@ -2,8 +2,8 @@ import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import "../component"
import FluentUI 1.0
import "../component"
FluContentPage{

View File

@ -14,6 +14,7 @@
#include <QStandardPaths>
#include <QThreadPool>
#include <QDir>
#include <QCryptographicHash>
#include <QEventLoop>
#include <QGuiApplication>

View File

@ -137,6 +137,7 @@ void FluentUI::registerTypes(const char *uri){
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluClip.qml"),uri,major,minor,"FluClip");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLoader.qml"),uri,major,minor,"FluLoader");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluShortcutPicker.qml"),uri,major,minor,"FluShortcutPicker");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSplitLayout.qml"),uri,major,minor,"FluSplitLayout");
qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri,major,minor,"FluentIcons", "Access to enums & flags only");
qmlRegisterUncreatableMetaObject(FluThemeType::staticMetaObject, uri,major,minor,"FluThemeType", "Access to enums & flags only");

View File

@ -0,0 +1,30 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
SplitView {
property color handleColor : FluTheme.dark ? Qt.rgba(159/255,159/255,159/255,1) : Qt.rgba(138/255,138/255,138/255,1)
id:control
QtObject{
id:d
property bool isVertical: control.orientation === Qt.Vertical
}
handle: Rectangle {
implicitWidth: 12
implicitHeight: 12
clip: true
color: {
if(SplitHandle.pressed){
return FluTheme.itemPressColor
}
return SplitHandle.hovered ? FluTheme.itemHoverColor : FluTheme.itemNormalColor
}
Rectangle{
width: d.isVertical ? 26 : 4
height: d.isVertical ? 4 : 26
anchors.centerIn: parent
color: control.handleColor
radius: 2
}
}
}

View File

@ -3017,15 +3017,15 @@ Module {
defaultProperty: "data"
Property { name: "logo"; type: "QUrl" }
Property { name: "title"; type: "string" }
Property { name: "items"; type: "FluObject_QMLTYPE_157"; isPointer: true }
Property { name: "footerItems"; type: "FluObject_QMLTYPE_157"; isPointer: true }
Property { name: "items"; type: "FluObject_QMLTYPE_159"; isPointer: true }
Property { name: "footerItems"; type: "FluObject_QMLTYPE_159"; isPointer: true }
Property { name: "displayMode"; type: "int" }
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
Property { name: "topPadding"; type: "int" }
Property { name: "pageMode"; type: "int" }
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_45"; isPointer: true }
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_45"; isPointer: true }
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true }
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true }
Property { name: "navCompactWidth"; type: "int" }
Property { name: "navTopMargin"; type: "int" }
Property { name: "cellHeight"; type: "int" }
@ -3112,6 +3112,7 @@ Module {
Property { name: "_idx"; type: "int" }
Property { name: "_ext"; type: "QVariant" }
Property { name: "_parent"; type: "QVariant" }
Property { name: "visible"; type: "bool" }
Property { name: "title"; type: "string" }
Property { name: "url"; type: "QVariant" }
Property { name: "disabled"; type: "bool" }
@ -3137,6 +3138,7 @@ Module {
Property { name: "_idx"; type: "int" }
Property { name: "_ext"; type: "QVariant" }
Property { name: "_parent"; type: "QVariant" }
Property { name: "visible"; type: "bool" }
}
Component {
prototype: "QObject"
@ -3147,6 +3149,7 @@ Module {
defaultProperty: "children"
Property { name: "key"; type: "string"; isReadonly: true }
Property { name: "_idx"; type: "int" }
Property { name: "visible"; type: "bool" }
Property { name: "title"; type: "string" }
Property { name: "icon"; type: "QVariant" }
Property { name: "disabled"; type: "bool" }
@ -3166,6 +3169,7 @@ Module {
isComposite: true
Property { name: "key"; type: "string"; isReadonly: true }
Property { name: "_idx"; type: "int" }
Property { name: "visible"; type: "bool" }
Property { name: "title"; type: "string" }
Property { name: "parent"; type: "QVariant" }
}
@ -3177,6 +3181,7 @@ Module {
isComposite: true
Property { name: "key"; type: "string"; isReadonly: true }
Property { name: "_idx"; type: "int" }
Property { name: "visible"; type: "bool" }
Property { name: "parent"; type: "QVariant" }
Property { name: "spacing"; type: "double" }
Property { name: "size"; type: "int" }
@ -3441,6 +3446,34 @@ Module {
Property { name: "elevation"; type: "int" }
Property { name: "radius"; type: "int" }
}
Component {
prototype: "QQuickButton"
name: "FluentUI/FluShortcutPicker 1.0"
exports: ["FluentUI/FluShortcutPicker 1.0"]
exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
Property { name: "current"; type: "QVariant" }
Property { name: "title"; type: "string" }
Property { name: "message"; type: "string" }
Property { name: "positiveText"; type: "string" }
Property { name: "neutralText"; type: "string" }
Property { name: "negativeText"; type: "string" }
Signal { name: "accepted" }
Property { name: "iconSize"; type: "int" }
Property { name: "iconSource"; type: "int" }
Property { name: "disabled"; type: "bool" }
Property { name: "radius"; type: "int" }
Property { name: "contentDescription"; type: "string" }
Property { name: "hoverColor"; type: "QColor" }
Property { name: "pressedColor"; type: "QColor" }
Property { name: "normalColor"; type: "QColor" }
Property { name: "disableColor"; type: "QColor" }
Property { name: "iconDelegate"; type: "QQmlComponent"; isPointer: true }
Property { name: "color"; type: "QColor" }
Property { name: "iconColor"; type: "QColor" }
Property { name: "textColor"; type: "QColor" }
}
Component {
prototype: "QQuickSlider"
name: "FluentUI/FluSlider 1.0"
@ -3449,6 +3482,7 @@ Module {
isComposite: true
defaultProperty: "data"
Property { name: "tooltipEnabled"; type: "bool" }
Property { name: "text"; type: "string" }
}
Component {
prototype: "QQuickSpinBox"
@ -3462,10 +3496,19 @@ Module {
Property { name: "hoverColor"; type: "QColor" }
Property { name: "pressedColor"; type: "QColor" }
}
Component {
prototype: "QQuickSplitView"
name: "FluentUI/FluSplitLayout 1.0"
exports: ["FluentUI/FluSplitLayout 1.0"]
exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "contentData"
Property { name: "handleColor"; type: "QColor" }
}
Component {
prototype: "QQuickItem"
name: "FluentUI/FluStaggeredView 1.0"
exports: ["FluentUI/FluStaggeredView 1.0"]
name: "FluentUI/FluStaggeredLayout 1.0"
exports: ["FluentUI/FluStaggeredLayout 1.0"]
exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
@ -3544,7 +3587,10 @@ Module {
Property { name: "columnSource"; type: "QVariant" }
Property { name: "dataSource"; type: "QVariant" }
Property { name: "borderColor"; type: "QColor" }
Property { name: "horizonalHeaderVisible"; type: "bool" }
Property { name: "verticalHeaderVisible"; type: "bool" }
Property { name: "tableModel"; type: "QQmlTableModel"; isReadonly: true; isPointer: true }
Property { name: "tableView"; type: "QQuickTableView"; isReadonly: true; isPointer: true }
Method { name: "closeEditor"; type: "QVariant" }
Method { name: "resetPosition"; type: "QVariant" }
Method {
@ -3787,6 +3833,7 @@ Module {
Property { name: "showMaximize"; type: "bool" }
Property { name: "showStayTop"; type: "bool" }
Property { name: "autoMaximize"; type: "bool" }
Property { name: "autoVisible"; type: "bool" }
Property { name: "useSystemAppBar"; type: "bool" }
Property { name: "resizeBorderColor"; type: "QColor" }
Property { name: "resizeBorderWidth"; type: "int" }
@ -3797,7 +3844,6 @@ Module {
Property { name: "_realHeight"; type: "int" }
Property { name: "_realWidth"; type: "int" }
Property { name: "_appBarHeight"; type: "int" }
Property { name: "_enableMarginsBottomLeftRight"; type: "bool" }
Property { name: "content"; type: "QObject"; isList: true; isReadonly: true }
Signal { name: "showSystemMenu" }
Signal {

View File

@ -96,4 +96,6 @@ FluLoadingButton 1.0 Controls/FluLoadingButton.qml
FluClip 1.0 Controls/FluClip.qml
FluLoader 1.0 Controls/FluLoader.qml
FluShortcutPicker 1.0 Controls/FluShortcutPicker.qml
FluSplitLayout 1.0 Controls/FluSplitLayout.qml
FluStaggeredLayout 1.0 Controls/FluStaggeredLayout.qml
plugin fluentuiplugin

View File

@ -106,5 +106,6 @@
<file>FluentUI/Image/btn_min_normal.png</file>
<file>FluentUI/Image/btn_min_pushed.png</file>
<file>FluentUI/Controls/FluImageButton.qml</file>
<file>FluentUI/Controls/FluSplitLayout.qml</file>
</qresource>
</RCC>

View File

@ -0,0 +1,30 @@
import QtQuick
import QtQuick.Controls
import FluentUI
SplitView {
property color handleColor : FluTheme.dark ? Qt.rgba(159/255,159/255,159/255,1) : Qt.rgba(138/255,138/255,138/255,1)
id:control
QtObject{
id:d
property bool isVertical: control.orientation === Qt.Vertical
}
handle: Rectangle {
implicitWidth: 12
implicitHeight: 12
clip: true
color: {
if(SplitHandle.pressed){
return FluTheme.itemPressColor
}
return SplitHandle.hovered ? FluTheme.itemHoverColor : FluTheme.itemNormalColor
}
Rectangle{
width: d.isVertical ? 26 : 4
height: d.isVertical ? 4 : 26
anchors.centerIn: parent
color: control.handleColor
radius: 2
}
}
}