Results 1 to 3 of 3

Thread: open file browser and save file

  1. #1
    Join Date
    Jul 2016
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default open file browser and save file

    Hi all,

    I'm new to QT and I found this function in qt:

    QFileDialog::getSaveFileName

    But it is only save file name only, not data.

    May i know is there any function to let user open file browser to choose the file location and save images?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: open file browser and save file

    1) get the file name to save to
    2) save the image using that file name

    Cheers,
    _

  3. #3
    Join Date
    Jan 2011
    Posts
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: open file browser and save file

    Maybe you could follow these steps:
    1) get the file name with path by QFileDialog::getSaveFileName. (only get the file name you wanting, no file data)
    2) use image.save method

    QString path = QFileDialog::getSaveFileName(0,
    tr("Save File"),
    ".");
    QImage image("no1.jpg");

    image.save(path);

Similar Threads

  1. Replies: 1
    Last Post: 7th May 2013, 01:34
  2. Open file from Qtext browser
    By mecrazycoder in forum Newbie
    Replies: 4
    Last Post: 7th January 2011, 09:56
  3. Replies: 1
    Last Post: 8th November 2010, 04:24
  4. Replies: 3
    Last Post: 1st November 2010, 17:33
  5. Replies: 4
    Last Post: 9th May 2010, 17:18

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.