summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-11-13 03:36:01 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-11-13 03:36:01 (GMT)
commitcd2187091e6b357c79f4e0db0a14f210df79f3fd (patch)
tree0f5b0416a605d169f3a2024c53032103340f08b7 /src/declarative
parentf21957b3bb12a16a905f79f3a791931eb77663d9 (diff)
downloadQt-cd2187091e6b357c79f4e0db0a14f210df79f3fd.zip
Qt-cd2187091e6b357c79f4e0db0a14f210df79f3fd.tar.gz
Qt-cd2187091e6b357c79f4e0db0a14f210df79f3fd.tar.bz2
Cleanup.
Diffstat (limited to 'src/declarative')
-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/widgets/graphicslayouts.cpp13
-rw-r--r--src/declarative/widgets/graphicslayouts_p.h13
-rw-r--r--src/declarative/widgets/graphicswidgets.cpp26
6 files changed, 19 insertions, 76 deletions
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 7eb9e53..204887c 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 0a2cc75..a55a57a 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 08d69bc..83c4f97 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/widgets/graphicslayouts.cpp b/src/declarative/widgets/graphicslayouts.cpp
index 9658049..0721102 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 5358e2b..c44cb79 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 5678520..40ba93e 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: