Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. 求教:如何在QML中调用QFileDialog弹出系统标准对话框
Forum Updated to NodeBB v4.3 + New Features

求教:如何在QML中调用QFileDialog弹出系统标准对话框

Scheduled Pinned Locked Moved Chinese
2 Posts 2 Posters 4.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    charles_yin
    wrote on last edited by
    #1

    在QtQuick 2.0中,比方说点击一个MouseArea,不知如何能实现弹出QFileDialog这样的系统标准对话框。
    我试过做一个c++ 扩展插件,里面有个方法使用QFileDialog,但是不知道怎么用才对。
    就像这样:
    @
    void MyPlugin::selectFile(){
    QFileDialog fd=new QFileDialog(NULL,QString("Open Image"), QString("."), QString("Image Files(.jpg *.png)"));
    }
    @

    编译出错。输出:

    @
    E:\MyPlugin.cpp:-1: 错误:undefined reference to `imp___ZN11QFileDialogC1EP7QWidgetRK7QStringS4_S4'
    collect2.exe:-1: 错误:error: ld returned 1 exit status
    @

    水平有限,网上找了半天也没有解决问题。还请各位指教如何做才正确或者有什么更好的办法来实现。先谢谢了:)

    1 Reply Last reply
    0
    • D Offline
      D Offline
      deleted487
      wrote on last edited by
      #2

      5.1会提供这个功能的
      请参考
      https://codereview.qt-project.org/44201

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved