don't crash on parse errors

This commit is contained in:
Marco Martin 2012-01-09 17:42:59 +01:00
parent e9188f712a
commit 4c2e802a7d
2 changed files with 12 additions and 7 deletions

View File

@ -216,25 +216,25 @@ QDeclarativeListProperty<QGraphicsObject> FullScreenDialog::title()
if (m_rootObject) {
return m_rootObject.data()->property("title").value<QDeclarativeListProperty<QGraphicsObject> >();
} else {
return QDeclarativeListProperty<QGraphicsObject>();
return QDeclarativeListProperty<QGraphicsObject>(this, m_dummyTitleElements);
}
}
QDeclarativeListProperty<QGraphicsObject> FullScreenDialog::content() const
QDeclarativeListProperty<QGraphicsObject> FullScreenDialog::content()
{
if (m_rootObject) {
return m_rootObject.data()->property("content").value<QDeclarativeListProperty<QGraphicsObject> >();
} else {
return QDeclarativeListProperty<QGraphicsObject>();
return QDeclarativeListProperty<QGraphicsObject>(this, m_dummyContentElements);
}
}
QDeclarativeListProperty<QGraphicsObject> FullScreenDialog::buttons() const
QDeclarativeListProperty<QGraphicsObject> FullScreenDialog::buttons()
{
if (m_rootObject) {
return m_rootObject.data()->property("buttons").value<QDeclarativeListProperty<QGraphicsObject> >();
} else {
return QDeclarativeListProperty<QGraphicsObject>();
return QDeclarativeListProperty<QGraphicsObject>(this, m_dummyButtonsElements);
}
}

View File

@ -56,8 +56,8 @@ public:
//QML properties
QDeclarativeListProperty<QGraphicsObject> title();
QDeclarativeListProperty<QGraphicsObject> content() const;
QDeclarativeListProperty<QGraphicsObject> buttons() const;
QDeclarativeListProperty<QGraphicsObject> content();
QDeclarativeListProperty<QGraphicsObject> buttons();
DialogStatus::Status status() const;
Q_INVOKABLE void open();
@ -86,6 +86,11 @@ private:
QGraphicsScene *m_scene;
QWeakPointer<QObject> m_rootObject;
static uint s_numItems;
//those only used in case of error, to not make plasma crash
QList<QGraphicsObject *> m_dummyTitleElements;
QList<QGraphicsObject *> m_dummyContentElements;
QList<QGraphicsObject *> m_dummyButtonsElements;
};
#endif