diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-03-31 11:40:56 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-04-16 08:02:07 (GMT) |
commit | 0d433bcb83152c3a67fa81edcce36abf4b3191c4 (patch) | |
tree | d5cfe3e4dab9f00e819357d28a9808f7f33ef145 /src/corelib/io | |
parent | 3e56a4a367c34f032cb8ef225251e330028de650 (diff) | |
download | Qt-0d433bcb83152c3a67fa81edcce36abf4b3191c4.zip Qt-0d433bcb83152c3a67fa81edcce36abf4b3191c4.tar.gz Qt-0d433bcb83152c3a67fa81edcce36abf4b3191c4.tar.bz2 |
Fixes: Speed up QFileInfo::setFile() a bit...
RevBy: Samuel
Details: When doing initFileEngine on a operational QFileInfo, it
will detach(), which creates copy of the file engine, then
we delete this engine and create our own engine. Creating a
clean QFileInfo, saves us one temporary file engine..
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qfileinfo.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 96e0f82..a8d28cb 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -537,8 +537,7 @@ QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo) void QFileInfo::setFile(const QString &file) { - Q_D(QFileInfo); - d->initFileEngine(file); + *this = QFileInfo(file); } /*! @@ -555,8 +554,7 @@ void QFileInfo::setFile(const QString &file) void QFileInfo::setFile(const QFile &file) { - Q_D(QFileInfo); - d->initFileEngine(file.fileName()); + *this = QFileInfo(file.fileName()); } /*! @@ -574,7 +572,7 @@ void QFileInfo::setFile(const QFile &file) void QFileInfo::setFile(const QDir &dir, const QString &file) { Q_D(QFileInfo); - d->initFileEngine(dir.filePath(file)); + *this = QFileInfo(dir.filePath(file)); } /*! @@ -921,7 +919,7 @@ QString QFileInfo::suffix() const \bold{Note:} The QDir returned always corresponds to the object's parent directory, even if the QFileInfo represents a directory. - + For each of the follwing, dir() returns a QDir for \c{"~/examples/191697"}. |