summaryrefslogtreecommitdiff
path: root/src/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-11-13 14:49:40 +1000
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-11-13 14:49:40 +1000
commit14821863b830b85ccb29df217a52f1ca52c9c421 (patch)
tree472e41f9c7e54cc6c9ea1fe1d63218d2960876ea /src/declarative
parentf2d9bdb36061b4b419e777075027f609bf9890b2 (diff)
parentf7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0 (diff)
downloadqt4-tools-14821863b830b85ccb29df217a52f1ca52c9c421.tar.gz
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts: doc/src/declarative/globalobject.qdoc
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/declarative.pro4
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsborderimage.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgridview.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem.cpp64
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview.cpp20
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview_p.h2
-rw-r--r--src/declarative/qml/qmlcomponent.cpp16
-rw-r--r--src/declarative/qml/qmlinfo.cpp2
-rw-r--r--src/declarative/qml/qmlmetatype.h2
-rw-r--r--src/declarative/util/qmlstategroup.cpp2
-rw-r--r--src/declarative/util/qmltimer.cpp2
-rw-r--r--src/declarative/util/qmltransition.cpp3
-rw-r--r--src/declarative/util/qmlview.cpp38
-rw-r--r--src/declarative/util/qmlview.h2
-rw-r--r--src/declarative/util/qmlxmllistmodel.cpp26
-rw-r--r--src/declarative/widgets/graphicslayouts.cpp13
-rw-r--r--src/declarative/widgets/graphicslayouts_p.h13
-rw-r--r--src/declarative/widgets/graphicswidgets.cpp26
18 files changed, 106 insertions, 133 deletions
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index da8434f3ad..62ae289c98 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -9,8 +9,8 @@ solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtXml
-# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
-# LIBS += -lgcov
+QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
+LIBS += -lgcov
INCLUDEPATH += ../../include/QtDeclarative
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
index 634215e08c..04e79f9c72 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
@@ -55,7 +55,7 @@ QML_DEFINE_TYPE(Qt,4,6,BorderImage,QmlGraphicsBorderImage)
\brief The BorderImage element provides an image that can be used as a border.
\inherits Item
- \snippet examples/declarative/border-image/example.qml 0
+ \snippet snippets/declarative/border-image.qml 0
\image BorderImage.png
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
index 1b94426062..29eb983bbc 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
@@ -353,7 +353,7 @@ FxGridItem *QmlGraphicsGridViewPrivate::createItem(int modelIndex)
listItem->index = modelIndex;
// complete
model->completeItem();
- listItem->item->setZValue(modelIndex + 1);
+ listItem->item->setZValue(1);
listItem->item->setParent(q->viewport());
}
requestedIndex = 0;
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
index 69564c4672..ca45f62ebb 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
@@ -1325,6 +1325,24 @@ QmlGraphicsKeysAttached *QmlGraphicsKeysAttached::qmlAttachedProperties(QObject
}
\endqml
+ \section1 Identity
+
+ Each item has an "id" - the identifier of the Item.
+
+ The identifier can be used in bindings and other expressions to
+ refer to the item. For example:
+
+ \qml
+ Text { id: myText; ... }
+ Text { text: myText.text }
+ \endqml
+
+ The identifier is available throughout to the \l {components}{component}
+ where it is declared. The identifier must be unique in the component.
+
+ The id should not be thought of as a "property" - it makes no sense
+ to write \c myText.id, for example.
+
\section1 Key Handling
Key handling is available to all Item-based visual elements via the \l {Keys}{Keys}
@@ -1510,6 +1528,14 @@ void QmlGraphicsItem::setParentItem(QmlGraphicsItem *parent)
}
/*!
+ \fn void QmlGraphicsItem::setParent(QmlGraphicsItem *parent)
+ \overload
+ Sets both the parent object and parent item to \a parent. This
+ function avoids the programming error of calling setParent()
+ when you mean setParentItem().
+*/
+
+/*!
Returns the QmlGraphicsItem parent of this item.
*/
QmlGraphicsItem *QmlGraphicsItem::parentItem() const
@@ -1994,22 +2020,6 @@ QVariant QmlGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const
}
/*!
- \qmlproperty string Item::id
- This property holds the identifier for the item.
-
- The identifier can be used in bindings and other expressions to
- refer to the item. For example:
-
- \qml
- Text { id: myText; ... }
- Text { text: myText.text }
- \endqml
-
- The identifier is available throughout to the \l {components}{component}
- where it is declared. The identifier must be unique in thecomponent.
-*/
-
-/*!
\internal
*/
QmlGraphicsAnchorLine QmlGraphicsItem::left() const
@@ -2357,7 +2367,7 @@ bool QmlGraphicsItem::keepMouseGrab() const
to steal a mouse grab if it detects that the user has begun to
move the viewport.
- \sa keepMouseGrab
+ \sa keepMouseGrab()
*/
void QmlGraphicsItem::setKeepMouseGrab(bool keep)
{
@@ -2801,12 +2811,19 @@ void QmlGraphicsItem::resetWidth()
setImplicitWidth(implicitWidth());
}
+/*!
+ Returns the width of the item that is implied by other properties that determine the content.
+*/
qreal QmlGraphicsItem::implicitWidth() const
{
Q_D(const QmlGraphicsItem);
return d->implicitWidth;
}
+/*!
+ Sets the implied width of the item to \a w.
+ This is the width implied by other properties that determine the content.
+*/
void QmlGraphicsItem::setImplicitWidth(qreal w)
{
Q_D(QmlGraphicsItem);
@@ -2824,6 +2841,9 @@ void QmlGraphicsItem::setImplicitWidth(qreal w)
QRectF(x(), y(), oldWidth, height()));
}
+/*!
+ Returns whether the width property has been set explicitly.
+*/
bool QmlGraphicsItem::widthValid() const
{
Q_D(const QmlGraphicsItem);
@@ -2860,12 +2880,19 @@ void QmlGraphicsItem::resetHeight()
setImplicitHeight(implicitHeight());
}
+/*!
+ Returns the height of the item that is implied by other properties that determine the content.
+*/
qreal QmlGraphicsItem::implicitHeight() const
{
Q_D(const QmlGraphicsItem);
return d->implicitHeight;
}
+/*!
+ Sets the implied height of the item to \a h.
+ This is the height implied by other properties that determine the content.
+*/
void QmlGraphicsItem::setImplicitHeight(qreal h)
{
Q_D(QmlGraphicsItem);
@@ -2883,6 +2910,9 @@ void QmlGraphicsItem::setImplicitHeight(qreal h)
QRectF(x(), y(), width(), oldHeight));
}
+/*!
+ Returns whether the height property has been set explicitly.
+*/
bool QmlGraphicsItem::heightValid() const
{
Q_D(const QmlGraphicsItem);
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
index 14c4352518..6dbf053ba3 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
@@ -309,7 +309,8 @@ QmlGraphicsWebView::Status QmlGraphicsWebView::status() const
\qmlproperty real WebView::progress
This property holds the progress of loading the current URL, from 0 to 1.
- \sa onLoadFinished() onLoadFailed()
+ If you just want to know when progress gets to 1, use
+ WebView::onLoadFinished() or WebView::onLoadFailed() instead.
*/
qreal QmlGraphicsWebView::progress() const
{
@@ -1057,27 +1058,26 @@ void QmlGraphicsWebView::setPage(QWebPage *page)
\qmlsignal WebView::onLoadStarted()
This handler is called when the web engine begins loading
- a page.
-
- \sa progress onLoadFinished() onLoadFailed()
+ a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed()
+ will be emitted.
*/
/*!
\qmlsignal WebView::onLoadFinished()
- This handler is called when the web engine finishes loading
- a page, including any component content.
+ This handler is called when the web engine \e successfully
+ finishes loading a page, including any component content
+ (WebView::onLoadFailed() will be emitted otherwise).
- \sa progress onLoadFailed()
+ \sa progress
*/
/*!
\qmlsignal WebView::onLoadFailed()
This handler is called when the web engine fails loading
- a page or any component content.
-
- \sa progress onLoadFinished()
+ a page or any component content
+ (WebView::onLoadFinished() will be emitted on success).
*/
void QmlGraphicsWebView::load(const QNetworkRequest &request,
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h
index 7c9faf489b..1d55830d4d 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h
@@ -128,6 +128,7 @@ public:
qreal zoomFactor() const;
void setZoomFactor(qreal);
Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom);
+ QRect elementAreaAt(int x, int y, int minwidth, int minheight) const;
int preferredWidth() const;
void setPreferredWidth(int);
@@ -223,7 +224,6 @@ protected:
virtual void focusChanged(bool);
virtual bool sceneEvent(QEvent *event);
QmlGraphicsWebView *createWindow(QWebPage::WebWindowType type);
- QRect elementAreaAt(int x, int y, int minwidth, int minheight) const;
private:
void init();
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 3c142a7263..e31a1b5c67 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -236,7 +236,9 @@ QmlComponent::Status QmlComponent::status() const
}
/*!
- Returns true if the component is in the Null state, false otherwise.
+ \property QmlComponent::isNull
+
+ Is true if the component is in the Null state, false otherwise.
Equivalent to status() == QmlComponent::Null.
*/
@@ -246,7 +248,9 @@ bool QmlComponent::isNull() const
}
/*!
- Returns true if the component is in the Ready state, false otherwise.
+ \property QmlComponent::isReady
+
+ Is true if the component is in the Ready state, false otherwise.
Equivalent to status() == QmlComponent::Ready.
*/
@@ -256,7 +260,9 @@ bool QmlComponent::isReady() const
}
/*!
- Returns true if the component is in the Error state, false otherwise.
+ \property QmlComponent::isError
+
+ Is true if the component is in the Error state, false otherwise.
Equivalent to status() == QmlComponent::Error.
*/
@@ -266,7 +272,9 @@ bool QmlComponent::isError() const
}
/*!
- Returns true if the component is in the Loading state, false otherwise.
+ \property QmlComponent::isLoading
+
+ Is true if the component is in the Loading state, false otherwise.
Equivalent to status() == QmlComponent::Loading.
*/
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp
index 7a194e0f81..bbd6022620 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qmlinfo.cpp
@@ -47,7 +47,7 @@
QT_BEGIN_NAMESPACE
/*!
- \fn void qmlInfo(const QString& message, const QObject *object)
+ \fn QmlInfo qmlInfo(const QObject *object)
\brief Prints warnings messages that include the file and line number for QML types.
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index 9a17c34bf9..99d6743cfb 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -220,7 +220,7 @@ int qmlRegisterExtendedType(const char *typeName)
attachedMo = QmlPrivate::attachedPropertiesMetaObject<T>();
}
- return QmlMetaType::registerType(ids, QmlPrivate::list_nocreate_op<T>, 0, 0, 0, 0, 0,
+ return QmlMetaType::registerType(ids, QmlPrivate::list_nocreate_op<T>, 0, 0, 0, 0,
&T::staticMetaObject, attached, attachedMo,
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp
index 2d3ca4c3f9..506ab82ce3 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qmlstategroup.cpp
@@ -109,7 +109,7 @@ public:
}
\endqml
- \sa {qmlstate}{States} and {state-transitions}{Transitions}
+ \sa {qmlstate}{States} {state-transitions}{Transitions}
*/
QmlStateGroup::QmlStateGroup(QObject *parent)
diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp
index c1b350490b..0be62f47d0 100644
--- a/src/declarative/util/qmltimer.cpp
+++ b/src/declarative/util/qmltimer.cpp
@@ -260,7 +260,7 @@ void QmlTimer::componentComplete()
}
/*!
- \qmlsignal Timer::onTriggered
+ \qmlsignal Timer::onTriggered()
This handler is called when the Timer is triggered.
*/
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 7eb9e53f30..204887c6ae 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -111,7 +111,7 @@ public:
public:
AnimationList() : parent(0) {}
virtual void append(QmlAbstractAnimation *a);
- virtual void clear() { QmlConcreteList<QmlAbstractAnimation *>::clear(); } //XXX
+ virtual void clear() { QmlConcreteList<QmlAbstractAnimation *>::clear(); } //###
QmlTransitionPrivate *parent;
};
@@ -127,7 +127,6 @@ void QmlTransitionPrivate::AnimationList::append(QmlAbstractAnimation *a)
void ParallelAnimationWrapper::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
QParallelAnimationGroup::updateState(newState, oldState);
- //XXX not 100% guaranteed to be at end (if there are many zero duration animations at the end)?
if (newState == Stopped &&
((direction() == QAbstractAnimation::Forward && currentLoopTime() == duration()) ||
(direction() == QAbstractAnimation::Backward && currentLoopTime() == 0)))
diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp
index f294d65aec..63115bb546 100644
--- a/src/declarative/util/qmlview.cpp
+++ b/src/declarative/util/qmlview.cpp
@@ -124,12 +124,6 @@ void FrameBreakAnimation::updateCurrentTime(int msecs)
server->frameBreak();
}
-
-static QVariant stringToKeySequence(const QString &str)
-{
- return QVariant::fromValue(QKeySequence(str));
-}
-
class QmlViewPrivate
{
public:
@@ -190,13 +184,12 @@ QmlView::QmlView(QWidget *parent)
void QmlViewPrivate::init()
{
- // XXX: These need to be put in a central location for this kind of thing
- QmlMetaType::registerCustomStringConverter(QVariant::KeySequence, &stringToKeySequence);
-
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::FontDatabase> perf;
+ {
+ QmlPerfTimer<QmlPerf::FontDatabase> perf;
+ QFontDatabase database;
+ }
#endif
- QFontDatabase database;
q->setScene(&scene);
@@ -520,7 +513,7 @@ QmlGraphicsItem* QmlView::addItem(const QString &qml, QmlGraphicsItem* parent)
}
/*!
- Deletes the view's \l {QmlGraphicsItem} {items} and the \l {QmlEngine}
+ Deletes the view's \l {QmlGraphicsItem} {items} and clears the \l {QmlEngine}
{QML engine's} Component cache.
*/
void QmlView::reset()
@@ -582,25 +575,4 @@ void QmlView::paintEvent(QPaintEvent *event)
qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time;
}
-/*! \fn void QmlView::focusInEvent(QFocusEvent *e)
- This virtual function does nothing with the event \a e
- in this class.
- */
-void QmlView::focusInEvent(QFocusEvent *e)
-{
- // Do nothing (do not call QWidget::update())
- QGraphicsView::focusInEvent(e);
-}
-
-
-/*! \fn void QmlView::focusOutEvent(QFocusEvent *e)
- This virtual function does nothing with the event \a e
- in this class.
- */
-void QmlView::focusOutEvent(QFocusEvent *e)
-{
- // Do nothing (do not call QWidget::update())
- QGraphicsView::focusOutEvent(e);
-}
-
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlview.h b/src/declarative/util/qmlview.h
index 08d69bc0be..83c4f97c4f 100644
--- a/src/declarative/util/qmlview.h
+++ b/src/declarative/util/qmlview.h
@@ -98,8 +98,6 @@ private Q_SLOTS:
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void paintEvent(QPaintEvent *event);
- void focusInEvent(QFocusEvent *);
- void focusOutEvent(QFocusEvent *);
void timerEvent(QTimerEvent*);
private:
diff --git a/src/declarative/util/qmlxmllistmodel.cpp b/src/declarative/util/qmlxmllistmodel.cpp
index 43be9b9dbc..2dfffbf22b 100644
--- a/src/declarative/util/qmlxmllistmodel.cpp
+++ b/src/declarative/util/qmlxmllistmodel.cpp
@@ -132,8 +132,6 @@ struct QmlXmlRoleList : public QmlConcreteList<QmlXmlListModelRole *>
QmlXmlRoleList(QmlXmlListModelPrivate *p)
: model(p) {}
virtual void append(QmlXmlListModelRole *role);
- //XXX clear, removeAt, and insert need to invalidate any cached data (in data table) as well
- // (and the model should emit the appropriate signals)
virtual void clear();
virtual void removeAt(int i);
virtual void insert(int i, QmlXmlListModelRole *role);
@@ -309,7 +307,7 @@ void QmlXmlQuery::doSubQueryJob()
b.seek(0);
}
- //XXX this method is much slower, but would work better for incremental loading
+ //this method is much slower, but works better for incremental loading
/*for (int j = 0; j < m_size; ++j) {
QList<QVariant> resultList;
for (int i = 0; i < m_roleObjects->size(); ++i) {
@@ -338,13 +336,6 @@ void QmlXmlQuery::doSubQueryJob()
}*/
}
-
-//TODO: error handling (currently quite fragile)
-// profile doQuery and doSubquery
-// support complex/nested objects?
-// how do we handle data updates (like rss feed -- usually items inserted at beginning)
-
-
class QmlXmlListModelPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QmlXmlListModel)
@@ -373,14 +364,12 @@ public:
};
-void QmlXmlRoleList::append(QmlXmlListModelRole *role) {
- QmlConcreteList<QmlXmlListModelRole *>::append(role);
- model->roles << model->highestRole;
- model->roleNames << role->name();
- ++model->highestRole;
+void QmlXmlRoleList::append(QmlXmlListModelRole *role)
+{
+ insert(size(), role);
}
-//XXX clear, removeAt, and insert need to invalidate any cached data (in data table) as well
+//### clear, removeAt, and insert need to invalidate any cached data (in data table) as well
// (and the model should emit the appropriate signals)
void QmlXmlRoleList::clear()
{
@@ -396,10 +385,13 @@ void QmlXmlRoleList::removeAt(int i)
QmlConcreteList<QmlXmlListModelRole *>::removeAt(i);
}
-//### we should enforce unique role names
void QmlXmlRoleList::insert(int i, QmlXmlListModelRole *role)
{
QmlConcreteList<QmlXmlListModelRole *>::insert(i, role);
+ if (model->roleNames.contains(role->name())) {
+ qmlInfo(role) << QObject::tr("\"%1\" duplicates a previous role name and will be disabled.").arg(role->name());
+ return;
+ }
model->roles.insert(i, model->highestRole);
model->roleNames.insert(i, role->name());
++model->highestRole;
diff --git a/src/declarative/widgets/graphicslayouts.cpp b/src/declarative/widgets/graphicslayouts.cpp
index 9658049f07..072110291a 100644
--- a/src/declarative/widgets/graphicslayouts.cpp
+++ b/src/declarative/widgets/graphicslayouts.cpp
@@ -128,11 +128,11 @@ void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutIte
this, SLOT(updateStretch(QGraphicsLayoutItem*,int)));
QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)),
this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment)));
- //XXX need to disconnect when widget is removed?
+ //### need to disconnect when widget is removed?
}
}
-//XXX is there a better way to do this?
+//### is there a better way to do this?
void QGraphicsLinearLayoutObject::clearChildren()
{
for (int i = 0; i < count(); ++i)
@@ -156,11 +156,6 @@ LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject
if (!qobject_cast<QGraphicsLayoutItem*>(obj))
return 0;
LinearLayoutAttached *rv = new LinearLayoutAttached(obj);
- /*if (QGraphicsLinearLayoutObject *lo = qobject_cast<QGraphicsLinearLayoutObject*>(obj->parent()))
- QObject::connect(rv, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)),
- lo, SLOT(updateStretch(QGraphicsLayoutItem*,int)));
- QObject::connect(rv, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)),
- lo, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment)));*/
attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
return rv;
}
@@ -293,7 +288,7 @@ void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item)
}
}
-//XXX is there a better way to do this?
+//### is there a better way to do this?
void QGraphicsGridLayoutObject::clearChildren()
{
for (int i = 0; i < count(); ++i)
@@ -304,7 +299,7 @@ qreal QGraphicsGridLayoutObject::spacing() const
{
if (verticalSpacing() == horizontalSpacing())
return verticalSpacing();
- return -1; //XXX
+ return -1; //###
}
QHash<QGraphicsLayoutItem*, GridLayoutAttached*> QGraphicsGridLayoutObject::attachedProperties;
diff --git a/src/declarative/widgets/graphicslayouts_p.h b/src/declarative/widgets/graphicslayouts_p.h
index 5358e2bf56..c44cb79917 100644
--- a/src/declarative/widgets/graphicslayouts_p.h
+++ b/src/declarative/widgets/graphicslayouts_p.h
@@ -62,10 +62,6 @@ public:
virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const;
};
-//TODO:
-// -content margins
-// -per-item spacing (does this need to be exposed?)
-// -per-item alignment
class LinearLayoutAttached;
class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout
{
@@ -117,13 +113,6 @@ private:
ChildList _children;
};
-//TODO:
-// -content margins
-// -column and row specific settings:
-// -alignment
-// -fixed/min/max/preferred width
-// -spacing
-// -stretch
class GridLayoutAttached;
class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout
{
@@ -166,7 +155,7 @@ private:
virtual int count() const { return obj->count(); }
virtual void removeAt(int i) { obj->removeAt(i); }
virtual QGraphicsLayoutItem *at(int i) const { return obj->itemAt(i); }
- //XXX GridLayout doesn't have an insert, so for now we treat it as an append.
+ //### GridLayout doesn't have an insert, so for now we treat it as an append.
// this is obviously potenitally dangerous -- perhaps should be a concrete
// list with no relation to layout index, etc at all.
virtual void insert(int, QGraphicsLayoutItem *item) { append(item); }
diff --git a/src/declarative/widgets/graphicswidgets.cpp b/src/declarative/widgets/graphicswidgets.cpp
index 5678520e6f..40ba93eee8 100644
--- a/src/declarative/widgets/graphicswidgets.cpp
+++ b/src/declarative/widgets/graphicswidgets.cpp
@@ -43,7 +43,6 @@
QT_BEGIN_NAMESPACE
-//### the single (default) property could alternatively be added to graphics view directly
class QGraphicsViewDeclarativeUI : public QObject
{
Q_OBJECT
@@ -83,27 +82,23 @@ private:
virtual void clear()
{
for (int i = 0; i < count(); ++i)
- if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
- static_cast<QGraphicsScene *>(q)->removeItem(w);
+ if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(at(i)))
+ static_cast<QGraphicsScene *>(q)->removeItem(go);
QmlConcreteList<QObject *>::clear();
}
virtual void removeAt(int i)
{
- if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i)))
- static_cast<QGraphicsScene *>(q)->removeItem(w);
+ if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(at(i)))
+ static_cast<QGraphicsScene *>(q)->removeItem(go);
QmlConcreteList<QObject *>::removeAt(i);
}
virtual void insert(int i, QObject *o)
{
QmlConcreteList<QObject *>::insert(i, o);
-
- //XXX are there any cases when insertion should be different from appension?
- if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(o))
- static_cast<QGraphicsScene *>(q)->addItem(w);
+ if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o))
+ static_cast<QGraphicsScene *>(q)->addItem(go);
//else if (QWidget *w = qobject_cast<QWidget *>(o))
// static_cast<QGraphicsScene *>(q)->addWidget(w);
- //else
- // qWarning() << "Can't add" << o << "to a QGraphicsScene";
}
private:
QObject *q;
@@ -139,11 +134,6 @@ private:
wid->setParentItem(static_cast<QGraphicsWidget *>(parent()));
}
- //###
- void clearWidget()
- {
- }
-
class WidgetList : public QmlConcreteList<QGraphicsItem *>
{
public:
@@ -151,8 +141,8 @@ private:
: obj(o) {}
virtual void append(QGraphicsItem *w) { QmlConcreteList<QGraphicsItem *>::append(w); obj->setItemParent(w); }
- virtual void clear() { QmlConcreteList<QGraphicsItem *>::clear(); obj->clearWidget(); }
- virtual void removeAt(int i) { QmlConcreteList<QGraphicsItem *>::removeAt(i); } //XXX
+ virtual void clear() { QmlConcreteList<QGraphicsItem *>::clear(); } //###
+ virtual void removeAt(int i) { QmlConcreteList<QGraphicsItem *>::removeAt(i); } //###
virtual void insert(int i, QGraphicsItem *item) { QmlConcreteList<QGraphicsItem *>::insert(i, item); obj->setItemParent(item); }
private: