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

QFile setTextModeEnabled() trashes file information

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.8.x, 5.0.0
    • 4.7.0
    • None
    • pretty much any, but I am using OpenSuSE 11.4 64-bit AMD with all patches applied.
    • 29c30a20bab4c4ea892b95c08c71bb5f136bb82c (5.0), e5df3b4eeaf5943f5170dda781c3c589fa35a15a (4.8)

    Description

      #include <QtCore>
      
      int main(int argc, char **argv)
      {
          QFile file("hello.txt");
      
          file.setTextModeEnabled(true);
          file.open(QFile::WriteOnly);
      
          QTextStream stream(&file);
          stream << "Hello World!";
      
          file.close();
      }
      

      roland@linux-c345:~/qt_bug1> ./qt_bug1
      QFile::open: File (hello.txt) already open
      QIODevice::write: ReadOnly device
      roland@linux-c345:~/qt_bug1>

      Setting a flag shouldn't be forcing a file open AND wiping the filename from the object.

      Attachments

        Issue Links

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

          Activity

            People

              shkearns Shane Kearns
              seasoned_geek Roland Hughes
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes