mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-05 09:35:28 +08:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
6da4a2e10e | |||
021745c366 | |||
2cfd5b3ab2 | |||
2c7d556042 | |||
609df92f8c | |||
ca57b16521 |
@ -20,7 +20,7 @@ endif()
|
|||||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,2,0)
|
add_definitions(-DVERSION=1,3,2,1)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED)
|
find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED)
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ import FluentUI
|
|||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
|
pageMode: FluNavigationView.SingleTask
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id:model_header
|
id:model_header
|
||||||
ListElement{
|
ListElement{
|
||||||
|
@ -117,7 +117,7 @@ CustomWindow {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
ItemsOriginal.navigationView = nav_view
|
ItemsOriginal.navigationView = nav_view
|
||||||
ItemsFooter.navigationView = nav_view
|
ItemsFooter.navigationView = nav_view
|
||||||
nav_view.setCurrentIndex(0)
|
setCurrentIndex(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ endif()
|
|||||||
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,2,0)
|
add_definitions(-DVERSION=1,3,2,1)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml ShaderTools)
|
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml ShaderTools)
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ class FluApp : public QObject
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY_AUTO(QJsonObject,routes);
|
Q_PROPERTY_AUTO(QJsonObject,routes);
|
||||||
|
|
||||||
QML_FOREIGN(FluApp)
|
|
||||||
QML_NAMED_ELEMENT(FluApp)
|
QML_NAMED_ELEMENT(FluApp)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
private:
|
private:
|
||||||
|
@ -28,7 +28,7 @@ ComboBox {
|
|||||||
highlighted: control.highlightedIndex === index
|
highlighted: control.highlightedIndex === index
|
||||||
hoverEnabled: control.hoverEnabled
|
hoverEnabled: control.hoverEnabled
|
||||||
}
|
}
|
||||||
|
focusPolicy:Qt.TabFocus
|
||||||
indicator: FluIcon {
|
indicator: FluIcon {
|
||||||
x: control.mirrored ? control.padding : control.width - width - control.padding
|
x: control.mirrored ? control.padding : control.width - width - control.padding
|
||||||
y: control.topPadding + (control.availableHeight - height) / 2
|
y: control.topPadding + (control.availableHeight - height) / 2
|
||||||
@ -75,7 +75,8 @@ ComboBox {
|
|||||||
radius: 4
|
radius: 4
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
visible: control.activeFocus
|
visible: control.activeFocus
|
||||||
radius:8
|
radius:4
|
||||||
|
anchors.margins: -2
|
||||||
}
|
}
|
||||||
color:{
|
color:{
|
||||||
if(disabled){
|
if(disabled){
|
||||||
|
@ -2,7 +2,7 @@ import QtQuick
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
TextField {
|
TextEdit {
|
||||||
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
|
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
|
||||||
id:control
|
id:control
|
||||||
color: textColor
|
color: textColor
|
||||||
@ -16,15 +16,6 @@ TextField {
|
|||||||
topPadding: 0
|
topPadding: 0
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
TextMetrics {
|
|
||||||
id: text_metrics
|
|
||||||
font:control.font
|
|
||||||
text: control.text
|
|
||||||
}
|
|
||||||
background: Item{
|
|
||||||
implicitWidth: text_metrics.width+10
|
|
||||||
implicitHeight: text_metrics.height
|
|
||||||
}
|
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
TapHandler {
|
TapHandler {
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
|
@ -12,6 +12,10 @@ Item {
|
|||||||
Minimal,
|
Minimal,
|
||||||
Auto
|
Auto
|
||||||
}
|
}
|
||||||
|
enum PageModeFlag{
|
||||||
|
Standard = 0,
|
||||||
|
SingleTask = 1
|
||||||
|
}
|
||||||
property url logo
|
property url logo
|
||||||
property string title: ""
|
property string title: ""
|
||||||
property FluObject items
|
property FluObject items
|
||||||
@ -21,15 +25,10 @@ Item {
|
|||||||
property Component autoSuggestBox
|
property Component autoSuggestBox
|
||||||
property Component actionItem
|
property Component actionItem
|
||||||
property int topPadding: 0
|
property int topPadding: 0
|
||||||
enum PageModeFlag{
|
|
||||||
Standard = 0,
|
|
||||||
SingleTop = 1,
|
|
||||||
SingleTask = 2
|
|
||||||
}
|
|
||||||
id:control
|
id:control
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
property bool enableStack: true
|
property var stackItems: []
|
||||||
property int displayMode: {
|
property int displayMode: {
|
||||||
if(control.displayMode !==FluNavigationView.Auto){
|
if(control.displayMode !==FluNavigationView.Auto){
|
||||||
return control.displayMode
|
return control.displayMode
|
||||||
@ -42,7 +41,6 @@ Item {
|
|||||||
return FluNavigationView.Open
|
return FluNavigationView.Open
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property var stackItems: []
|
|
||||||
property bool enableNavigationPanel: false
|
property bool enableNavigationPanel: false
|
||||||
property bool isCompact: d.displayMode === FluNavigationView.Compact
|
property bool isCompact: d.displayMode === FluNavigationView.Compact
|
||||||
property bool isMinimal: d.displayMode === FluNavigationView.Minimal
|
property bool isMinimal: d.displayMode === FluNavigationView.Minimal
|
||||||
@ -345,6 +343,7 @@ Item {
|
|||||||
}else{
|
}else{
|
||||||
nav_list.currentIndex = idx
|
nav_list.currentIndex = idx
|
||||||
layout_footer.currentIndex = -1
|
layout_footer.currentIndex = -1
|
||||||
|
model.tap()
|
||||||
if(d.isMinimal || d.isCompact){
|
if(d.isMinimal || d.isCompact){
|
||||||
d.enableNavigationPanel = false
|
d.enableNavigationPanel = false
|
||||||
}
|
}
|
||||||
@ -355,6 +354,7 @@ Item {
|
|||||||
}else{
|
}else{
|
||||||
nav_list.currentIndex = nav_list.count-layout_footer.count+idx
|
nav_list.currentIndex = nav_list.count-layout_footer.count+idx
|
||||||
layout_footer.currentIndex = idx
|
layout_footer.currentIndex = idx
|
||||||
|
model.tap()
|
||||||
if(d.isMinimal || d.isCompact){
|
if(d.isMinimal || d.isCompact){
|
||||||
d.enableNavigationPanel = false
|
d.enableNavigationPanel = false
|
||||||
}
|
}
|
||||||
@ -475,20 +475,18 @@ Item {
|
|||||||
Layout.preferredWidth: 30
|
Layout.preferredWidth: 30
|
||||||
Layout.preferredHeight: 30
|
Layout.preferredHeight: 30
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
disabled: nav_swipe.depth === 1
|
disabled: nav_swipe.depth <= 1
|
||||||
iconSize: 13
|
iconSize: 13
|
||||||
onClicked: {
|
onClicked: {
|
||||||
nav_swipe.pop()
|
nav_swipe.pop()
|
||||||
d.stackItems.pop()
|
d.stackItems.pop()
|
||||||
var item = d.stackItems[d.stackItems.length-1]
|
var item = d.stackItems[d.stackItems.length-1]
|
||||||
d.enableStack = false
|
|
||||||
if(item.idx<(nav_list.count - layout_footer.count)){
|
if(item.idx<(nav_list.count - layout_footer.count)){
|
||||||
layout_footer.currentIndex = -1
|
layout_footer.currentIndex = -1
|
||||||
}else{
|
}else{
|
||||||
layout_footer.currentIndex = item.idx-(nav_list.count-layout_footer.count)
|
layout_footer.currentIndex = item.idx-(nav_list.count-layout_footer.count)
|
||||||
}
|
}
|
||||||
nav_list.currentIndex = item.idx
|
nav_list.currentIndex = item.idx
|
||||||
d.enableStack = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
@ -718,15 +716,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onCurrentIndexChanged: {
|
|
||||||
if(d.enableStack){
|
|
||||||
var item = model[currentIndex]
|
|
||||||
if(item instanceof FluPaneItem){
|
|
||||||
item.tap()
|
|
||||||
d.stackItems.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
currentIndex: -1
|
currentIndex: -1
|
||||||
anchors{
|
anchors{
|
||||||
top: layout_header.bottom
|
top: layout_header.bottom
|
||||||
@ -771,15 +760,6 @@ Item {
|
|||||||
return footerItems.children
|
return footerItems.children
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onCurrentIndexChanged: {
|
|
||||||
if(d.enableStack){
|
|
||||||
var item = model[currentIndex]
|
|
||||||
if(item instanceof FluPaneItem){
|
|
||||||
item.tap()
|
|
||||||
d.stackItems.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
highlightMoveDuration: 150
|
highlightMoveDuration: 150
|
||||||
highlight: Item{
|
highlight: Item{
|
||||||
clip: true
|
clip: true
|
||||||
@ -861,6 +841,7 @@ Item {
|
|||||||
if(modelData.tapFunc){
|
if(modelData.tapFunc){
|
||||||
modelData.tapFunc()
|
modelData.tapFunc()
|
||||||
}else{
|
}else{
|
||||||
|
modelData.tap()
|
||||||
nav_list.currentIndex = idx
|
nav_list.currentIndex = idx
|
||||||
layout_footer.currentIndex = -1
|
layout_footer.currentIndex = -1
|
||||||
if(d.isMinimal || d.isCompact){
|
if(d.isMinimal || d.isCompact){
|
||||||
@ -906,19 +887,22 @@ Item {
|
|||||||
}
|
}
|
||||||
function setCurrentIndex(index){
|
function setCurrentIndex(index){
|
||||||
nav_list.currentIndex = index
|
nav_list.currentIndex = index
|
||||||
|
var item = nav_list.model[index]
|
||||||
|
if(item instanceof FluPaneItem){
|
||||||
|
item.tap()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function getItems(){
|
function getItems(){
|
||||||
return nav_list.model
|
return nav_list.model
|
||||||
}
|
}
|
||||||
function push(url,argument={}){
|
function push(url,argument={}){
|
||||||
if (nav_swipe.depth>0)
|
if(nav_swipe.currentItem && nav_swipe.currentItem.url === url){
|
||||||
{
|
return
|
||||||
|
}
|
||||||
let page = nav_swipe.find(function(item) {
|
let page = nav_swipe.find(function(item) {
|
||||||
return item.url === url;
|
return item.url === url;
|
||||||
})
|
})
|
||||||
if (page)
|
if(page){
|
||||||
{
|
|
||||||
switch(page.pageMode)
|
switch(page.pageMode)
|
||||||
{
|
{
|
||||||
case FluNavigationView.SingleTask:
|
case FluNavigationView.SingleTask:
|
||||||
@ -928,22 +912,18 @@ Item {
|
|||||||
d.stackItems.pop()
|
d.stackItems.pop()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
case FluNavigationView.SingleTop:
|
|
||||||
if (nav_swipe.currentItem.url === url)
|
|
||||||
return
|
|
||||||
break
|
|
||||||
case FluNavigationView.Standard:
|
case FluNavigationView.Standard:
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
nav_swipe.push(url,Object.assign(argument,{url:url}))
|
nav_swipe.push(url,Object.assign(argument,{url:url}))
|
||||||
|
d.stackItems.push(nav_list.model[nav_list.currentIndex])
|
||||||
}
|
}
|
||||||
function getCurrentIndex(){
|
function getCurrentIndex(){
|
||||||
return nav_list.currentIndex
|
return nav_list.currentIndex
|
||||||
}
|
}
|
||||||
function startPageByItem(data){
|
function startPageByItem(data){
|
||||||
var items = getItems();
|
var items = getItems()
|
||||||
for(var i=0;i<items.length;i++){
|
for(var i=0;i<items.length;i++){
|
||||||
var item = items[i]
|
var item = items[i]
|
||||||
if(item.key === data.key){
|
if(item.key === data.key){
|
||||||
|
Reference in New Issue
Block a user