summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp8
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h2
-rw-r--r--src/gui/itemviews/qcolumnview_p.h2
-rw-r--r--src/gui/itemviews/qdirmodel.cpp17
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp1
-rw-r--r--src/gui/itemviews/qfileiconprovider.h5
-rw-r--r--src/gui/itemviews/qheaderview.cpp8
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp2
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp26
-rw-r--r--src/gui/itemviews/qstandarditemmodel.h2
-rw-r--r--src/gui/itemviews/qstandarditemmodel_p.h4
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.cpp2
-rw-r--r--src/gui/itemviews/qtreewidget.cpp2
-rw-r--r--src/gui/itemviews/qtreewidgetitemiterator.cpp3
-rw-r--r--src/gui/itemviews/qtreewidgetitemiterator.h3
15 files changed, 44 insertions, 43 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 9eb71b7..8f8eae5 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
@@ -2010,15 +2011,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 2ba027d..0d55a2e 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -312,7 +312,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 eb5a279..cea5385 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 b1b2ced..fe81269 100644
--- a/src/gui/itemviews/qdirmodel.cpp
+++ b/src/gui/itemviews/qdirmodel.cpp
@@ -872,8 +872,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;
@@ -913,7 +915,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
@@ -935,11 +940,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)
@@ -956,7 +959,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
@@ -1308,6 +1311,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 b833bb7..4054bfd 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -179,7 +179,6 @@ QFileIconProvider::QFileIconProvider()
QFileIconProvider::~QFileIconProvider()
{
- delete d_ptr;
}
/*!
diff --git a/src/gui/itemviews/qfileiconprovider.h b/src/gui/itemviews/qfileiconprovider.h
index 8bb05b1..5c59861 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 f7b5b6f..5d3bb12 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -2821,16 +2821,12 @@ void QHeaderViewPrivate::setupSectionIndicator(int section, int position)
sectionIndicator = new QLabel(viewport);
}
- int x, y, w, h;
+ int w, h;
int p = q->sectionViewportPosition(section);
if (orientation == Qt::Horizontal) {
- x = p;
- y = 0;
w = q->sectionSize(section);
h = viewport->height();
} else {
- x = 0;
- y = p;
w = viewport->width();
h = q->sectionSize(section);
}
@@ -3561,7 +3557,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 56af0f4..5b69f44 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -1327,7 +1327,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 168d423..9ae3214 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -329,7 +329,6 @@ QStandardItemModelPrivate::QStandardItemModelPrivate()
*/
QStandardItemModelPrivate::~QStandardItemModelPrivate()
{
- delete root;
delete itemPrototype;
qDeleteAll(columnHeaderItems);
qDeleteAll(rowHeaderItems);
@@ -554,7 +553,7 @@ void QStandardItemModelPrivate::rowsInserted(QStandardItem *parent,
int row, int count)
{
Q_Q(QStandardItemModel);
- if (parent == root)
+ if (parent == root.data())
rowHeaderItems.insert(row, count, 0);
q->endInsertRows();
}
@@ -566,7 +565,7 @@ void QStandardItemModelPrivate::columnsInserted(QStandardItem *parent,
int column, int count)
{
Q_Q(QStandardItemModel);
- if (parent == root)
+ if (parent == root.data())
columnHeaderItems.insert(column, count, 0);
q->endInsertColumns();
}
@@ -578,7 +577,7 @@ void QStandardItemModelPrivate::rowsRemoved(QStandardItem *parent,
int row, int count)
{
Q_Q(QStandardItemModel);
- if (parent == root) {
+ if (parent == root.data()) {
for (int i = row; i < row + count; ++i) {
QStandardItem *oldItem = rowHeaderItems.at(i);
if (oldItem)
@@ -597,7 +596,7 @@ void QStandardItemModelPrivate::columnsRemoved(QStandardItem *parent,
int column, int count)
{
Q_Q(QStandardItemModel);
- if (parent == root) {
+ if (parent == root.data()) {
for (int i = column; i < column + count; ++i) {
QStandardItem *oldItem = columnHeaderItems.at(i);
if (oldItem)
@@ -778,8 +777,6 @@ QStandardItem &QStandardItem::operator=(const QStandardItem &other)
*/
QStandardItem::~QStandardItem()
{
- Q_D(QStandardItem);
- delete d;
}
/*!
@@ -790,7 +787,7 @@ QStandardItem::~QStandardItem()
QStandardItem *QStandardItem::parent() const
{
Q_D(const QStandardItem);
- if (!d->model || (d->model->d_func()->root != d->parent))
+ if (!d->model || (d->model->d_func()->root.data() != d->parent))
return d->parent;
return 0;
}
@@ -899,7 +896,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());
}
/*!
@@ -1900,7 +1897,7 @@ void QStandardItem::read(QDataStream &in)
in >> d->values;
qint32 flags;
in >> flags;
- setFlags((Qt::ItemFlags)flags);
+ setFlags(Qt::ItemFlags(flags));
}
/*!
@@ -2089,8 +2086,7 @@ QStandardItemModel::~QStandardItemModel()
void QStandardItemModel::clear()
{
Q_D(QStandardItemModel);
- delete d->root;
- d->root = new QStandardItem;
+ d->root.reset(new QStandardItem);
d->root->d_func()->setModel(this);
qDeleteAll(d->columnHeaderItems);
d->columnHeaderItems.clear();
@@ -2237,7 +2233,7 @@ QStandardItem *QStandardItemModel::item(int row, int column) const
QStandardItem *QStandardItemModel::invisibleRootItem() const
{
Q_D(const QStandardItemModel);
- return d->root;
+ return d->root.data();
}
/*!
@@ -2739,7 +2735,7 @@ QModelIndex QStandardItemModel::index(int row, int column, const QModelIndex &pa
bool QStandardItemModel::insertColumns(int column, int count, const QModelIndex &parent)
{
Q_D(QStandardItemModel);
- QStandardItem *item = parent.isValid() ? itemFromIndex(parent) : d->root;
+ QStandardItem *item = parent.isValid() ? itemFromIndex(parent) : d->root.data();
if (item == 0)
return false;
return item->d_func()->insertColumns(column, count, QList<QStandardItem*>());
@@ -2751,7 +2747,7 @@ bool QStandardItemModel::insertColumns(int column, int count, const QModelIndex
bool QStandardItemModel::insertRows(int row, int count, const QModelIndex &parent)
{
Q_D(QStandardItemModel);
- QStandardItem *item = parent.isValid() ? itemFromIndex(parent) : d->root;
+ QStandardItem *item = parent.isValid() ? itemFromIndex(parent) : d->root.data();
if (item == 0)
return false;
return item->d_func()->insertRows(row, count, QList<QStandardItem*>());
diff --git a/src/gui/itemviews/qstandarditemmodel.h b/src/gui/itemviews/qstandarditemmodel.h
index fdaa997..4bbc4c8 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/qstandarditemmodel_p.h b/src/gui/itemviews/qstandarditemmodel_p.h
index 5984a59..a8b36ed 100644
--- a/src/gui/itemviews/qstandarditemmodel_p.h
+++ b/src/gui/itemviews/qstandarditemmodel_p.h
@@ -153,7 +153,7 @@ public:
inline QStandardItem *itemFromIndex(const QModelIndex &index) const {
Q_Q(const QStandardItemModel);
if (!index.isValid())
- return root;
+ return root.data();
if (index.model() != q)
return 0;
QStandardItem *parent = static_cast<QStandardItem*>(index.internalPointer());
@@ -178,7 +178,7 @@ public:
QVector<QStandardItem*> columnHeaderItems;
QVector<QStandardItem*> rowHeaderItems;
- QStandardItem *root;
+ QScopedPointer<QStandardItem> root;
const QStandardItem *itemPrototype;
int sortRole;
};
diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp
index ae7c86d..b5f676a 100644
--- a/src/gui/itemviews/qstyleditemdelegate.cpp
+++ b/src/gui/itemviews/qstyleditemdelegate.cpp
@@ -323,7 +323,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 0bc2bee..b636284 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 4b87c1a..253159e 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 b7b3fec..6f49415 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)