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