From 9848c8b92c70006e55a7fa569d06d62efaf5ccc1 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 5 Mar 2012 18:27:10 +0100 Subject: QDirIterator: don't inherit from QDir Remove the inheritance hack used in QDirIterator to gain access to QDir's d-pointer by simply making QDirIterator a friend of QDir. This allows to turn QDir into a final class. Change-Id: I97efef8714bb194d62b9fe5192ce240a90f2bf97 Reviewed-by: Thiago Macieira --- src/corelib/io/qdiriterator.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/corelib/io/qdiriterator.cpp') diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index b8536a8dce..56912e8706 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -410,9 +410,7 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf */ QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags) { - // little trick to get hold of the QDirPrivate while there is no API on QDir to give it to us - class MyQDir : public QDir { public: const QDirPrivate *priv() const { return d_ptr.constData(); } }; - const QDirPrivate *other = static_cast(&dir)->priv(); + const QDirPrivate *other = dir.d_ptr.constData(); d.reset(new QDirIteratorPrivate(other->dirEntry, other->nameFilters, other->filters, flags, !other->fileEngine.isNull())); } -- cgit v1.2.3