Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've started playing with the SDK to start developing an application.

The application will be something that will allow me to filter records in an CSV file by a search term. But does a file dialog exist so that the file can be located and how do I use it?

share|improve this question
Please, could you put some of your time to read – Sylvain Pineau Mar 26 '14 at 11:57
@SylvainPineau I know about accepting answers, but want to spent time testing your answer which means reading up on the links - which I will do this weekend. I also left some time for more answers, but thanks for the link/comment :) – chesedo Mar 26 '14 at 16:31
up vote 1 down vote accepted

Basically you have two options that will depend on the Ubuntu version you're using (or plan to use).

It will create a window like the one below:

enter image description here

  • 14.04 (Qt version 5.2.1)

    In that case, implementing a FileDialog is much more easy to do as there's no need to write C++ code.

    Here is a minimal example to open a file dialog and exit after the user chooses a file:

    import QtQuick 2.1
    import QtQuick.Dialogs 1.0
    FileDialog {
        id: fileDialog
        title: "Please choose a file"
        onAccepted: {
            console.log("You chose: " + fileDialog.fileUrls)
        onRejected: {
        Component.onCompleted: visible = true
share|improve this answer
Will both of these work on the phone as well since they don't make use of the Ubuntu components? – chesedo Mar 23 '14 at 14:29
They should even though the Qt5.2 solution will try to find the best way to render the Dialog window – Sylvain Pineau Mar 23 '14 at 14:33
What's the outcome of your tests? – Sylvain Pineau Mar 31 '14 at 9:26
Unprogressfull, I don't know which C++ file to add the procedure to nor to which one to add the exposing of the procedure to - no c++ files exist. I therefore tried to create one (source and class) but get an error that it failed to add it to the <project>.qmlproject file. – chesedo Apr 1 '14 at 6:31
Try yo reuse the app skeleton I've attached to this answer if you want to develop with C++. You could also take the easy way by developing with 14.04 in a VM then switch to a full install when released (April 17th) – Sylvain Pineau Apr 1 '14 at 7:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.