diff options
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 8 | ||||
-rw-r--r-- | src/gui/itemviews/qabstractitemview_p.h | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qcolumnview_p.h | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qdirmodel.cpp | 17 | ||||
-rw-r--r-- | src/gui/itemviews/qfileiconprovider.cpp | 1 | ||||
-rw-r--r-- | src/gui/itemviews/qfileiconprovider.h | 5 | ||||
-rw-r--r-- | src/gui/itemviews/qheaderview.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qitemdelegate.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qstandarditemmodel.cpp | 6 | ||||
-rw-r--r-- | src/gui/itemviews/qstandarditemmodel.h | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qstyleditemdelegate.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qtreewidget.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qtreewidgetitemiterator.cpp | 3 | ||||
-rw-r--r-- | src/gui/itemviews/qtreewidgetitemiterator.h | 3 |
14 files changed, 32 insertions, 25 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 9effc70..3e85b67 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -61,6 +61,7 @@ #ifndef QT_NO_ACCESSIBILITY #include <qaccessible.h> #endif +#include <private/qactiontokeyeventmapper_p.h> QT_BEGIN_NAMESPACE @@ -2003,15 +2004,18 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) if (QApplication::keypadNavigationEnabled()) { if (!hasEditFocus()) { setEditFocus(true); + QActionToKeyEventMapper::addSoftKey(QAction::BackSoftKey, Qt::Key_Back, this); return; } } break; case Qt::Key_Back: - if (QApplication::keypadNavigationEnabled() && hasEditFocus()) + if (QApplication::keypadNavigationEnabled() && hasEditFocus()) { + QActionToKeyEventMapper::removeSoftkey(this); setEditFocus(false); - else + } else { event->ignore(); + } return; default: if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 8594ad7..1d2a233 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -304,7 +304,7 @@ public: */ inline bool isPersistent(const QModelIndex &index) const { - return static_cast<QAbstractItemModelPrivate *>(model->d_ptr)->persistent.indexes.contains(index); + return static_cast<QAbstractItemModelPrivate *>(model->d_ptr.data())->persistent.indexes.contains(index); } QModelIndexList selectedDraggableIndexes() const; diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h index 8f75bec..432e5e8 100644 --- a/src/gui/itemviews/qcolumnview_p.h +++ b/src/gui/itemviews/qcolumnview_p.h @@ -55,7 +55,7 @@ #include "qcolumnview.h" -#ifndef QT_NO_QCOlUMNVIEW +#ifndef QT_NO_QCOLUMNVIEW #include <private/qabstractitemview_p.h> diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp index 65e3032..2596e8c 100644 --- a/src/gui/itemviews/qdirmodel.cpp +++ b/src/gui/itemviews/qdirmodel.cpp @@ -869,8 +869,10 @@ 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) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) absolutePath = absolutePath.toLower(); +#endif +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) // On Windows, "filename......." and "filename" are equivalent if (absolutePath.endsWith(QLatin1Char('.'))) { int i; @@ -910,7 +912,10 @@ QModelIndex QDirModel::index(const QString &path, int column) const pathElements.pop_front(); if (childAppended) emit const_cast<QDirModel*>(this)->layoutChanged(); - } else if (pathElements.at(0).endsWith(QLatin1Char(':'))) { + } else +#endif +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) + if (pathElements.at(0).endsWith(QLatin1Char(':'))) { pathElements[0] += QLatin1Char('/'); } #else @@ -932,11 +937,9 @@ QModelIndex QDirModel::index(const QString &path, int column) const for (int j = parent->children.count() - 1; j >= 0; --j) { const QFileInfo& fi = parent->children.at(j).info; QString childFileName; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath(); +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) childFileName = childFileName.toLower(); -#else - childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath(); #endif if (childFileName == element) { if (i == pathElements.count() - 1) @@ -953,7 +956,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const if (parent->info.isRoot()) newPath = parent->info.absoluteFilePath() + element; else - newPath= parent->info.absoluteFilePath() + QLatin1Char('/') + element; + newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; #else QString newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; #endif @@ -1305,6 +1308,8 @@ QString QDirModelPrivate::name(const QModelIndex &index) const #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) if (name.startsWith(QLatin1Char('/'))) // UNC host return info.fileName(); +#endif +#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) if (name.endsWith(QLatin1Char('/'))) name.chop(1); #endif diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index 434bcde..9a97c2a 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -180,7 +180,6 @@ QFileIconProvider::QFileIconProvider() QFileIconProvider::~QFileIconProvider() { - delete d_ptr; } /*! diff --git a/src/gui/itemviews/qfileiconprovider.h b/src/gui/itemviews/qfileiconprovider.h index 7928552..a6152ea 100644 --- a/src/gui/itemviews/qfileiconprovider.h +++ b/src/gui/itemviews/qfileiconprovider.h @@ -42,8 +42,9 @@ #ifndef QFILEICONPROVIDER_H #define QFILEICONPROVIDER_H -#include <QtGui/qicon.h> #include <QtCore/qfileinfo.h> +#include <QtCore/qscopedpointer.h> +#include <QtGui/qicon.h> QT_BEGIN_HEADER @@ -67,7 +68,7 @@ public: private: Q_DECLARE_PRIVATE(QFileIconProvider) - QFileIconProviderPrivate *d_ptr; + QScopedPointer<QFileIconProviderPrivate> d_ptr; Q_DISABLE_COPY(QFileIconProvider) }; diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index d0321d8..b437119 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -3563,7 +3563,7 @@ bool QHeaderViewPrivate::read(QDataStream &in) in >> minimumSectionSize; in >> align; - defaultAlignment = (Qt::Alignment)align; + defaultAlignment = Qt::Alignment(align); in >> global; globalResizeMode = (QHeaderView::ResizeMode)global; diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index a748199..fda6255 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -1321,7 +1321,7 @@ QStyleOptionViewItem QItemDelegate::setOptions(const QModelIndex &index, // set text alignment value = index.data(Qt::TextAlignmentRole); if (value.isValid()) - opt.displayAlignment = (Qt::Alignment)value.toInt(); + opt.displayAlignment = Qt::Alignment(value.toInt()); // set foreground brush value = index.data(Qt::ForegroundRole); diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp index 30daed2..675a5b3 100644 --- a/src/gui/itemviews/qstandarditemmodel.cpp +++ b/src/gui/itemviews/qstandarditemmodel.cpp @@ -778,8 +778,6 @@ QStandardItem &QStandardItem::operator=(const QStandardItem &other) */ QStandardItem::~QStandardItem() { - Q_D(QStandardItem); - delete d; } /*! @@ -899,7 +897,7 @@ Qt::ItemFlags QStandardItem::flags() const if (!v.isValid()) return (Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable |Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled); - return ((Qt::ItemFlags)(v.toInt())); + return Qt::ItemFlags(v.toInt()); } /*! @@ -1896,7 +1894,7 @@ void QStandardItem::read(QDataStream &in) in >> d->values; qint32 flags; in >> flags; - setFlags((Qt::ItemFlags)flags); + setFlags(Qt::ItemFlags(flags)); } /*! diff --git a/src/gui/itemviews/qstandarditemmodel.h b/src/gui/itemviews/qstandarditemmodel.h index f24f0ab..66d7576 100644 --- a/src/gui/itemviews/qstandarditemmodel.h +++ b/src/gui/itemviews/qstandarditemmodel.h @@ -240,7 +240,7 @@ protected: QStandardItem(const QStandardItem &other); QStandardItem(QStandardItemPrivate &dd); QStandardItem &operator=(const QStandardItem &other); - QStandardItemPrivate *d_ptr; + QScopedPointer<QStandardItemPrivate> d_ptr; void emitDataChanged(); diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp index 7f2c8ed..b75f151 100644 --- a/src/gui/itemviews/qstyleditemdelegate.cpp +++ b/src/gui/itemviews/qstyleditemdelegate.cpp @@ -322,7 +322,7 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option, value = index.data(Qt::TextAlignmentRole); if (value.isValid() && !value.isNull()) - option->displayAlignment = (Qt::Alignment)value.toInt(); + option->displayAlignment = Qt::Alignment(value.toInt()); value = index.data(Qt::ForegroundRole); if (qVariantCanConvert<QBrush>(value)) diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 2a6ac30..709c7b9 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -853,7 +853,7 @@ void QTreeModel::sortItems(QList<QTreeWidgetItem*> *items, int column, Qt::SortO items->replace(r, item); for (int c = 0; c < colCount; ++c) { QModelIndex from = createIndex(oldRow, c, item); - if (static_cast<QAbstractItemModelPrivate *>(d_ptr)->persistent.indexes.contains(from)) { + if (static_cast<QAbstractItemModelPrivate *>(d_ptr.data())->persistent.indexes.contains(from)) { QModelIndex to = createIndex(r, c, item); fromList << from; toList << to; diff --git a/src/gui/itemviews/qtreewidgetitemiterator.cpp b/src/gui/itemviews/qtreewidgetitemiterator.cpp index 3e30e03..7e167b9 100644 --- a/src/gui/itemviews/qtreewidgetitemiterator.cpp +++ b/src/gui/itemviews/qtreewidgetitemiterator.cpp @@ -97,7 +97,7 @@ QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidget *widget, IteratorFl Q_ASSERT(widget); QTreeModel *model = qobject_cast<QTreeModel*>(widget->model()); Q_ASSERT(model); - d_ptr = new QTreeWidgetItemIteratorPrivate(this, model); + d_ptr.reset(new QTreeWidgetItemIteratorPrivate(this, model)); model->iterators.append(this); if (!model->rootItem->children.isEmpty()) current = model->rootItem->children.first(); if (current && !matchesFlags(current)) @@ -150,7 +150,6 @@ QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidgetItem *item, Iterator QTreeWidgetItemIterator::~QTreeWidgetItemIterator() { d_func()->m_model->iterators.removeAll(this); - delete d_ptr; } /*! diff --git a/src/gui/itemviews/qtreewidgetitemiterator.h b/src/gui/itemviews/qtreewidgetitemiterator.h index 8a76c69..535339d 100644 --- a/src/gui/itemviews/qtreewidgetitemiterator.h +++ b/src/gui/itemviews/qtreewidgetitemiterator.h @@ -43,6 +43,7 @@ #define QTREEWIDGETITEMITERATOR_H #include <QtCore/qglobal.h> +#include <QtCore/qscopedpointer.h> QT_BEGIN_HEADER @@ -105,7 +106,7 @@ public: private: bool matchesFlags(const QTreeWidgetItem *item) const; - QTreeWidgetItemIteratorPrivate *d_ptr; + QScopedPointer<QTreeWidgetItemIteratorPrivate> d_ptr; QTreeWidgetItem *current; IteratorFlags flags; Q_DECLARE_PRIVATE(QTreeWidgetItemIterator) |