[Qt-interest] How to use QFile with = operator?

Rohan McGovern rohan.mcgovern at nokia.com
Fri Apr 24 09:27:43 CEST 2009


On Friday 24 April 2009, ext Matthias Pospiech wrote:
> I want to do the following:
>
> QString filenameSettings = m_strSaveFilename.remove(".txt") +
> "-settings.txt";
> QFile file;
> file = QFile(filenameSettings);
> ...
> file = QFile(filenameResults);
> ...
>
>
> However that is not possible:
>

Correct, because QFile is a QObject and QObjects are designed not to 
be copied.

In your above example, you could just call close(); 
setFileName(...); on the file instead.

-- 
Rohan McGovern
Qt Software, Nokia



More information about the Qt-interest-old mailing list