Results 1 to 8 of 8

Thread: How to return a QFile ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jun 2011
    Location
    Poland
    Posts
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to return a QFile ?

    Qt Code:
    1. class MyClass
    2. {
    3. public:
    4. MyClass();
    5.  
    6.  
    7. QFile *selectFile();
    8.  
    9. private:
    10. QFile *myFile;
    11. };
    12.  
    13. MyClass::MyClass()
    14. {
    15. }
    16.  
    17. QFile *MyClass::selectFile()
    18. {
    19. const QString fileName = "abc";
    20.  
    21. if(fileName==NULL)
    22. return NULL;
    23.  
    24. myFile = new QFile(fileName);
    25.  
    26. return myFile;
    27. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to nDorian for this useful post:

    oldFox64 (7th February 2014)

Similar Threads

  1. Replies: 2
    Last Post: 6th May 2013, 08:06
  2. Replies: 1
    Last Post: 2nd January 2013, 09:48
  3. Replies: 4
    Last Post: 9th May 2011, 09:52
  4. QFile &QFile::operator= is private
    By Fallen_ in forum Newbie
    Replies: 1
    Last Post: 15th March 2011, 15:08
  5. Slot with a return value?
    By lalesculiviu in forum Qt Programming
    Replies: 9
    Last Post: 21st December 2009, 06:27

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.