summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-06-11 09:56:54 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-06-11 14:07:02 (GMT)
commit3f7a7c20c8493f62e090e703acfd581a4e3c4d2e (patch)
treecb835094f6f035ddd3b975db164a056d12f04280 /src
parent0f60b6e05a707630e02655c60ae60884262a4b8e (diff)
downloadQt-3f7a7c20c8493f62e090e703acfd581a4e3c4d2e.zip
Qt-3f7a7c20c8493f62e090e703acfd581a4e3c4d2e.tar.gz
Qt-3f7a7c20c8493f62e090e703acfd581a4e3c4d2e.tar.bz2
refactor of private getters for the mode i item widget classes
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qlistwidget.cpp92
-rw-r--r--src/gui/itemviews/qlistwidget_p.h2
-rw-r--r--src/gui/itemviews/qtablewidget.cpp118
-rw-r--r--src/gui/itemviews/qtablewidget_p.h2
-rw-r--r--src/gui/itemviews/qtreeview.cpp2
-rw-r--r--src/gui/itemviews/qtreewidget.cpp87
-rw-r--r--src/gui/itemviews/qtreewidget_p.h7
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp10
8 files changed, 158 insertions, 162 deletions
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 504908f..51861b3 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -1020,51 +1020,51 @@ void QListWidgetPrivate::setup()
QObject::connect(q, SIGNAL(activated(QModelIndex)),
q, SLOT(_q_emitItemActivated(QModelIndex)));
QObject::connect(q, SIGNAL(entered(QModelIndex)), q, SLOT(_q_emitItemEntered(QModelIndex)));
- QObject::connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_emitItemChanged(QModelIndex)));
QObject::connect(q->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_emitCurrentItemChanged(QModelIndex,QModelIndex)));
QObject::connect(q->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
q, SIGNAL(itemSelectionChanged()));
- QObject::connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
- QObject::connect(model(), SIGNAL(columnsRemoved(QModelIndex,int,int)), q, SLOT(_q_sort()));
+ QObject::connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)), q, SLOT(_q_sort()));
}
void QListWidgetPrivate::_q_emitItemPressed(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemPressed(model()->at(index.row()));
+ emit q->itemPressed(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemClicked(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemClicked(model()->at(index.row()));
+ emit q->itemClicked(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemDoubleClicked(model()->at(index.row()));
+ emit q->itemDoubleClicked(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemActivated(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemActivated(model()->at(index.row()));
+ emit q->itemActivated(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemEntered(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemEntered(model()->at(index.row()));
+ emit q->itemEntered(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitItemChanged(const QModelIndex &index)
{
Q_Q(QListWidget);
- emit q->itemChanged(model()->at(index.row()));
+ emit q->itemChanged(listModel()->at(index.row()));
}
void QListWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
@@ -1072,8 +1072,8 @@ void QListWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
{
Q_Q(QListWidget);
QPersistentModelIndex persistentCurrent = current;
- QListWidgetItem *currentItem = model()->at(persistentCurrent.row());
- emit q->currentItemChanged(currentItem, model()->at(previous.row()));
+ QListWidgetItem *currentItem = listModel()->at(persistentCurrent.row());
+ emit q->currentItemChanged(currentItem, listModel()->at(previous.row()));
//persistentCurrent is invalid if something changed the model in response
//to the currentItemChanged signal emission and the item was removed
@@ -1088,14 +1088,14 @@ void QListWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
void QListWidgetPrivate::_q_sort()
{
if (sortingEnabled)
- model()->sort(0, sortOrder);
+ model->sort(0, sortOrder);
}
void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight)
{
if (sortingEnabled && topLeft.isValid() && bottomRight.isValid())
- model()->ensureSorted(topLeft.column(), sortOrder,
+ listModel()->ensureSorted(topLeft.column(), sortOrder,
topLeft.row(), bottomRight.row());
}
@@ -1308,9 +1308,9 @@ QListWidget::~QListWidget()
QListWidgetItem *QListWidget::item(int row) const
{
Q_D(const QListWidget);
- if (row < 0 || row >= d->model()->rowCount())
+ if (row < 0 || row >= d->model->rowCount())
return 0;
- return d->model()->at(row);
+ return d->listModel()->at(row);
}
/*!
@@ -1322,7 +1322,7 @@ QListWidgetItem *QListWidget::item(int row) const
int QListWidget::row(const QListWidgetItem *item) const
{
Q_D(const QListWidget);
- return d->model()->index(const_cast<QListWidgetItem*>(item)).row();
+ return d->listModel()->index(const_cast<QListWidgetItem*>(item)).row();
}
@@ -1336,7 +1336,7 @@ void QListWidget::insertItem(int row, QListWidgetItem *item)
{
Q_D(QListWidget);
if (item && !item->view)
- d->model()->insert(row, item);
+ d->listModel()->insert(row, item);
}
/*!
@@ -1349,7 +1349,7 @@ void QListWidget::insertItem(int row, QListWidgetItem *item)
void QListWidget::insertItem(int row, const QString &label)
{
Q_D(QListWidget);
- d->model()->insert(row, new QListWidgetItem(label));
+ d->listModel()->insert(row, new QListWidgetItem(label));
}
/*!
@@ -1362,7 +1362,7 @@ void QListWidget::insertItem(int row, const QString &label)
void QListWidget::insertItems(int row, const QStringList &labels)
{
Q_D(QListWidget);
- d->model()->insert(row, labels);
+ d->listModel()->insert(row, labels);
}
/*!
@@ -1378,9 +1378,9 @@ void QListWidget::insertItems(int row, const QStringList &labels)
QListWidgetItem *QListWidget::takeItem(int row)
{
Q_D(QListWidget);
- if (row < 0 || row >= d->model()->rowCount())
+ if (row < 0 || row >= d->model->rowCount())
return 0;
- return d->model()->take(row);
+ return d->listModel()->take(row);
}
/*!
@@ -1391,7 +1391,7 @@ QListWidgetItem *QListWidget::takeItem(int row)
int QListWidget::count() const
{
Q_D(const QListWidget);
- return d->model()->rowCount();
+ return d->model->rowCount();
}
/*!
@@ -1400,7 +1400,7 @@ int QListWidget::count() const
QListWidgetItem *QListWidget::currentItem() const
{
Q_D(const QListWidget);
- return d->model()->at(currentIndex().row());
+ return d->listModel()->at(currentIndex().row());
}
@@ -1438,7 +1438,7 @@ int QListWidget::currentRow() const
void QListWidget::setCurrentRow(int row)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(row);
+ QModelIndex index = d->listModel()->index(row);
if (d->selectionMode == SingleSelection)
selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);
else if (d->selectionMode == NoSelection)
@@ -1455,7 +1455,7 @@ void QListWidget::setCurrentRow(int row)
void QListWidget::setCurrentRow(int row, QItemSelectionModel::SelectionFlags command)
{
Q_D(QListWidget);
- d->selectionModel->setCurrentIndex(d->model()->index(row), command);
+ d->selectionModel->setCurrentIndex(d->listModel()->index(row), command);
}
/*!
@@ -1464,7 +1464,7 @@ void QListWidget::setCurrentRow(int row, QItemSelectionModel::SelectionFlags com
QListWidgetItem *QListWidget::itemAt(const QPoint &p) const
{
Q_D(const QListWidget);
- return d->model()->at(indexAt(p).row());
+ return d->listModel()->at(indexAt(p).row());
}
@@ -1482,7 +1482,7 @@ QListWidgetItem *QListWidget::itemAt(const QPoint &p) const
QRect QListWidget::visualItemRect(const QListWidgetItem *item) const
{
Q_D(const QListWidget);
- QModelIndex index = d->model()->index(const_cast<QListWidgetItem*>(item));
+ QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item));
return visualRect(index);
}
@@ -1493,7 +1493,7 @@ void QListWidget::sortItems(Qt::SortOrder order)
{
Q_D(QListWidget);
d->sortOrder = order;
- d->model()->sort(0, order);
+ d->listModel()->sort(0, order);
}
/*!
@@ -1532,7 +1532,7 @@ Qt::SortOrder QListWidget::sortOrder() const
void QListWidget::editItem(QListWidgetItem *item)
{
Q_D(QListWidget);
- edit(d->model()->index(item));
+ edit(d->listModel()->index(item));
}
/*!
@@ -1543,7 +1543,7 @@ void QListWidget::editItem(QListWidgetItem *item)
void QListWidget::openPersistentEditor(QListWidgetItem *item)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->listModel()->index(item);
QAbstractItemView::openPersistentEditor(index);
}
@@ -1555,7 +1555,7 @@ void QListWidget::openPersistentEditor(QListWidgetItem *item)
void QListWidget::closePersistentEditor(QListWidgetItem *item)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->listModel()->index(item);
QAbstractItemView::closePersistentEditor(index);
}
@@ -1567,7 +1567,7 @@ void QListWidget::closePersistentEditor(QListWidgetItem *item)
QWidget *QListWidget::itemWidget(QListWidgetItem *item) const
{
Q_D(const QListWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->listModel()->index(item);
return QAbstractItemView::indexWidget(index);
}
@@ -1585,7 +1585,7 @@ QWidget *QListWidget::itemWidget(QListWidgetItem *item) const
void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->listModel()->index(item);
QAbstractItemView::setIndexWidget(index, widget);
}
@@ -1599,7 +1599,7 @@ void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget)
bool QListWidget::isItemSelected(const QListWidgetItem *item) const
{
Q_D(const QListWidget);
- QModelIndex index = d->model()->index(const_cast<QListWidgetItem*>(item));
+ QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item));
return selectionModel()->isSelected(index);
}
@@ -1614,7 +1614,7 @@ bool QListWidget::isItemSelected(const QListWidgetItem *item) const
void QListWidget::setItemSelected(const QListWidgetItem *item, bool select)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(const_cast<QListWidgetItem*>(item));
+ QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item));
if (d->selectionMode == SingleSelection) {
selectionModel()->select(index, select
@@ -1638,7 +1638,7 @@ QList<QListWidgetItem*> QListWidget::selectedItems() const
QModelIndexList indexes = selectionModel()->selectedIndexes();
QList<QListWidgetItem*> items;
for (int i = 0; i < indexes.count(); ++i)
- items.append(d->model()->at(indexes.at(i).row()));
+ items.append(d->listModel()->at(indexes.at(i).row()));
return items;
}
@@ -1649,11 +1649,11 @@ QList<QListWidgetItem*> QListWidget::selectedItems() const
QList<QListWidgetItem*> QListWidget::findItems(const QString &text, Qt::MatchFlags flags) const
{
Q_D(const QListWidget);
- QModelIndexList indexes = d->model()->match(model()->index(0, 0, QModelIndex()),
+ QModelIndexList indexes = d->listModel()->match(model()->index(0, 0, QModelIndex()),
Qt::DisplayRole, text, -1, flags);
QList<QListWidgetItem*> items;
for (int i = 0; i < indexes.size(); ++i)
- items.append(d->model()->at(indexes.at(i).row()));
+ items.append(d->listModel()->at(indexes.at(i).row()));
return items;
}
@@ -1690,7 +1690,7 @@ void QListWidget::setItemHidden(const QListWidgetItem *item, bool hide)
void QListWidget::scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint)
{
Q_D(QListWidget);
- QModelIndex index = d->model()->index(const_cast<QListWidgetItem*>(item));
+ QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item));
QListView::scrollTo(index, hint);
}
@@ -1703,7 +1703,7 @@ void QListWidget::clear()
{
Q_D(QListWidget);
selectionModel()->clear();
- d->model()->clear();
+ d->listModel()->clear();
}
/*!
@@ -1714,7 +1714,7 @@ void QListWidget::clear()
*/
QStringList QListWidget::mimeTypes() const
{
- return d_func()->model()->QAbstractListModel::mimeTypes();
+ return d_func()->listModel()->QAbstractListModel::mimeTypes();
}
/*!
@@ -1727,7 +1727,7 @@ QStringList QListWidget::mimeTypes() const
*/
QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*>) const
{
- return d_func()->model()->internalMimeData();
+ return d_func()->listModel()->internalMimeData();
}
#ifndef QT_NO_DRAGANDDROP
@@ -1750,7 +1750,7 @@ bool QListWidget::dropMimeData(int index, const QMimeData *data, Qt::DropAction
row = -1;
column = -1;
}
- return d_func()->model()->QAbstractListModel::dropMimeData(data, action , row, column, idx);
+ return d_func()->listModel()->QAbstractListModel::dropMimeData(data, action , row, column, idx);
}
/*! \reimp */
@@ -1809,7 +1809,7 @@ void QListWidget::dropEvent(QDropEvent *event) {
Qt::DropActions QListWidget::supportedDropActions() const
{
Q_D(const QListWidget);
- return d->model()->QAbstractListModel::supportedDropActions() | Qt::MoveAction;
+ return d->listModel()->QAbstractListModel::supportedDropActions() | Qt::MoveAction;
}
#endif // QT_NO_DRAGANDDROP
@@ -1833,7 +1833,7 @@ QList<QListWidgetItem*> QListWidget::items(const QMimeData *data) const
QModelIndex QListWidget::indexFromItem(QListWidgetItem *item) const
{
Q_D(const QListWidget);
- return d->model()->index(item);
+ return d->listModel()->index(item);
}
/*!
@@ -1844,7 +1844,7 @@ QListWidgetItem *QListWidget::itemFromIndex(const QModelIndex &index) const
{
Q_D(const QListWidget);
if (d->isIndexValid(index))
- return d->model()->at(index.row());
+ return d->listModel()->at(index.row());
return 0;
}
diff --git a/src/gui/itemviews/qlistwidget_p.h b/src/gui/itemviews/qlistwidget_p.h
index 8556047..6887d9d 100644
--- a/src/gui/itemviews/qlistwidget_p.h
+++ b/src/gui/itemviews/qlistwidget_p.h
@@ -143,7 +143,7 @@ class QListWidgetPrivate : public QListViewPrivate
Q_DECLARE_PUBLIC(QListWidget)
public:
QListWidgetPrivate() : QListViewPrivate(), sortOrder(Qt::AscendingOrder), sortingEnabled(false) {}
- inline QListModel *model() const { return qobject_cast<QListModel*>(q_func()->model()); }
+ inline QListModel *listModel() const { return qobject_cast<QListModel*>(model); }
void setup();
void _q_emitItemPressed(const QModelIndex &index);
void _q_emitItemClicked(const QModelIndex &index);
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp
index 072e435..6645376 100644
--- a/src/gui/itemviews/qtablewidget.cpp
+++ b/src/gui/itemviews/qtablewidget.cpp
@@ -1570,7 +1570,7 @@ void QTableWidgetPrivate::setup()
QObject::connect(q, SIGNAL(activated(QModelIndex)), q, SLOT(_q_emitItemActivated(QModelIndex)));
QObject::connect(q, SIGNAL(entered(QModelIndex)), q, SLOT(_q_emitItemEntered(QModelIndex)));
// model signals
- QObject::connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_emitItemChanged(QModelIndex)));
// selection signals
QObject::connect(q->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
@@ -1578,15 +1578,15 @@ void QTableWidgetPrivate::setup()
QObject::connect(q->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
q, SIGNAL(itemSelectionChanged()));
// sorting
- QObject::connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
q, SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
- QObject::connect(model(), SIGNAL(columnsRemoved(QModelIndex,int,int)), q, SLOT(_q_sort()));
+ QObject::connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)), q, SLOT(_q_sort()));
}
void QTableWidgetPrivate::_q_emitItemPressed(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemPressed(item);
emit q->cellPressed(index.row(), index.column());
}
@@ -1594,7 +1594,7 @@ void QTableWidgetPrivate::_q_emitItemPressed(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemClicked(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemClicked(item);
emit q->cellClicked(index.row(), index.column());
}
@@ -1602,7 +1602,7 @@ void QTableWidgetPrivate::_q_emitItemClicked(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemDoubleClicked(item);
emit q->cellDoubleClicked(index.row(), index.column());
}
@@ -1610,7 +1610,7 @@ void QTableWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemActivated(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemActivated(item);
emit q->cellActivated(index.row(), index.column());
}
@@ -1618,7 +1618,7 @@ void QTableWidgetPrivate::_q_emitItemActivated(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemEntered(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemEntered(item);
emit q->cellEntered(index.row(), index.column());
}
@@ -1626,7 +1626,7 @@ void QTableWidgetPrivate::_q_emitItemEntered(const QModelIndex &index)
void QTableWidgetPrivate::_q_emitItemChanged(const QModelIndex &index)
{
Q_Q(QTableWidget);
- if (QTableWidgetItem *item = model()->item(index))
+ if (QTableWidgetItem *item = tableModel()->item(index))
emit q->itemChanged(item);
emit q->cellChanged(index.row(), index.column());
}
@@ -1635,8 +1635,8 @@ void QTableWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
const QModelIndex &previous)
{
Q_Q(QTableWidget);
- QTableWidgetItem *currentItem = model()->item(current);
- QTableWidgetItem *previousItem = model()->item(previous);
+ QTableWidgetItem *currentItem = tableModel()->item(current);
+ QTableWidgetItem *previousItem = tableModel()->item(previous);
if (currentItem || previousItem)
emit q->currentItemChanged(currentItem, previousItem);
emit q->currentCellChanged(current.row(), current.column(), previous.row(), previous.column());
@@ -1647,7 +1647,7 @@ void QTableWidgetPrivate::_q_sort()
if (sortingEnabled) {
int column = horizontalHeader->sortIndicatorSection();
Qt::SortOrder order = horizontalHeader->sortIndicatorOrder();
- model()->sort(column, order);
+ model->sort(column, order);
}
}
@@ -1658,7 +1658,7 @@ void QTableWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
int column = horizontalHeader->sortIndicatorSection();
if (column >= topLeft.column() && column <= bottomRight.column()) {
Qt::SortOrder order = horizontalHeader->sortIndicatorOrder();
- model()->ensureSorted(column, order, topLeft.row(), bottomRight.row());
+ tableModel()->ensureSorted(column, order, topLeft.row(), bottomRight.row());
}
}
}
@@ -1862,7 +1862,7 @@ QTableWidget::~QTableWidget()
void QTableWidget::setRowCount(int rows)
{
Q_D(QTableWidget);
- d->model()->setRowCount(rows);
+ d->tableModel()->setRowCount(rows);
}
/*!
@@ -1872,7 +1872,7 @@ void QTableWidget::setRowCount(int rows)
int QTableWidget::rowCount() const
{
Q_D(const QTableWidget);
- return d->model()->rowCount();
+ return d->model->rowCount();
}
/*!
@@ -1885,7 +1885,7 @@ int QTableWidget::rowCount() const
void QTableWidget::setColumnCount(int columns)
{
Q_D(QTableWidget);
- d->model()->setColumnCount(columns);
+ d->tableModel()->setColumnCount(columns);
}
/*!
@@ -1895,7 +1895,7 @@ void QTableWidget::setColumnCount(int columns)
int QTableWidget::columnCount() const
{
Q_D(const QTableWidget);
- return d->model()->columnCount();
+ return d->model->columnCount();
}
/*!
@@ -1904,7 +1904,7 @@ int QTableWidget::columnCount() const
int QTableWidget::row(const QTableWidgetItem *item) const
{
Q_D(const QTableWidget);
- return d->model()->index(item).row();
+ return d->tableModel()->index(item).row();
}
/*!
@@ -1913,7 +1913,7 @@ int QTableWidget::row(const QTableWidgetItem *item) const
int QTableWidget::column(const QTableWidgetItem *item) const
{
Q_D(const QTableWidget);
- return d->model()->index(item).column();
+ return d->tableModel()->index(item).column();
}
@@ -1926,7 +1926,7 @@ int QTableWidget::column(const QTableWidgetItem *item) const
QTableWidgetItem *QTableWidget::item(int row, int column) const
{
Q_D(const QTableWidget);
- return d->model()->item(row, column);
+ return d->tableModel()->item(row, column);
}
/*!
@@ -1955,7 +1955,7 @@ void QTableWidget::setItem(int row, int column, QTableWidgetItem *item)
qWarning("QTableWidget: cannot insert an item that is already owned by another QTableWidget");
} else {
item->view = this;
- d->model()->setItem(row, column, item);
+ d->tableModel()->setItem(row, column, item);
}
} else {
delete takeItem(row, column);
@@ -1968,7 +1968,7 @@ void QTableWidget::setItem(int row, int column, QTableWidgetItem *item)
QTableWidgetItem *QTableWidget::takeItem(int row, int column)
{
Q_D(QTableWidget);
- QTableWidgetItem *item = d->model()->takeItem(row, column);
+ QTableWidgetItem *item = d->tableModel()->takeItem(row, column);
if (item)
item->view = 0;
return item;
@@ -1980,7 +1980,7 @@ QTableWidgetItem *QTableWidget::takeItem(int row, int column)
QTableWidgetItem *QTableWidget::verticalHeaderItem(int row) const
{
Q_D(const QTableWidget);
- return d->model()->verticalHeaderItem(row);
+ return d->tableModel()->verticalHeaderItem(row);
}
/*!
@@ -1991,7 +1991,7 @@ void QTableWidget::setVerticalHeaderItem(int row, QTableWidgetItem *item)
Q_D(QTableWidget);
if (item) {
item->view = this;
- d->model()->setVerticalHeaderItem(row, item);
+ d->tableModel()->setVerticalHeaderItem(row, item);
} else {
delete takeVerticalHeaderItem(row);
}
@@ -2004,7 +2004,7 @@ void QTableWidget::setVerticalHeaderItem(int row, QTableWidgetItem *item)
QTableWidgetItem *QTableWidget::takeVerticalHeaderItem(int row)
{
Q_D(QTableWidget);
- QTableWidgetItem *itm = d->model()->takeVerticalHeaderItem(row);
+ QTableWidgetItem *itm = d->tableModel()->takeVerticalHeaderItem(row);
if (itm)
itm->view = 0;
return itm;
@@ -2017,7 +2017,7 @@ QTableWidgetItem *QTableWidget::takeVerticalHeaderItem(int row)
QTableWidgetItem *QTableWidget::horizontalHeaderItem(int column) const
{
Q_D(const QTableWidget);
- return d->model()->horizontalHeaderItem(column);
+ return d->tableModel()->horizontalHeaderItem(column);
}
/*!
@@ -2028,7 +2028,7 @@ void QTableWidget::setHorizontalHeaderItem(int column, QTableWidgetItem *item)
Q_D(QTableWidget);
if (item) {
item->view = this;
- d->model()->setHorizontalHeaderItem(column, item);
+ d->tableModel()->setHorizontalHeaderItem(column, item);
} else {
delete takeHorizontalHeaderItem(column);
}
@@ -2041,7 +2041,7 @@ void QTableWidget::setHorizontalHeaderItem(int column, QTableWidgetItem *item)
QTableWidgetItem *QTableWidget::takeHorizontalHeaderItem(int column)
{
Q_D(QTableWidget);
- QTableWidgetItem *itm = d->model()->takeHorizontalHeaderItem(column);
+ QTableWidgetItem *itm = d->tableModel()->takeHorizontalHeaderItem(column);
if (itm)
itm->view = 0;
return itm;
@@ -2053,7 +2053,7 @@ QTableWidgetItem *QTableWidget::takeHorizontalHeaderItem(int column)
void QTableWidget::setVerticalHeaderLabels(const QStringList &labels)
{
Q_D(QTableWidget);
- QTableModel *model = d->model();
+ QTableModel *model = d->tableModel();
QTableWidgetItem *item = 0;
for (int i = 0; i < model->rowCount() && i < labels.count(); ++i) {
item = model->verticalHeaderItem(i);
@@ -2071,7 +2071,7 @@ void QTableWidget::setVerticalHeaderLabels(const QStringList &labels)
void QTableWidget::setHorizontalHeaderLabels(const QStringList &labels)
{
Q_D(QTableWidget);
- QTableModel *model = d->model();
+ QTableModel *model = d->tableModel();
QTableWidgetItem *item = 0;
for (int i = 0; i < model->columnCount() && i < labels.count(); ++i) {
item = model->horizontalHeaderItem(i);
@@ -2111,7 +2111,7 @@ int QTableWidget::currentColumn() const
QTableWidgetItem *QTableWidget::currentItem() const
{
Q_D(const QTableWidget);
- return d->model()->item(currentIndex());
+ return d->tableModel()->item(currentIndex());
}
/*!
@@ -2125,7 +2125,7 @@ QTableWidgetItem *QTableWidget::currentItem() const
void QTableWidget::setCurrentItem(QTableWidgetItem *item)
{
Q_D(QTableWidget);
- setCurrentIndex(d->model()->index(item));
+ setCurrentIndex(d->tableModel()->index(item));
}
/*!
@@ -2138,7 +2138,7 @@ void QTableWidget::setCurrentItem(QTableWidgetItem *item)
void QTableWidget::setCurrentItem(QTableWidgetItem *item, QItemSelectionModel::SelectionFlags command)
{
Q_D(QTableWidget);
- d->selectionModel->setCurrentIndex(d->model()->index(item), command);
+ d->selectionModel->setCurrentIndex(d->tableModel()->index(item), command);
}
/*!
@@ -2177,7 +2177,7 @@ void QTableWidget::setCurrentCell(int row, int column, QItemSelectionModel::Sele
void QTableWidget::sortItems(int column, Qt::SortOrder order)
{
Q_D(QTableWidget);
- d->model()->sort(column, order);
+ d->model->sort(column, order);
horizontalHeader()->setSortIndicator(column, order);
}
@@ -2206,7 +2206,7 @@ void QTableWidget::editItem(QTableWidgetItem *item)
Q_D(QTableWidget);
if (!item)
return;
- edit(d->model()->index(item));
+ edit(d->tableModel()->index(item));
}
/*!
@@ -2219,7 +2219,7 @@ void QTableWidget::openPersistentEditor(QTableWidgetItem *item)
Q_D(QTableWidget);
if (!item)
return;
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->tableModel()->index(item);
QAbstractItemView::openPersistentEditor(index);
}
@@ -2233,7 +2233,7 @@ void QTableWidget::closePersistentEditor(QTableWidgetItem *item)
Q_D(QTableWidget);
if (!item)
return;
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->tableModel()->index(item);
QAbstractItemView::closePersistentEditor(index);
}
@@ -2283,7 +2283,7 @@ void QTableWidget::setCellWidget(int row, int column, QWidget *widget)
bool QTableWidget::isItemSelected(const QTableWidgetItem *item) const
{
Q_D(const QTableWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->tableModel()->index(item);
return selectionModel()->isSelected(index);
}
@@ -2297,7 +2297,7 @@ bool QTableWidget::isItemSelected(const QTableWidgetItem *item) const
void QTableWidget::setItemSelected(const QTableWidgetItem *item, bool select)
{
Q_D(QTableWidget);
- QModelIndex index = d->model()->index(item);
+ QModelIndex index = d->tableModel()->index(item);
selectionModel()->select(index, select ? QItemSelectionModel::Select : QItemSelectionModel::Deselect);
}
@@ -2354,7 +2354,7 @@ QList<QTableWidgetItem*> QTableWidget::selectedItems()
QModelIndex index = indexes.at(i);
if (isIndexHidden(index))
continue;
- QTableWidgetItem *item = d->model()->item(index);
+ QTableWidgetItem *item = d->tableModel()->item(index);
if (item)
items.append(item);
}
@@ -2370,11 +2370,11 @@ QList<QTableWidgetItem*> QTableWidget::findItems(const QString &text, Qt::MatchF
Q_D(const QTableWidget);
QModelIndexList indexes;
for (int column = 0; column < columnCount(); ++column)
- indexes += d->model()->match(model()->index(0, column, QModelIndex()),
+ indexes += d->model->match(model()->index(0, column, QModelIndex()),
Qt::DisplayRole, text, -1, flags);
QList<QTableWidgetItem*> items;
for (int i = 0; i < indexes.size(); ++i)
- items.append(d->model()->item(indexes.at(i)));
+ items.append(d->tableModel()->item(indexes.at(i)));
return items;
}
@@ -2408,7 +2408,7 @@ int QTableWidget::visualColumn(int logicalColumn) const
QTableWidgetItem *QTableWidget::itemAt(const QPoint &p) const
{
Q_D(const QTableWidget);
- return d->model()->item(indexAt(p));
+ return d->tableModel()->item(indexAt(p));
}
/*!
@@ -2419,7 +2419,7 @@ QRect QTableWidget::visualItemRect(const QTableWidgetItem *item) const
Q_D(const QTableWidget);
if (!item)
return QRect();
- QModelIndex index = d->model()->index(const_cast<QTableWidgetItem*>(item));
+ QModelIndex index = d->tableModel()->index(const_cast<QTableWidgetItem*>(item));
Q_ASSERT(index.isValid());
return visualRect(index);
}
@@ -2435,7 +2435,7 @@ void QTableWidget::scrollToItem(const QTableWidgetItem *item, QAbstractItemView:
Q_D(QTableWidget);
if (!item)
return;
- QModelIndex index = d->model()->index(const_cast<QTableWidgetItem*>(item));
+ QModelIndex index = d->tableModel()->index(const_cast<QTableWidgetItem*>(item));
Q_ASSERT(index.isValid());
QTableView::scrollTo(index, hint);
}
@@ -2448,7 +2448,7 @@ void QTableWidget::scrollToItem(const QTableWidgetItem *item, QAbstractItemView:
const QTableWidgetItem *QTableWidget::itemPrototype() const
{
Q_D(const QTableWidget);
- return d->model()->itemPrototype();
+ return d->tableModel()->itemPrototype();
}
/*!
@@ -2467,7 +2467,7 @@ const QTableWidgetItem *QTableWidget::itemPrototype() const
void QTableWidget::setItemPrototype(const QTableWidgetItem *item)
{
Q_D(QTableWidget);
- d->model()->setItemPrototype(item);
+ d->tableModel()->setItemPrototype(item);
}
/*!
@@ -2476,7 +2476,7 @@ void QTableWidget::setItemPrototype(const QTableWidgetItem *item)
void QTableWidget::insertRow(int row)
{
Q_D(QTableWidget);
- d->model()->insertRows(row);
+ d->tableModel()->insertRows(row);
}
/*!
@@ -2485,7 +2485,7 @@ void QTableWidget::insertRow(int row)
void QTableWidget::insertColumn(int column)
{
Q_D(QTableWidget);
- d->model()->insertColumns(column);
+ d->tableModel()->insertColumns(column);
}
/*!
@@ -2494,7 +2494,7 @@ void QTableWidget::insertColumn(int column)
void QTableWidget::removeRow(int row)
{
Q_D(QTableWidget);
- d->model()->removeRows(row);
+ d->tableModel()->removeRows(row);
}
/*!
@@ -2503,7 +2503,7 @@ void QTableWidget::removeRow(int row)
void QTableWidget::removeColumn(int column)
{
Q_D(QTableWidget);
- d->model()->removeColumns(column);
+ d->tableModel()->removeColumns(column);
}
/*!
@@ -2516,7 +2516,7 @@ void QTableWidget::clear()
{
Q_D(QTableWidget);
selectionModel()->clear();
- d->model()->clear();
+ d->tableModel()->clear();
}
/*!
@@ -2530,7 +2530,7 @@ void QTableWidget::clearContents()
{
Q_D(QTableWidget);
selectionModel()->clear();
- d->model()->clearContents();
+ d->tableModel()->clearContents();
}
/*!
@@ -2541,7 +2541,7 @@ void QTableWidget::clearContents()
*/
QStringList QTableWidget::mimeTypes() const
{
- return d_func()->model()->QAbstractTableModel::mimeTypes();
+ return d_func()->tableModel()->QAbstractTableModel::mimeTypes();
}
/*!
@@ -2554,7 +2554,7 @@ QStringList QTableWidget::mimeTypes() const
*/
QMimeData *QTableWidget::mimeData(const QList<QTableWidgetItem*>) const
{
- return d_func()->model()->internalMimeData();
+ return d_func()->tableModel()->internalMimeData();
}
/*!
@@ -2576,7 +2576,7 @@ bool QTableWidget::dropMimeData(int row, int column, const QMimeData *data, Qt::
column = -1;
}
#endif
- return d_func()->model()->QAbstractTableModel::dropMimeData(data, action , row, column, idx);
+ return d_func()->tableModel()->QAbstractTableModel::dropMimeData(data, action , row, column, idx);
}
/*!
@@ -2586,7 +2586,7 @@ bool QTableWidget::dropMimeData(int row, int column, const QMimeData *data, Qt::
*/
Qt::DropActions QTableWidget::supportedDropActions() const
{
- return d_func()->model()->QAbstractTableModel::supportedDropActions() | Qt::MoveAction;
+ return d_func()->tableModel()->QAbstractTableModel::supportedDropActions() | Qt::MoveAction;
}
/*!
@@ -2610,7 +2610,7 @@ QList<QTableWidgetItem*> QTableWidget::items(const QMimeData *data) const
QModelIndex QTableWidget::indexFromItem(QTableWidgetItem *item) const
{
Q_D(const QTableWidget);
- return d->model()->index(item);
+ return d->tableModel()->index(item);
}
/*!
@@ -2620,7 +2620,7 @@ QModelIndex QTableWidget::indexFromItem(QTableWidgetItem *item) const
QTableWidgetItem *QTableWidget::itemFromIndex(const QModelIndex &index) const
{
Q_D(const QTableWidget);
- return d->model()->item(index);
+ return d->tableModel()->item(index);
}
/*!
diff --git a/src/gui/itemviews/qtablewidget_p.h b/src/gui/itemviews/qtablewidget_p.h
index d8bfcc5..2acaf9b 100644
--- a/src/gui/itemviews/qtablewidget_p.h
+++ b/src/gui/itemviews/qtablewidget_p.h
@@ -189,7 +189,7 @@ class QTableWidgetPrivate : public QTableViewPrivate
Q_DECLARE_PUBLIC(QTableWidget)
public:
QTableWidgetPrivate() : QTableViewPrivate() {}
- inline QTableModel *model() const { return qobject_cast<QTableModel*>(q_func()->model()); }
+ inline QTableModel *tableModel() const { return qobject_cast<QTableModel*>(model); }
void setup();
// view signals
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 53fa170..ecbd683 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -3485,7 +3485,7 @@ void QTreeViewPrivate::updateScrollBars()
int QTreeViewPrivate::itemDecorationAt(const QPoint &pos) const
{
- const_cast<QTreeView *>(q_func())->executeDelayedItemsLayout();
+ executePostedLayout();
int x = pos.x();
int column = header->logicalIndexAt(x);
if (column != 0)
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 24713c4..2a6ac30 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -2283,7 +2283,7 @@ void QTreeWidgetPrivate::_q_sort()
if (sortingEnabled) {
int column = header->sortIndicatorSection();
Qt::SortOrder order = header->sortIndicatorOrder();
- model()->sort(column, order);
+ treeModel()->sort(column, order);
}
}
@@ -2292,7 +2292,7 @@ void QTreeWidgetPrivate::_q_selectionChanged(const QItemSelection &selected, con
Q_Q(QTreeWidget);
QModelIndexList indices = selected.indexes();
int i;
- QTreeModel *m = model();
+ QTreeModel *m = treeModel();
for (i = 0; i < indices.count(); ++i) {
QTreeWidgetItem *item = m->item(indices.at(i));
item->d->selected = true;
@@ -2311,11 +2311,11 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight)
{
if (sortingEnabled && topLeft.isValid() && bottomRight.isValid()
- && !model()->sortPendingTimer.isActive()) {
+ && !treeModel()->sortPendingTimer.isActive()) {
int column = header->sortIndicatorSection();
if (column >= topLeft.column() && column <= bottomRight.column()) {
Qt::SortOrder order = header->sortIndicatorOrder();
- model()->ensureSorted(column, order, topLeft.row(),
+ treeModel()->ensureSorted(column, order, topLeft.row(),
bottomRight.row(), topLeft.parent());
}
}
@@ -2543,7 +2543,7 @@ QTreeWidget::~QTreeWidget()
int QTreeWidget::columnCount() const
{
Q_D(const QTreeWidget);
- return d->model()->columnCount();
+ return d->model->columnCount();
}
/*
@@ -2555,7 +2555,7 @@ void QTreeWidget::setColumnCount(int columns)
Q_D(QTreeWidget);
if (columns < 0)
return;
- d->model()->setColumnCount(columns);
+ d->treeModel()->setColumnCount(columns);
}
/*!
@@ -2572,7 +2572,7 @@ void QTreeWidget::setColumnCount(int columns)
QTreeWidgetItem *QTreeWidget::invisibleRootItem() const
{
Q_D(const QTreeWidget);
- return d->model()->rootItem;
+ return d->treeModel()->rootItem;
}
/*!
@@ -2585,7 +2585,7 @@ QTreeWidgetItem *QTreeWidget::invisibleRootItem() const
QTreeWidgetItem *QTreeWidget::topLevelItem(int index) const
{
Q_D(const QTreeWidget);
- return d->model()->rootItem->child(index);
+ return d->treeModel()->rootItem->child(index);
}
/*!
@@ -2600,7 +2600,7 @@ QTreeWidgetItem *QTreeWidget::topLevelItem(int index) const
int QTreeWidget::topLevelItemCount() const
{
Q_D(const QTreeWidget);
- return d->model()->rootItem->childCount();
+ return d->treeModel()->rootItem->childCount();
}
/*!
@@ -2614,7 +2614,7 @@ int QTreeWidget::topLevelItemCount() const
void QTreeWidget::insertTopLevelItem(int index, QTreeWidgetItem *item)
{
Q_D(QTreeWidget);
- d->model()->rootItem->insertChild(index, item);
+ d->treeModel()->rootItem->insertChild(index, item);
}
/*!
@@ -2639,7 +2639,7 @@ void QTreeWidget::addTopLevelItem(QTreeWidgetItem *item)
QTreeWidgetItem *QTreeWidget::takeTopLevelItem(int index)
{
Q_D(QTreeWidget);
- return d->model()->rootItem->takeChild(index);
+ return d->treeModel()->rootItem->takeChild(index);
}
/*!
@@ -2648,8 +2648,8 @@ QTreeWidgetItem *QTreeWidget::takeTopLevelItem(int index)
int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item)
{
Q_D(QTreeWidget);
- d->model()->executePendingSort();
- return d->model()->rootItem->children.indexOf(item);
+ d->treeModel()->executePendingSort();
+ return d->treeModel()->rootItem->children.indexOf(item);
}
/*!
@@ -2661,8 +2661,8 @@ int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item)
int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- d->model()->executePendingSort();
- return d->model()->rootItem->children.indexOf(item);
+ d->treeModel()->executePendingSort();
+ return d->treeModel()->rootItem->children.indexOf(item);
}
/*!
@@ -2677,7 +2677,7 @@ int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item) const
void QTreeWidget::insertTopLevelItems(int index, const QList<QTreeWidgetItem*> &items)
{
Q_D(QTreeWidget);
- d->model()->rootItem->insertChildren(index, items);
+ d->treeModel()->rootItem->insertChildren(index, items);
}
/*!
@@ -2699,7 +2699,7 @@ void QTreeWidget::addTopLevelItems(const QList<QTreeWidgetItem*> &items)
QTreeWidgetItem *QTreeWidget::headerItem() const
{
Q_D(const QTreeWidget);
- return d->model()->headerItem;
+ return d->treeModel()->headerItem;
}
/*!
@@ -2720,16 +2720,16 @@ void QTreeWidget::setHeaderItem(QTreeWidgetItem *item)
int oldCount = columnCount();
if (oldCount < item->columnCount())
- d->model()->beginInsertColumns(QModelIndex(), oldCount, item->columnCount());
+ d->treeModel()->beginInsertColumns(QModelIndex(), oldCount, item->columnCount());
else
- d->model()->beginRemoveColumns(QModelIndex(), item->columnCount(), oldCount);
- delete d->model()->headerItem;
- d->model()->headerItem = item;
+ d->treeModel()->beginRemoveColumns(QModelIndex(), item->columnCount(), oldCount);
+ delete d->treeModel()->headerItem;
+ d->treeModel()->headerItem = item;
if (oldCount < item->columnCount())
- d->model()->endInsertColumns();
+ d->treeModel()->endInsertColumns();
else
- d->model()->endRemoveColumns();
- d->model()->headerDataChanged(Qt::Horizontal, 0, oldCount);
+ d->treeModel()->endRemoveColumns();
+ d->treeModel()->headerDataChanged(Qt::Horizontal, 0, oldCount);
}
@@ -2746,8 +2746,7 @@ void QTreeWidget::setHeaderLabels(const QStringList &labels)
Q_D(QTreeWidget);
if (columnCount() < labels.count())
setColumnCount(labels.count());
- QTreeModel *model = d->model();
- QTreeWidgetItem *item = model->headerItem;
+ QTreeWidgetItem *item = d->treeModel()->headerItem;
for (int i = 0; i < labels.count(); ++i)
item->setText(i, labels.at(i));
}
@@ -2875,7 +2874,7 @@ void QTreeWidget::sortItems(int column, Qt::SortOrder order)
{
Q_D(QTreeWidget);
header()->setSortIndicator(column, order);
- d->model()->sort(column, order);
+ d->model->sort(column, order);
}
/*!
@@ -3042,7 +3041,7 @@ QList<QTreeWidgetItem*> QTreeWidget::selectedItems() const
QList<QTreeWidgetItem*> QTreeWidget::findItems(const QString &text, Qt::MatchFlags flags, int column) const
{
Q_D(const QTreeWidget);
- QModelIndexList indexes = d->model()->match(model()->index(0, column, QModelIndex()),
+ QModelIndexList indexes = d->model->match(model()->index(0, column, QModelIndex()),
Qt::DisplayRole, text, -1, flags);
QList<QTreeWidgetItem*> items;
for (int i = 0; i < indexes.size(); ++i)
@@ -3060,11 +3059,11 @@ QList<QTreeWidgetItem*> QTreeWidget::findItems(const QString &text, Qt::MatchFla
bool QTreeWidget::isItemHidden(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return header()->isHidden();
if (d->hiddenIndexes.isEmpty())
return false;
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
return d->isRowHidden(d->index(item));
}
@@ -3080,7 +3079,7 @@ bool QTreeWidget::isItemHidden(const QTreeWidgetItem *item) const
void QTreeWidget::setItemHidden(const QTreeWidgetItem *item, bool hide)
{
Q_D(QTreeWidget);
- if (item == d->model()->headerItem) {
+ if (item == d->treeModel()->headerItem) {
header()->setHidden(hide);
} else {
const QModelIndex index = d->index(item);
@@ -3100,7 +3099,7 @@ void QTreeWidget::setItemHidden(const QTreeWidgetItem *item, bool hide)
bool QTreeWidget::isItemExpanded(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
return isExpanded(d->index(item));
}
@@ -3117,7 +3116,7 @@ bool QTreeWidget::isItemExpanded(const QTreeWidgetItem *item) const
void QTreeWidget::setItemExpanded(const QTreeWidgetItem *item, bool expand)
{
Q_D(QTreeWidget);
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
setExpanded(d->index(item), expand);
}
@@ -3132,7 +3131,7 @@ void QTreeWidget::setItemExpanded(const QTreeWidgetItem *item, bool expand)
bool QTreeWidget::isFirstItemColumnSpanned(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return false; // We can't set the header items to spanning
const QModelIndex index = d->index(item);
return isFirstColumnSpanned(index.row(), index.parent());
@@ -3149,7 +3148,7 @@ bool QTreeWidget::isFirstItemColumnSpanned(const QTreeWidgetItem *item) const
void QTreeWidget::setFirstItemColumnSpanned(const QTreeWidgetItem *item, bool span)
{
Q_D(QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return; // We can't set header items to spanning
const QModelIndex index = d->index(item);
setFirstColumnSpanned(index.row(), index.parent(), span);
@@ -3163,7 +3162,7 @@ void QTreeWidget::setFirstItemColumnSpanned(const QTreeWidgetItem *item, bool sp
QTreeWidgetItem *QTreeWidget::itemAbove(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return 0;
const QModelIndex index = d->index(item);
const QModelIndex above = indexAbove(index);
@@ -3178,7 +3177,7 @@ QTreeWidgetItem *QTreeWidget::itemAbove(const QTreeWidgetItem *item) const
QTreeWidgetItem *QTreeWidget::itemBelow(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- if (item == d->model()->headerItem)
+ if (item == d->treeModel()->headerItem)
return 0;
const QModelIndex index = d->index(item);
const QModelIndex below = indexBelow(index);
@@ -3218,7 +3217,7 @@ void QTreeWidget::scrollToItem(const QTreeWidgetItem *item, QAbstractItemView::S
void QTreeWidget::expandItem(const QTreeWidgetItem *item)
{
Q_D(QTreeWidget);
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
expand(d->index(item));
}
@@ -3231,7 +3230,7 @@ void QTreeWidget::expandItem(const QTreeWidgetItem *item)
void QTreeWidget::collapseItem(const QTreeWidgetItem *item)
{
Q_D(QTreeWidget);
- QTreeModel::SkipSorting skipSorting(d->model());
+ QTreeModel::SkipSorting skipSorting(d->treeModel());
collapse(d->index(item));
}
@@ -3248,7 +3247,7 @@ void QTreeWidget::clear()
{
Q_D(QTreeWidget);
selectionModel()->clear();
- d->model()->clear();
+ d->treeModel()->clear();
}
/*!
@@ -3273,7 +3272,7 @@ QStringList QTreeWidget::mimeTypes() const
QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
{
Q_D(const QTreeWidget);
- if (d->model()->cachedIndexes.isEmpty()) {
+ if (d->treeModel()->cachedIndexes.isEmpty()) {
QList<QModelIndex> indexes;
for (int i = 0; i < items.count(); ++i) {
QTreeWidgetItem *item = items.at(i);
@@ -3281,9 +3280,9 @@ QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const
indexes << indexFromItem(item, c);
}
}
- return model()->QAbstractItemModel::mimeData(indexes);
+ return d->model->QAbstractItemModel::mimeData(indexes);
}
- return d->model()->internalMimeData();
+ return d->treeModel()->internalMimeData();
}
/*!
@@ -3427,7 +3426,7 @@ bool QTreeWidget::event(QEvent *e)
{
Q_D(QTreeWidget);
if (e->type() == QEvent::Polish)
- d->model()->executePendingSort();
+ d->treeModel()->executePendingSort();
return QTreeView::event(e);
}
diff --git a/src/gui/itemviews/qtreewidget_p.h b/src/gui/itemviews/qtreewidget_p.h
index a089cf5..fb0ee11 100644
--- a/src/gui/itemviews/qtreewidget_p.h
+++ b/src/gui/itemviews/qtreewidget_p.h
@@ -219,12 +219,11 @@ class QTreeWidgetPrivate : public QTreeViewPrivate
Q_DECLARE_PUBLIC(QTreeWidget)
public:
QTreeWidgetPrivate() : QTreeViewPrivate(), explicitSortColumn(-1) {}
- inline QTreeModel *model() const
- { return qobject_cast<QTreeModel*>(q_func()->model()); }
+ inline QTreeModel *treeModel() const { return qobject_cast<QTreeModel*>(model); }
inline QModelIndex index(const QTreeWidgetItem *item, int column = 0) const
- { return model()->index(item, column); }
+ { return treeModel()->index(item, column); }
inline QTreeWidgetItem *item(const QModelIndex &index) const
- { return model()->item(index); }
+ { return treeModel()->item(index); }
void _q_emitItemPressed(const QModelIndex &index);
void _q_emitItemClicked(const QModelIndex &index);
void _q_emitItemDoubleClicked(const QModelIndex &index);
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index fa032e6..cf40ad8 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -3205,18 +3205,16 @@ bool QTextDocumentLayout::contentHasAlignment() const
qreal QTextDocumentLayoutPrivate::scaleToDevice(qreal value) const
{
- QPaintDevice *dev = q_func()->paintDevice();
- if (!dev)
+ if (!paintDevice)
return value;
- return value * dev->logicalDpiY() / qreal(qt_defaultDpi());
+ return value * paintDevice->logicalDpiY() / qreal(qt_defaultDpi());
}
QFixed QTextDocumentLayoutPrivate::scaleToDevice(QFixed value) const
{
- QPaintDevice *dev = q_func()->paintDevice();
- if (!dev)
+ if (!paintDevice)
return value;
- return value * QFixed(dev->logicalDpiY()) / QFixed(qt_defaultDpi());
+ return value * QFixed(paintDevice->logicalDpiY()) / QFixed(qt_defaultDpi());
}
QT_END_NAMESPACE