Results 1 to 3 of 3

Thread: Need simple example with OSDaB-Zip unzip file

  1. #1
    Join Date
    Dec 2012
    Posts
    13
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Need simple example with OSDaB-Zip unzip file

    Need simple example with OSDaB-Zip unzip file

    MainWindow on QFileDialog::getOpenFileName .... emit signal with file name to slot unzip

    something this

    osdab example hard for me

  2. #2
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: Need simple example with OSDaB-Zip unzip file

    I have no information about QSDaB but Quazip is another and maybe simplier way to handle zip files.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,688
    Thanks
    13
    Thanked 1,598 Times in 1,526 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Need simple example with OSDaB-Zip unzip file

    I don't think there could be a simpler example than those on the OSDaB Zip page on how to use their Zip package. However, your question does not seem to be about the Zip package at all. You want to get the file name of an existing zip file and unzip it.

    Something like this (untested) somewhere in your main window code:
    Qt Code:
    1. QString defaultPath = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
    2. QString zipFile = QFileDialog::getOpenFileName(this, tr("Select Zip File"), defaultPath, tr("Zip files (*.zip)"));
    3. if (!zipFile.isEmpty()) {
    4. // Code to do whatever work.
    5. UnZip uz;
    6. UnZip::ErrorCode ec = uz.openArchive(zipFile);
    7. if (ec == UnZip::Ok) {
    8. // Need to list the files in this archive?
    9. QStringList list = uz.getFileList();
    10. // emit signals, extract files, get contained file details, do whatever else
    11. // make macramé owl ;)
    12. }
    13. else {
    14. // Report error etc.
    15. }
    16. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. unZip via 7z.
    By noborder in forum Newbie
    Replies: 9
    Last Post: 23rd December 2012, 20:26
  2. unzip and untar into new directory
    By jshafferman in forum Qt Programming
    Replies: 30
    Last Post: 26th July 2012, 20:49
  3. How to Zip/Unzip with QT for symbian???
    By baka3k in forum Newbie
    Replies: 2
    Last Post: 22nd June 2011, 09:24
  4. How to read a simple xml file.
    By bod in forum Qt Programming
    Replies: 17
    Last Post: 27th June 2008, 10:13
  5. OpenOffice file to QTextEdit (Unzip Problem)
    By patrik08 in forum Qt Programming
    Replies: 6
    Last Post: 27th November 2006, 11:32

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.