Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-6078

QFile method to open a file through a QDir object

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • P4: Low
    • None
    • 4.5.3
    • Core: I/O
    • None

    Description

      It would be nice if it was possible to open a file through a QFile object by passing the file's path through a QDir object. For example, something like:

      QFile file;
      QDir dir("/home/user/Documents");
      file.setFileName(dir,"test.txt");    // this would point to "/home/user/Documents/test.txt"
      file.open(QIODevice::ReadOnly | QIODevice::Text);
      

      Another alternative which would be excellent would be if QDir offered a method that returned a QFile object that pointed to a file in QDir's directory. So, for example:

      QFile file;
      QDir dir("/home/user/Documents");
      file = dir.getFile("test.txt");    // this would returnn a QFile object pointing to "/home/user/Documents/test.txt"
      file.open(QIODevice::ReadOnly | QIODevice::Text);
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            stormols Marius Storm-Olsen
            rui maciel Rui Maciel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes