diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-24 15:18:05 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-24 15:18:05 (GMT) |
commit | 723dfce0f2af6d93d2c1b50f5e44ad3cf63e058c (patch) | |
tree | f8e1c8693aceea8f1d2fc03d9ad1555b0a441a27 /src/gui/graphicsview | |
parent | f90d8f3fe7e39a20b93a2ddfe0704bc48f3bd5f9 (diff) | |
parent | dab9d7c67ed2eda150c8da9e41db75f7eeeecd0d (diff) | |
download | Qt-723dfce0f2af6d93d2c1b50f5e44ad3cf63e058c.zip Qt-723dfce0f2af6d93d2c1b50f5e44ad3cf63e058c.tar.gz Qt-723dfce0f2af6d93d2c1b50f5e44ad3cf63e058c.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
src/gui/kernel/qapplication_x11.cpp
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicslayout_p.cpp | 4 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicslinearlayout.cpp | 14 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsproxywidget.cpp | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/gui/graphicsview/qgraphicslayout_p.cpp b/src/gui/graphicsview/qgraphicslayout_p.cpp index 6296207..83bf14b 100644 --- a/src/gui/graphicsview/qgraphicslayout_p.cpp +++ b/src/gui/graphicsview/qgraphicslayout_p.cpp @@ -120,8 +120,8 @@ static bool removeLayoutItemFromLayout(QGraphicsLayout *lay, QGraphicsLayoutItem if (!lay) return false; - QGraphicsLayoutItem *child; - for (int i = 0; (child = lay->itemAt(i)); ++i) { + for (int i = lay->count() - 1; i >= 0; --i) { + QGraphicsLayoutItem *child = lay->itemAt(i); if (child && child->isLayout()) { if (removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(child), layoutItem)) return true; diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 2e78fc0..3b037cf 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -323,7 +323,11 @@ void QGraphicsLinearLayout::removeItem(QGraphicsLayoutItem *item) void QGraphicsLinearLayout::removeAt(int index) { Q_D(QGraphicsLinearLayout); - if (QGridLayoutItem *gridItem = d->engine.itemAt(d->gridRow(index), d->gridColumn(index))) { + if (index < 0 || index >= d->engine.itemCount()) { + qWarning("QGraphicsLinearLayout::removeAt: invalid index %d", index); + return; + } + if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) { if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem()) layoutItem->setParentLayoutItem(0); d->removeGridItem(gridItem); @@ -463,7 +467,7 @@ QSizePolicy::ControlTypes QGraphicsLinearLayout::controlTypes(LayoutSide side) c int QGraphicsLinearLayout::count() const { Q_D(const QGraphicsLinearLayout); - return d->engine.rowCount(d->orientation); + return d->engine.itemCount(); } /*! @@ -472,8 +476,12 @@ int QGraphicsLinearLayout::count() const QGraphicsLayoutItem *QGraphicsLinearLayout::itemAt(int index) const { Q_D(const QGraphicsLinearLayout); + if (index < 0 || index >= d->engine.itemCount()) { + qWarning("QGraphicsLinearLayout::itemAt: invalid index %d", index); + return 0; + } QGraphicsLayoutItem *item = 0; - if (QGridLayoutItem *gridItem = d->engine.itemAt(d->gridRow(index), d->gridColumn(index))) + if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) item = gridItem->layoutItem(); return item; } diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 1f3637d..ab94679 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -843,7 +843,7 @@ bool QGraphicsProxyWidget::event(QEvent *event) // ### Qt 4.5: this code must also go into a reimplementation // of inputMethodEvent(). QWidget *focusWidget = d->widget->focusWidget(); - if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) + if (focusWidget && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) QApplication::sendEvent(focusWidget, event); break; } |