summaryrefslogtreecommitdiffstats
path: root/src/qgraphicstableview.cpp
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-07-13 16:22:48 +0200
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-07-13 16:22:48 +0200
commitdf03a1c5b0b6d155385f2df67fabd6e974aaa1ad (patch)
tree36f6853ef256793594df5fcf7c70655f85d6ac04 /src/qgraphicstableview.cpp
parentab9fbf33d583b2567ac5d24077c5bba23c5a6567 (diff)
Add QT_NAMESPACE macros in the source files.
Diffstat (limited to 'src/qgraphicstableview.cpp')
-rw-r--r--src/qgraphicstableview.cpp31
1 files changed, 25 insertions, 6 deletions
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 <qgraphicssceneevent.h>
+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<int, QtGraphicsTableViewItem*>::iterator it = items.begin();
+ QHash<qint64, QtGraphicsTableViewItem*>::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<QGraphicsItem*>(value);
+ qint64 key = d->items.key(static_cast<QtGraphicsTableViewItem*>(item), -1);
+ if (key != -1)
+ d->items.remove(key);
+ }
+ return QGraphicsWidget::itemChange(change, value);
+}
+
+QT_END_NAMESPACE
+
#include "moc_qgraphicstableview.cpp"