summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-02-23 17:38:46 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-02-23 17:38:46 (GMT)
commit4501731349406110ecde2d260a8ab1e1bcedf179 (patch)
tree5ec176e26bbd207741ca40a1704e654c30fb8571 /src/gui/itemviews
parent3c982b5d214cc7a37ace1d956ac8fb0b9a281722 (diff)
parent0442b383dced6b5cc31e4fc2bf939e3125354f82 (diff)
downloadQt-4501731349406110ecde2d260a8ab1e1bcedf179.zip
Qt-4501731349406110ecde2d260a8ab1e1bcedf179.tar.gz
Qt-4501731349406110ecde2d260a8ab1e1bcedf179.tar.bz2
Merge commit 'refs/merge-requests/1108' of git://gitorious.org/qt/qt into merge-requests/1108
Conflicts: doc/src/declarative/basictypes.qdoc
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qtreeview.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index f1f3236..c0573bb 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2753,6 +2753,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const
int start = -1;
int end = -1;
+ int indexRow = index.row();
int count = d->header->count();
bool emptyHeader = (count == 0);
QModelIndex parent = index.parent();
@@ -2789,7 +2790,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const
int logicalColumn = emptyHeader ? column : d->header->logicalIndex(column);
if (d->header->isSectionHidden(logicalColumn))
continue;
- QModelIndex idx = d->model->index(index.row(), logicalColumn, parent);
+ QModelIndex idx = d->model->index(indexRow, logicalColumn, parent);
if (idx.isValid()) {
QWidget *editor = d->editorForIndex(idx).editor;
if (editor && d->persistent.contains(editor)) {
@@ -3224,14 +3225,14 @@ int QTreeViewPrivate::itemHeight(int item) const
if (viewItems.isEmpty())
return 0;
const QModelIndex &index = viewItems.at(item).index;
+ if (!index.isValid())
+ return 0;
int height = viewItems.at(item).height;
- if (height <= 0 && index.isValid()) {
+ if (height <= 0) {
height = q_func()->indexRowSizeHint(index);
viewItems[item].height = height;
}
- if (!index.isValid() || height < 0)
- return 0;
- return height;
+ return qMax(height, 0);
}