From df03a1c5b0b6d155385f2df67fabd6e974aaa1ad Mon Sep 17 00:00:00 2001 From: Marius Bugge Monsen Date: Mon, 13 Jul 2009 16:22:48 +0200 Subject: Add QT_NAMESPACE macros in the source files. --- src/qgraphicstableview.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src/qgraphicstableview.cpp') diff --git a/src/qgraphicstableview.cpp b/src/qgraphicstableview.cpp index d8c4a7d..a52faeb 100644 --- a/src/qgraphicstableview.cpp +++ b/src/qgraphicstableview.cpp @@ -39,6 +39,8 @@ #include +QT_BEGIN_NAMESPACE + // QtGraphicsTableViewItem QtGraphicsTableViewItem::QtGraphicsTableViewItem(int row, int column, QtGraphicsTableView *view) @@ -339,7 +341,7 @@ void QtGraphicsTableViewPrivate::checkItems(int firstRow, int firstColumn, int r Q_UNUSED(firstColumn); Q_UNUSED(rowCount); Q_UNUSED(columnCount); - QHash::iterator it = items.begin(); + QHash::iterator it = items.begin(); while (it != items.end()) { creator->recycle(it.value()); ++it; @@ -1044,7 +1046,7 @@ void QtGraphicsTableView::doLayout() const int row = verticalMapping.value(verticalSection, verticalSection); for (int horizontalSection = oldFirstHorizontalSection; horizontalSection <= oldLastHorizontalSection; ++horizontalSection) { const int column = horizontalMapping.value(horizontalSection, horizontalSection); - const int index = (row * columnCount) + column; + const qint64 index = (row * columnCount) + column; if (QtGraphicsTableViewItem *item = d->items.take(index)) unused.push(item); } @@ -1054,7 +1056,7 @@ void QtGraphicsTableView::doLayout() int column = horizontalMapping.value(horizontalSection, horizontalSection); for (int verticalSection = firstVerticalSection; verticalSection <= lastVerticalSection; ++verticalSection) { const int row = verticalMapping.value(verticalSection, verticalSection); - const int index = (row * columnCount) + column; + const qint64 index = (row * columnCount) + column; if (QtGraphicsTableViewItem *item = d->items.take(index)) unused.push(item); } @@ -1064,7 +1066,7 @@ void QtGraphicsTableView::doLayout() const int row = verticalMapping.value(verticalSection, verticalSection); for (int horizontalSection = oldFirstHorizontalSection; horizontalSection <= oldLastHorizontalSection; ++horizontalSection) { const int column = horizontalMapping.value(horizontalSection, horizontalSection); - const int index = (row * columnCount) + column; + const qint64 index = (row * columnCount) + column; if (QtGraphicsTableViewItem *item = d->items.take(index)) unused.push(item); } @@ -1074,7 +1076,7 @@ void QtGraphicsTableView::doLayout() int column = horizontalMapping.value(horizontalSection, horizontalSection); for (int verticalSection = firstVerticalSection; verticalSection <= lastVerticalSection; ++verticalSection) { const int row = verticalMapping.value(verticalSection, verticalSection); - const int index = (row * columnCount) + column; + const qint64 index = (row * columnCount) + column; if (QtGraphicsTableViewItem *item = d->items.take(index)) unused.push(item); } @@ -1089,7 +1091,7 @@ void QtGraphicsTableView::doLayout() for (int horizontalSection = firstHorizontalSection; horizontalSection <= lastHorizontalSection; ++horizontalSection) { const int column = horizontalMapping.value(horizontalSection, horizontalSection); const qreal width = columnWidth(column); - const int index = (row * columnCount) + column; + const qint64 index = (row * columnCount) + column; QtGraphicsTableViewItem *item = d->items.value(index); if (!item) { if (unused.isEmpty()) @@ -1364,4 +1366,21 @@ bool QtGraphicsTableView::event(QEvent *event) return QObject::event(event); } +/*! + \reimp + */ +QVariant QtGraphicsTableView::itemChange(GraphicsItemChange change, const QVariant &value) +{ + Q_D(QtGraphicsTableView); + if (change == QGraphicsItem::ItemChildRemovedChange) { + QGraphicsItem *item = qvariant_cast(value); + qint64 key = d->items.key(static_cast(item), -1); + if (key != -1) + d->items.remove(key); + } + return QGraphicsWidget::itemChange(change, value); +} + +QT_END_NAMESPACE + #include "moc_qgraphicstableview.cpp" -- cgit v1.2.3