Results 1 to 3 of 3

Thread: opening a file using its Url in QFileDialog::getOpenFileName() not working in linux

  1. #1
    Join Date
    Feb 2010
    Posts
    20
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default opening a file using its Url in QFileDialog::getOpenFileName() not working in linux

    Hi Forum,

    I am using a QFileDialog::getOpenFileName() to open files in my application.
    Its working fine for windows (XP).But there are two problems in linux (Ubuntu)

    1) If the files I am selecting are in current working directory (that we pass as a parameter ), then only its working. And not for files in any other location.

    2)passing an url for the file(if the file is in a server) is working in windows but not in linux.

    Here is my code:
    Qt Code:
    1. QString fileName = QFileDialog::getOpenFileName(this, tr("Open App"),
    2. accessedPath,
    3. tr("My App Files (*.plist | *.xml)");
    To copy to clipboard, switch view to plain text mode 

    In, linux for all above cases, the open button is just staying disabled.

    Would you please, suggest me the possible solution foo this problem?

    Thanks and Regards
    ~nemat

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: opening a file using its Url in QFileDialog::getOpenFileName() not working in lin

    are you sure that accessedPath contains correct path?
    what does this code prints in console?
    Qt Code:
    1. qDebug() << accessedPath;
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Feb 2010
    Posts
    20
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: opening a file using its Url in QFileDialog::getOpenFileName() not working in lin

    Hi Spirit,

    accessedPath is pointing to right place. But it is ok for it to point anywhere right. Its just to say to what location
    the dialog will point when opened. Then we can choose the file from any other location?

Similar Threads

  1. Replies: 9
    Last Post: 23rd August 2012, 01:01
  2. Replies: 2
    Last Post: 10th January 2008, 13:52
  3. Problem with QFileDialog::getOpenFileName()
    By spud in forum Qt Programming
    Replies: 4
    Last Post: 1st November 2007, 23:31
  4. Replies: 1
    Last Post: 15th October 2007, 00:10
  5. QFileDialog::getOpenFileName() gets stucked
    By elcuco in forum Qt Programming
    Replies: 5
    Last Post: 29th March 2006, 00:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.