查看完整版本: [-- 怎样用程序安装目录下的ini文件来控制qml里的tabview子页的隐藏和显示 --]

QTCN开发网 -> Qt QML开发 -> 怎样用程序安装目录下的ini文件来控制qml里的tabview子页的隐藏和显示 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

panda333 2019-05-15 16:48

怎样用程序安装目录下的ini文件来控制qml里的tabview子页的隐藏和显示

在客户端ini文件里添加enable disable来控制界面里的选项卡增加和隐藏

XChinux 2019-05-16 16:24
ini文件的读取,放到C++里去读。
然后将参数传递给qml.
设置可见不可见,设置visible属性就可以了吧?

XChinux 2019-05-16 16:24
其实,你将配置文件写成.js文件,也可以,QML容易用。

panda333 2019-05-16 16:53
XChinux:ini文件的读取,放到C++里去读。
然后将参数传递给qml.
设置可见不可见,设置visible属性就可以了吧? (2019-05-16 16:24) 

感谢大佬   发现同事用的是TabBar组件   是不是只能用动态添加和动态删除来改变

panda333 2019-05-16 16:56
XChinux:其实,你将配置文件写成.js文件,也可以,QML容易用。 (2019-05-16 16:24) 

CMTabButton {
                            text: modelData
                            height: tabBar.height
                            width: Scaled.metric(200)
                            leftBorder: false
                            rightBorder: checked ? false : true
                            fontPointSize: Theme.headerFontSize
                            checkedColor: CMColors.accent
                            opacity: 0.
                            //onClicked:{tabBar.removeItem(tabBar.itemAt(tabindex))}
                            Component.onCompleted: { opacity = 1. }
                            
                            Behavior on opacity { OpacityAnimator { duration: 200 } }
                        }
                    }

                    onCurrentIndexChanged: {
                        contentNodeLoader.requestTabActivating(currentIndex)
                    }
                }
            }

panda333 2019-05-16 16:58
XChinux:其实,你将配置文件写成.js文件,也可以,QML容易用。 (2019-05-16 16:24) 

TabBar {
                    id: tabBar
                    spacing: 0
                    Layout.fillHeight: true
                    Layout.fillWidth: true

                    background: CMRectangle {
                        topLeftRadius: Scaled.metric(5)
                        topRightRadius: Scaled.metric(5)
                        color: CMColors.backgroundMiddle
                    }

                    Repeater {
                        model: contentNodeLoader.item ? contentNodeLoader.item.tabsList : []
                        
                        CMTabButton {
                            text: modelData
                            height: tabBar.height
                            width: Scaled.metric(200)
                            leftBorder: false
                            rightBorder: checked ? false : true
                            fontPointSize: Theme.headerFontSize
                            checkedColor: CMColors.accent
                            opacity: 0.
                            //onClicked:{tabBar.removeItem(tabBar.itemAt(tabindex))}
                            Component.onCompleted: { opacity = 1. }
                            
                            Behavior on opacity { OpacityAnimator { duration: 200 } }
                        }
                    }

                    onCurrentIndexChanged: {
                        contentNodeLoader.requestTabActivating(currentIndex)
                    }
                }
            }
        }


查看完整版本: [-- 怎样用程序安装目录下的ini文件来控制qml里的tabview子页的隐藏和显示 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled