0ices 2021-06-11 14:00 采纳率: 60%
浏览 139
已采纳

qt 如何拖拽软件中的文件到系统资源管理器

qt 如何拖拽软件中的文件到系统资源管理器。。。。。。。

  • 写回答

2条回答 默认 最新

  • 小P聊技术 2021-06-11 14:03
    关注

    在Qml中,我可以使用text / uri-list mime类型开始拖动,以便从我的应用程序启动复制操作到文件浏览器,例如,

     

    Item {
                id: draggable
                anchors.fill: parent
                Drag.active: mouseArea.drag.active
                Drag.hotSpot.x: 0
                Drag.hotSpot.y: 0
                Drag.mimeData: { "text/uri-list": "file:///home/myname/Desktop/avatar.jpeg" }
                Drag.supportedActions: Qt.CopyAction
                Drag.dragType: Drag.Automatic
                Drag.onDragStarted: { }
                Drag.onDragFinished: {
                    console.log("Time to copy")
                }
            } // Item
    要么
    
     
    Item {
                id: draggable
                anchors.fill: parent
                Drag.active: mouseArea.drag.active
                Drag.hotSpot.x: 0
                Drag.hotSpot.y: 0
                Drag.mimeData: { "text/uri-list": "https://farm1.staticflickr.com/713/21777111068_e3310cfb94_k.jpg" }
                Drag.supportedActions: Qt.CopyAction
                Drag.dragType: Drag.Automatic
                Drag.onDragStarted: { }
                Drag.onDragFinished: {
                    console.log("Time to copy")
                }
            } // Item
    
     

    (另见Qt Quick Examples – externaldraganddrop)

    这适用于文件:http:URIs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭