summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-03-18 02:10:34 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-03-19 05:01:45 (GMT)
commit79a02c86c445e50630bcae62a4505f212281ec8b (patch)
tree81cbdc86660b86bf17ce6373802f29483797c0a0
parent78e1a866ba5d594233db80f7aab88331db237d3a (diff)
downloadQt-79a02c86c445e50630bcae62a4505f212281ec8b.zip
Qt-79a02c86c445e50630bcae62a4505f212281ec8b.tar.gz
Qt-79a02c86c445e50630bcae62a4505f212281ec8b.tar.bz2
Add NOTIFY to size property so QML bindings are working fine.
Just add the notify + the signal. Task-number:QTBUG-8277 Reviewed-by:yoann
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp1
-rw-r--r--src/gui/graphicsview/qgraphicswidget.h5
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp4
3 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 5e01785..b0a0ef0 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -391,6 +391,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
QGraphicsSceneResizeEvent re;
re.setOldSize(oldSize);
re.setNewSize(newGeom.size());
+ emit sizeChanged();
QApplication::sendEvent(this, &re);
}
}
diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h
index f1d382b..56b5f88 100644
--- a/src/gui/graphicsview/qgraphicswidget.h
+++ b/src/gui/graphicsview/qgraphicswidget.h
@@ -73,7 +73,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay
Q_PROPERTY(QPalette palette READ palette WRITE setPalette)
Q_PROPERTY(QFont font READ font WRITE setFont)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection)
- Q_PROPERTY(QSizeF size READ size WRITE resize)
+ Q_PROPERTY(QSizeF size READ size WRITE resize NOTIFY sizeChanged)
Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize)
Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize)
Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize)
@@ -175,6 +175,9 @@ public:
using QObject::children;
#endif
+Q_SIGNALS:
+ void sizeChanged();
+
public Q_SLOTS:
bool close();
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 4a874be..91fcf50 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -765,11 +765,13 @@ void tst_QGraphicsWidget::geometry()
{
SubQGraphicsWidget widget;
QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size()));
-
+ QSignalSpy spy(&widget, SIGNAL(sizeChanged()));
QFETCH(QPointF, pos);
QFETCH(QSizeF, size);
widget.setPos(pos);
widget.resize(size);
+ if (!size.isNull())
+ QCOMPARE(spy.count(), 1);
QCOMPARE(widget.geometry(), QRectF(pos, size));
}