summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-11-13 04:34:36 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-11-13 04:34:36 (GMT)
commitf7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0 (patch)
tree0ca3736adf4e9c8ad029506b3aa0ba6dfc5ab3d7 /src
parent08405d50115aaf787f09c7c8151bd10f8b4d02ce (diff)
parentee4278059939902482c7f457089aaf484358113b (diff)
downloadQt-f7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0.zip
Qt-f7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0.tar.gz
Qt-f7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-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
7 files changed, 28 insertions, 93 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 f294d65..63115bb 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/util/qmlxmllistmodel.cpp b/src/declarative/util/qmlxmllistmodel.cpp
index 43be9b9..2dfffbf 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 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: