diff options
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qdirmodel.cpp | 20 | ||||
-rw-r--r-- | src/widgets/itemviews/qfileiconprovider.cpp | 2 | ||||
-rw-r--r-- | src/widgets/itemviews/qtableview.cpp | 3 | ||||
-rw-r--r-- | src/widgets/itemviews/qtreeview.cpp | 9 |
4 files changed, 12 insertions, 22 deletions
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index dfb1d7619e..315d2503a4 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -858,7 +858,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const return QModelIndex(); QString absolutePath = QDir(path).absolutePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) absolutePath = absolutePath.toLower(); // On Windows, "filename......." and "filename" are equivalent if (absolutePath.endsWith(QLatin1Char('.'))) { @@ -873,7 +873,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); if ((pathElements.isEmpty() || !QFileInfo::exists(path)) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && path != QLatin1String("/") #endif ) @@ -883,7 +883,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const if (!d->root.populated) // make sure the root is populated d->populate(&d->root); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path QString host = pathElements.first(); int r = 0; @@ -901,7 +901,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const emit const_cast<QDirModel*>(this)->layoutChanged(); } else #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (pathElements.at(0).endsWith(QLatin1Char(':'))) { pathElements[0] += QLatin1Char('/'); } @@ -925,7 +925,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const const QFileInfo& fi = parent->children.at(j).info; QString childFileName; childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) childFileName = childFileName.toLower(); #endif if (childFileName == element) { @@ -938,15 +938,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const // we couldn't find the path element, we create a new node since we _know_ that the path is valid if (row == -1) { -#if defined(Q_OS_WINCE) - QString newPath; - if (parent->info.isRoot()) - newPath = parent->info.absoluteFilePath() + element; - else - newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; -#else QString newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; -#endif if (!d->allowAppendChild || !QFileInfo(newPath).isDir()) return QModelIndex(); d->appendChild(parent, newPath); @@ -1290,7 +1282,7 @@ QString QDirModelPrivate::name(const QModelIndex &index) const const QFileInfo info = n->info; if (info.isRoot()) { QString name = info.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (name.startsWith(QLatin1Char('/'))) // UNC host return info.fileName(); if (name.endsWith(QLatin1Char('/'))) diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp index 66c0ffcd58..78ff5f79ab 100644 --- a/src/widgets/itemviews/qfileiconprovider.cpp +++ b/src/widgets/itemviews/qfileiconprovider.cpp @@ -365,7 +365,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const return retIcon; if (info.isRoot()) -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) { UINT type = GetDriveType((wchar_t *)info.absoluteFilePath().utf16()); diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index e045d60fc8..ff3832e499 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1398,8 +1398,7 @@ void QTableView::paintEvent(QPaintEvent *event) firstVisualRow, lastVisualRow, firstVisualColumn, lastVisualColumn); } - const QVector<QRect> rects = region.rects(); - for (auto dirtyArea : rects) { + for (QRect dirtyArea : region) { dirtyArea.setBottom(qMin(dirtyArea.bottom(), int(y))); if (rightToLeft) { dirtyArea.setLeft(qMax(dirtyArea.left(), d->viewport->width() - int(x))); diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 8031d538a6..e9d866525d 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1477,13 +1477,12 @@ void QTreeView::drawTree(QPainter *painter, const QRegion ®ion) const QPoint hoverPos = d->viewport->mapFromGlobal(QCursor::pos()); d->hoverBranch = d->itemDecorationAt(hoverPos); - QVector<QRect> rects = region.rects(); QVector<int> drawn; - bool multipleRects = (rects.size() > 1); - for (int a = 0; a < rects.size(); ++a) { + bool multipleRects = (region.rectCount() > 1); + for (const QRect &a : region) { const QRect area = (multipleRects - ? QRect(0, rects.at(a).y(), viewportWidth, rects.at(a).height()) - : rects.at(a)); + ? QRect(0, a.y(), viewportWidth, a.height()) + : a); d->leftAndRight = d->startAndEndColumns(area); int i = firstVisibleItem; // the first item at the top of the viewport |