qml文件资源管理器

qml文件管理器,由于我的项目不需要添加文件和文件夹,所以没有写入这部分的功能,喜欢加图片的小伙伴也可以加一些图片进去
摘要由CSDN通过智能技术生成
import QtQuick 2.3
import Qt.labs.folderlistmodel 2.1
import QtQuick.Controls.Styles 1.2
import QtQuick.Controls 1.2
import QtQuick.Window 2.15

ListView {
    id:listView
    width: Screen.desktopAvailableWidth
    height: Screen.desktopAvailableHeight
    property bool mRadioBtnVisible: false
    FolderListModel {
        id: folderModel
        showDotAndDotDot: true
        showDirs: true
        folder: /*"file:///D:"*/ fileSystemModel.mySetRootPath()
        nameFilters: [".dat"]

    }

    Component {
        id: fileDelegate
        Row{
            Rectangle{
                color: "#FFDEAD"
                id:mRadioBtn
                width: 40
                height: 40
                border.color: "#ffffff"
                border.width: 1
                RadioButton{
                    id:mRadioBtn1
                    //anchors.fill: parent
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.horizontalCenter: parent.horizontalCenter
                    visible: mRadioBtnVisible

                    onCheckedChanged: {
                        if(mBtnText.text == ".."){

                        }
                        else if(mBtnText.text == "."){}
                        else{
                            fileSystemModel.addRemoveFile(checked,folderModel.folder.toString(),(folderModel.folder+"/"+mBtnText.text).toString());
                        }

                    }
                }
                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        mRadioBtn1.checked = !mRadioBtn1.checked
                    }
                }
            }
            Rectangle{
                height: 40
                width:listView.width-mRadioBtn.width
//                color: "#FFDEAD"
                border.color: "#ffffff"
                border.width: 1
                color: rect_mouse.pressed ? "#01968c" : (rect_mouse.containsMouse ? "#20c9b3" : "#FFDEAD")

                Text {
                    id:mBtnText
    //                width: parent.width-mRadioBtn.width-misFolder.width
                    anchors.verticalCenter: parent.verticalCenter
                    text: fileName
                }

                Text {
                    id:misFolder
                    width: 20
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.right: parent.right
                    Component.onCompleted:  {
                        var mIndex = folderModel.indexOf(fol
  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值