summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/declarative/flickr/flickr.qml2
-rw-r--r--demos/declarative/flickr/flickr2.qml2
-rw-r--r--demos/declarative/samegame/content/BoomBlock.qml10
-rw-r--r--doc/src/declarative/elements.qdoc12
-rw-r--r--examples/declarative/minehunt/Description.qml4
-rw-r--r--examples/declarative/minehunt/main.cpp4
-rw-r--r--examples/declarative/minehunt/minehunt.qml34
-rw-r--r--examples/declarative/velocity/Day.qml1
-rw-r--r--src/declarative/extra/qfxparticles.cpp44
-rw-r--r--src/declarative/fx/fx.pri4
-rw-r--r--src/declarative/fx/qfxgraphicsobjectcontainer.cpp (renamed from src/declarative/fx/qfxwidgetcontainer.cpp)47
-rw-r--r--src/declarative/fx/qfxgraphicsobjectcontainer.h (renamed from src/declarative/fx/qfxwidgetcontainer.h)28
-rw-r--r--src/declarative/fx/qfximage.cpp38
-rw-r--r--src/declarative/fx/qfximage.h4
-rw-r--r--src/declarative/fx/qfxitem.cpp5
-rw-r--r--src/declarative/fx/qfxitem.h5
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp46
-rw-r--r--src/declarative/fx/qfxkeyproxy.h1
-rw-r--r--src/declarative/fx/qfxlineedit.cpp28
-rw-r--r--src/declarative/fx/qfxlineedit.h7
-rw-r--r--src/declarative/fx/qfxlineedit_p.h6
-rw-r--r--src/declarative/util/qmltransitionmanager.cpp9
22 files changed, 147 insertions, 194 deletions
diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml
index edf1095..7f45b1c 100644
--- a/demos/declarative/flickr/flickr.qml
+++ b/demos/declarative/flickr/flickr.qml
@@ -120,7 +120,7 @@ Item {
anchors.fill: parent
- Image { source: "content/pics/background.png"; opaque: true; anchors.fill: parent }
+ Image { source: "content/pics/background.png"; anchors.fill: parent }
Loading { anchors.centeredIn: parent; visible: FeedModel.status != 0 }
diff --git a/demos/declarative/flickr/flickr2.qml b/demos/declarative/flickr/flickr2.qml
index d6d5c95..95bca38 100644
--- a/demos/declarative/flickr/flickr2.qml
+++ b/demos/declarative/flickr/flickr2.qml
@@ -180,7 +180,7 @@ Item {
id: Background
property var imageDetails: ImageDetails
- Image { source: "content/pics/background.png"; opaque: true }
+ Image { source: "content/pics/background.png" }
GridView {
id: PhotoGridView; model: MyVisualModel.parts.gridView
diff --git a/demos/declarative/samegame/content/BoomBlock.qml b/demos/declarative/samegame/content/BoomBlock.qml
index 0d05772..b7838dd 100644
--- a/demos/declarative/samegame/content/BoomBlock.qml
+++ b/demos/declarative/samegame/content/BoomBlock.qml
@@ -5,8 +5,9 @@ Item { id:block
property int targetX: 0
property int targetY: 0
- x: Follow { source: targetX; spring: 1.2; damping: 0.1 }
- y: Follow { source: targetY; spring: 1.2; damping: 0.1 }
+ x: Follow { source: targetX; spring: 2; damping: 0.2 }
+ y: Follow { source: targetY; spring: 2; damping: 0.2 }
+
Image { id: img
source: {
@@ -22,9 +23,10 @@ Item { id:block
opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } }
anchors.fill: parent
}
+
Particles { id: particles
width:1; height:1; anchors.centeredIn: parent; opacity: 0
- lifeSpan: 1000000000; count:0; streamIn: false
+ lifeSpan: 700; lifeSpanDeviation: 600; count:0; streamIn: false
angle: 0; angleDeviation: 360; velocity: 100; velocityDeviation:30
source: {
if(type == 0){
@@ -36,6 +38,7 @@ Item { id:block
}
}
}
+
states: [
State{ name: "AliveState"; when: spawning == true && dying == false
@@ -44,6 +47,7 @@ Item { id:block
State{ name: "DeathState"; when: dying == true
SetProperties { target: particles; count: 50 }
SetProperties { target: particles; opacity: 1 }
+ SetProperties { target: particles; emitting: false } // i.e. emit only once
SetProperties { target: img; opacity: 0 }
}
]
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index eda9079..e6e31f4 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -74,14 +74,12 @@ The following table lists the Qml elements provided by the Qt Declarative module
\o \l TextEdit
\o \l Rect
\o \l AnimatedImage
-\o \l BlendedImage
\endlist
\o
\list
\o \l MouseRegion
\o \l KeyActions
-\o \l FocusPanel
\o \l FocusRealm
\o \l KeyProxy
\endlist
@@ -96,12 +94,8 @@ The following table lists the Qml elements provided by the Qt Declarative module
\o
\list
\o \l Repeater
-\o \l ContentWrapper
- \list
- \o \l Content
- \endlist
\o \l ComponentInstance
-\o \l WidgetContainer
+\o \l GraphicsObjectContainer
\endlist
\header
@@ -147,10 +141,6 @@ The following table lists the Qml elements provided by the Qt Declarative module
\o
\list
-\o \l Shadow
-\o \l Reflection
-\o \l Blur
-\o \l Highlight
\o \l Particles
\list
\o \l ParticleMotionLinear
diff --git a/examples/declarative/minehunt/Description.qml b/examples/declarative/minehunt/Description.qml
index 0241ae5..ea71d85 100644
--- a/examples/declarative/minehunt/Description.qml
+++ b/examples/declarative/minehunt/Description.qml
@@ -29,8 +29,4 @@ Item {
wrap: true
}
}
- filter: Shadow {
- xOffset: 5
- yOffset: 5
- }
}
diff --git a/examples/declarative/minehunt/main.cpp b/examples/declarative/minehunt/main.cpp
index 7f10757..d8e60cc 100644
--- a/examples/declarative/minehunt/main.cpp
+++ b/examples/declarative/minehunt/main.cpp
@@ -62,7 +62,7 @@ public:
MyWidget(int = 370, int = 480, QWidget *parent=0, Qt::WindowFlags flags=0);
~MyWidget();
- Q_PROPERTY(QList<Tile *> *tiles READ tiles);
+ Q_PROPERTY(QList<Tile *> *tiles READ tiles CONSTANT);
QList<Tile *> *tiles() { return &_tiles; }
Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged);
@@ -134,9 +134,7 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags
canvas->setQml(qml, fileName);
QmlContext *ctxt = canvas->rootContext();
- ctxt->activate();
ctxt->addDefaultObject(this);
- ctxt->deactivate();
canvas->execute();
}
diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml
index 03fcc8d..286e485 100644
--- a/examples/declarative/minehunt/minehunt.qml
+++ b/examples/declarative/minehunt/minehunt.qml
@@ -46,7 +46,7 @@ Item {
text: modelData.hint
color: "white"
font.bold: true
- opacity: modelData.hasMine == false && modelData.hint > 0
+ opacity: !modelData.hasMine && modelData.hint > 0
}
Image {
anchors.horizontalCenter: parent.horizontalCenter
@@ -57,13 +57,13 @@ Item {
Explosion {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
- explode: modelData.hasMine==true && modelData.flipped==true
+ explode: modelData.hasMine && modelData.flipped
}
}
states: [
State {
name: "back"
- when: modelData.flipped == true
+ when: modelData.flipped
SetProperties { target: flipable; rotation: 180 }
}
]
@@ -71,7 +71,19 @@ Item {
Transition {
SequentialAnimation {
PauseAnimation {
- duration: {var ret = Math.abs(flipable.parent.x-field.clickx) + Math.abs(flipable.parent.y-field.clicky); if (ret > 0) {if(modelData.hasMine==true && modelData.flipped==true){ret*3;}else{ret;}} else {0}}
+ duration: {
+ var ret = Math.abs(flipable.parent.x-field.clickx)
+ + Math.abs(flipable.parent.y-field.clicky);
+ if (ret > 0) {
+ if (modelData.hasMine && modelData.flipped) {
+ ret*3
+ } else {
+ ret
+ }
+ } else {
+ 0
+ }
+ }
}
NumberAnimation {
easing: "easeInOutQuad"
@@ -82,7 +94,17 @@ Item {
]
MouseRegion {
anchors.fill: parent
- onClicked: { field.clickx = flipable.parent.x; field.clicky = flipable.parent.y; row = Math.floor(index/9); col = index - (Math.floor(index/9) * 9); if(mouse.button==undefined || mouse.button==Qt.RightButton){flag(row,col);}else{flip(row,col);} }
+ onClicked: {
+ field.clickx = flipable.parent.x;
+ field.clicky = flipable.parent.y;
+ row = Math.floor(index/9);
+ col = index - (Math.floor(index/9) * 9);
+ if (mouse.button==undefined || mouse.button==Qt.RightButton) {
+ flag(row,col);
+ } else {
+ flip(row,col);
+ }
+ }
}
}
}
@@ -146,7 +168,7 @@ Item {
Image {
x: 280
y: 10
- source: if(isPlaying==true){'pics/face-smile.png'}else{if(hasWon==true){'pics/face-smile-big.png'}else{'pics/face-sad.png'}}
+ source: isPlaying ? 'pics/face-smile.png' : hasWon ? 'pics/face-smile-big.png': 'pics/face-sad.png'
MouseRegion {
anchors.fill: parent
onClicked: { reset() }
diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml
index 8f78822..5154c91 100644
--- a/examples/declarative/velocity/Day.qml
+++ b/examples/declarative/velocity/Day.qml
@@ -11,7 +11,6 @@ Rect {
x: 10
y: 10
source: "cork.jpg"
- opaque: true
}
Text {
x: 20
diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp
index 3d59022..c31163c 100644
--- a/src/declarative/extra/qfxparticles.cpp
+++ b/src/declarative/extra/qfxparticles.cpp
@@ -410,7 +410,6 @@ public:
};
-//TODO: Stop the clock if no visible particles and not emitting (restart on emittingChanged)
void QFxParticlesPrivate::tick(int time)
{
Q_Q(QFxParticles);
@@ -465,12 +464,9 @@ void QFxParticlesPrivate::tick(int time)
}
lastAdvTime = time;
- if (oldCount || particles.count()) {
- if (q->itemParent())
- q->itemParent()->update();
- else
- q->update();
- } else if (!count) {
+ paintItem->updateSize();
+ paintItem->update();
+ if (!(oldCount || particles.count()) && (!count || !emitting)) {
lastAdvTime = 0;
clock.stop();
}
@@ -641,7 +637,8 @@ void QFxParticles::imageLoaded()
{
Q_D(QFxParticles);
d->image = QFxPixmap(d->url);
- update();
+ d->paintItem->updateSize();
+ d->paintItem->update();
}
void QFxParticles::setSource(const QUrl &name)
@@ -656,7 +653,8 @@ void QFxParticles::setSource(const QUrl &name)
if (name.isEmpty()) {
d->url = name;
d->image = QPixmap();
- update();
+ d->paintItem->updateSize();
+ d->paintItem->update();
} else {
d->url = name;
Q_ASSERT(!name.isRelative());
@@ -687,10 +685,11 @@ void QFxParticles::setCount(int cnt)
d->count = cnt;
d->addParticleTime = 0;
d->addParticleCount = d->particles.count();
- if (!oldCount && d->clock.state() != QAbstractAnimation::Running){
- d->clock.start(); // infinity??
+ if (!oldCount && d->clock.state() != QAbstractAnimation::Running) {
+ d->clock.start();
}
- update();
+ d->paintItem->updateSize();
+ d->paintItem->update();
}
}
@@ -1006,6 +1005,8 @@ void QFxParticles::setEmitting(bool r)
{
Q_D(QFxParticles);
d->emitting = r;
+ if (d->count && r)
+ d->clock.start();
}
/*!
\qmlproperty ParticleMotion Particles::motion
@@ -1046,17 +1047,10 @@ QString QFxParticles::propertyInfo() const
return d->url.toString();
}
-void QFxParticlesPainter::updateSize(){
- setX(-500);
- setY(-500);
- setWidth(1000);
- setHeight(1000);
- return ;
+void QFxParticlesPainter::updateSize()
+{
const int parentX = parentItem()->x();
const int parentY = parentItem()->y();
- //Have to use statistical approach to needed size as arbitrary particle
- //motions make it impossible to calculate.
- //max/min vars stored to give a never shrinking rect
for (int i = 0; i < d->particles.count(); ++i) {
const QFxParticle &particle = d->particles.at(i);
if(particle.x > maxX)
@@ -1090,7 +1084,6 @@ void QFxParticlesPainter::paintContents(QPainter &p)
if (d->image.isNull())
return;
- updateSize();
const int myX = x() + parentItem()->x();
const int myY = y() + parentItem()->y();
@@ -1099,15 +1092,16 @@ void QFxParticlesPainter::paintContents(QPainter &p)
p.setOpacity(particle.opacity);
p.drawPixmap(particle.x - myX, particle.y - myY, d->image);
}
- update();//Should I need this? (GV does)
}
void QFxParticles::componentComplete()
{
Q_D(QFxParticles);
QFxItem::componentComplete();
- if (d->count)
- d->clock.start(); // infinity??
+ if (d->count) {
+ d->paintItem->updateSize();
+ d->clock.start();
+ }
if (d->lifeSpanDev > d->lifeSpan)
d->lifeSpanDev = d->lifeSpan;
}
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri
index 413b8db..24c5536 100644
--- a/src/declarative/fx/fx.pri
+++ b/src/declarative/fx/fx.pri
@@ -40,7 +40,7 @@ HEADERS += \
fx/qfxpixmap.cpp \
fx/qfxvisualitemmodel.h \
fx/qfxlistview.h \
- fx/qfxwidgetcontainer.h \
+ fx/qfxgraphicsobjectcontainer.h \
SOURCES += \
fx/qfxanchors.cpp \
@@ -69,7 +69,7 @@ SOURCES += \
fx/qfxpixmap.cpp \
fx/qfxvisualitemmodel.cpp \
fx/qfxlistview.cpp \
- fx/qfxwidgetcontainer.cpp \
+ fx/qfxgraphicsobjectcontainer.cpp \
contains(QT_CONFIG, webkit) {
QT+=webkit
diff --git a/src/declarative/fx/qfxwidgetcontainer.cpp b/src/declarative/fx/qfxgraphicsobjectcontainer.cpp
index ea702db..479a21d 100644
--- a/src/declarative/fx/qfxwidgetcontainer.cpp
+++ b/src/declarative/fx/qfxgraphicsobjectcontainer.cpp
@@ -39,59 +39,60 @@
**
****************************************************************************/
-#include "qfxwidgetcontainer.h"
-#include <qgraphicswidget.h>
+#include "qfxgraphicsobjectcontainer.h"
+#include <QGraphicsObject>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass WidgetContainer QFxWidgetContainer
- \brief The WidgetContainer element allows you to add QGraphicsWidgets into Fluid UI elements.
+ \qmlclass GraphicsObjectContainer QFxGraphicsObjectContainer
+ \brief The GraphicsObjectContainer element allows you to add QGraphicsObjects into Fluid UI elements.
*/
/*!
\internal
- \class QFxWidgetContainer
- \brief The QFxWidgetContainer class allows you to add QGraphicsWidgets into Fluid UI applications.
+ \class QFxGraphicsObjectContainer
+ \brief The QFxGraphicsObjectContainer class allows you to add QGraphicsObjects into Fluid UI applications.
*/
-QML_DEFINE_TYPE(QFxWidgetContainer, WidgetContainer)
+QML_DEFINE_TYPE(QFxGraphicsObjectContainer, GraphicsObjectContainer)
-QFxWidgetContainer::QFxWidgetContainer(QFxItem *parent)
-: QFxItem(parent), _graphicsWidget(0)
+QFxGraphicsObjectContainer::QFxGraphicsObjectContainer(QFxItem *parent)
+: QFxItem(parent), _graphicsObject(0)
{
}
-QFxWidgetContainer::~QFxWidgetContainer()
+QFxGraphicsObjectContainer::~QFxGraphicsObjectContainer()
{
}
-QGraphicsWidget *QFxWidgetContainer::graphicsWidget() const
+QGraphicsObject *QFxGraphicsObjectContainer::graphicsObject() const
{
- return _graphicsWidget;
+ return _graphicsObject;
}
/*!
- \qmlproperty QGraphicsWidget QFxWidgetContainer::graphicsWidget
- The QGraphicsWidget associated with this element.
+ \qmlproperty QGraphicsObject GraphicsObjectContainer::graphicsObject
+ The QGraphicsObject associated with this element.
*/
-void QFxWidgetContainer::setGraphicsWidget(QGraphicsWidget *widget)
+void QFxGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object)
{
- if (widget == _graphicsWidget)
+ if (object == _graphicsObject)
return;
- _graphicsWidget = widget;
+ _graphicsObject = object;
- _graphicsWidget->setParentItem(this);
+ _graphicsObject->setParentItem(this);
}
-void QFxWidgetContainer::canvasChanged()
+QVariant QFxGraphicsObjectContainer::itemChange(GraphicsItemChange change, const QVariant &value)
{
- if (_graphicsWidget) {
- QGraphicsWidget *w = _graphicsWidget;
- _graphicsWidget = 0;
- setGraphicsWidget(w);
+ if (change == ItemSceneHasChanged) {
+ QGraphicsObject *o = _graphicsObject;
+ _graphicsObject = 0;
+ setGraphicsObject(o);
}
+ return QFxItem::itemChange(change, value);
}
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxwidgetcontainer.h b/src/declarative/fx/qfxgraphicsobjectcontainer.h
index 862a280..e118555 100644
--- a/src/declarative/fx/qfxwidgetcontainer.h
+++ b/src/declarative/fx/qfxgraphicsobjectcontainer.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QFXWIDGETCONTAINER_H
-#define QFXWIDGETCONTAINER_H
+#ifndef QFXGRAPHICSOBJECTCONTAINER_H
+#define QFXGRAPHICSOBJECTCONTAINER_H
#include <QtDeclarative/qfxitem.h>
@@ -50,33 +50,33 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QGraphicsWidget;
+class QGraphicsObject;
-class Q_DECLARATIVE_EXPORT QFxWidgetContainer : public QFxItem
+class Q_DECLARATIVE_EXPORT QFxGraphicsObjectContainer : public QFxItem
{
Q_OBJECT
- Q_CLASSINFO("DefaultProperty", "graphicsWidget")
- Q_PROPERTY(QGraphicsWidget *graphicsWidget READ graphicsWidget WRITE setGraphicsWidget)
+ Q_CLASSINFO("DefaultProperty", "graphicsObject")
+ Q_PROPERTY(QGraphicsObject *graphicsObject READ graphicsObject WRITE setGraphicsObject)
public:
- QFxWidgetContainer(QFxItem *parent = 0);
- ~QFxWidgetContainer();
+ QFxGraphicsObjectContainer(QFxItem *parent = 0);
+ ~QFxGraphicsObjectContainer();
- QGraphicsWidget *graphicsWidget() const;
- void setGraphicsWidget(QGraphicsWidget *);
+ QGraphicsObject *graphicsObject() const;
+ void setGraphicsObject(QGraphicsObject *);
protected:
- virtual void canvasChanged();
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private:
- QGraphicsWidget *_graphicsWidget;
+ QGraphicsObject *_graphicsObject;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QFxWidgetContainer)
+QML_DECLARE_TYPE(QFxGraphicsObjectContainer)
QT_END_HEADER
-#endif // QFXGRAPHICSWIDGET_H
+#endif // QFXGRAPHICSOBJECTCONTAINER_H
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 34ff157..d19d620 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -219,44 +219,6 @@ void QFxImage::setTiled(bool tile)
d->tiled = tile;
}
-/*!
- \qmlproperty bool Image::opaque
-
- Set this property if you know that the image is opaque to give your
- application a significant performance boost.
-
- \note
- This is a performance hint to Qt Declarative. Unfortunately whether or not an image
- is opaque is not automatically detected. Setting this property to true when
- the image is not opaque will lead to drawing artifacts. However, leaving it as
- false will always work correctly - although possibly not at maximum performance.
- */
-
-/*!
- \property QFxImage::opaque
- \brief whether the image is opaque (non-transparent).
-
- This property is provided purely for the purpose of optimization. An opaque
- image can be optimized more than a non-opaque one.
-*/
-bool QFxImage::isOpaque() const
-{
- Q_D(const QFxImage);
- return d->opaque;
-}
-
-void QFxImage::setOpaque(bool o)
-{
- Q_D(QFxImage);
- if (o == d->opaque)
- return;
- d->opaque = o;
-
- setOptions(IsOpaque, o);
-
- update();
-}
-
void QFxImage::componentComplete()
{
QFxItem::componentComplete();
diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h
index bc63d7a..7b3445c 100644
--- a/src/declarative/fx/qfximage.h
+++ b/src/declarative/fx/qfximage.h
@@ -64,7 +64,6 @@ class Q_DECLARATIVE_EXPORT QFxImage : public QFxItem
Q_PROPERTY(QFxScaleGrid *scaleGrid READ scaleGrid)
Q_PROPERTY(bool tile READ isTiled WRITE setTiled)
Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap DESIGNABLE false)
- Q_PROPERTY(bool opaque READ isOpaque WRITE setOpaque)
Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform)
Q_PROPERTY(bool preserveAspect READ preserveAspect WRITE setPreserveAspect);
public:
@@ -79,9 +78,6 @@ public:
QPixmap pixmap() const;
void setPixmap(const QPixmap &);
- bool isOpaque() const;
- void setOpaque(bool);
-
bool smoothTransform() const;
void setSmoothTransform(bool);
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 3386faf..481733b 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -2556,4 +2556,9 @@ QPixmap QFxItem::string(const QString &str, const QColor &c, const QFont &f)
return img;
}
+QVariant QFxItem::inputMethodQuery(Qt::InputMethodQuery query) const
+{
+ return QGraphicsItem::inputMethodQuery(query);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index bfe8521..67b60c1 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -149,8 +149,7 @@ public:
SimpleItem = 0x00000020,
IsFocusPanel = 0x00000040,
IsFocusRealm = 0x00000080,
- AcceptsInputMethods = 0x00000100,
- IsOpaque = 0x00000200 };
+ AcceptsInputMethods = 0x00000100 };
Q_DECLARE_FLAGS(Options, Option)
enum TransformOrigin {
@@ -274,6 +273,8 @@ public:
static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont());
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const; //### for KeyProxy
+
public Q_SLOTS:
void newChild(const QString &url);
diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp
index f234a0f..e4b4269 100644
--- a/src/declarative/fx/qfxkeyproxy.cpp
+++ b/src/declarative/fx/qfxkeyproxy.cpp
@@ -82,13 +82,15 @@ QML_DEFINE_TYPE(QFxKeyProxy,KeyProxy)
class QFxKeyProxyPrivate
{
public:
- QFxKeyProxyPrivate() : inPress(false), inRelease(false), inIM(false) {}
+ QFxKeyProxyPrivate() : inPress(false), inRelease(false), inIM(false), imeItem(0) {}
QList<QFxItem *> targets;
//loop detection
bool inPress:1;
bool inRelease:1;
bool inIM:1;
+
+ QFxItem *imeItem;
};
QFxKeyProxy::QFxKeyProxy(QFxItem *parent)
@@ -124,11 +126,12 @@ void QFxKeyProxy::keyPressEvent(QKeyEvent *e)
d->inPress = true;
for (int ii = 0; ii < d->targets.count(); ++ii) {
QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii)));
- if (i)
+ if (i) {
scene()->sendEvent(i, e);
- if (e->isAccepted()) {
- d->inPress = false;
- return;
+ if (e->isAccepted()) {
+ d->inPress = false;
+ return;
+ }
}
}
d->inPress = false;
@@ -143,11 +146,12 @@ void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e)
d->inRelease = true;
for (int ii = 0; ii < d->targets.count(); ++ii) {
QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii)));
- if (i)
+ if (i) {
scene()->sendEvent(i, e);
- if (e->isAccepted()) {
- d->inRelease = false;
- return;
+ if (e->isAccepted()) {
+ d->inRelease = false;
+ return;
+ }
}
}
d->inRelease = false;
@@ -162,15 +166,31 @@ void QFxKeyProxy::inputMethodEvent(QInputMethodEvent *e)
d->inIM = true;
for (int ii = 0; ii < d->targets.count(); ++ii) {
QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii)));
- if (i)
+ if (i && (i->options() & AcceptsInputMethods)) {
scene()->sendEvent(i, e);
- if (e->isAccepted()) {
- d->inIM = false;
- return;
+ if (e->isAccepted()) {
+ d->imeItem = i;
+ d->inIM = false;
+ return;
+ }
}
}
d->inIM = false;
}
}
+QVariant QFxKeyProxy::inputMethodQuery(Qt::InputMethodQuery query) const
+{
+ for (int ii = 0; ii < d->targets.count(); ++ii) {
+ QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii)));
+ if (i && (i->options() & AcceptsInputMethods) && i == d->imeItem) { //### how robust is i == d->imeItem check?
+ QVariant v = i->inputMethodQuery(query);
+ if (v.type() == QVariant::RectF)
+ v = mapRectFromItem(i, v.toRectF()); //### cost?
+ return v;
+ }
+ }
+ return QFxItem::inputMethodQuery(query);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxkeyproxy.h b/src/declarative/fx/qfxkeyproxy.h
index 8bcdc26..e77ffac 100644
--- a/src/declarative/fx/qfxkeyproxy.h
+++ b/src/declarative/fx/qfxkeyproxy.h
@@ -65,6 +65,7 @@ protected:
virtual void keyPressEvent(QKeyEvent *);
virtual void keyReleaseEvent(QKeyEvent *);
virtual void inputMethodEvent(QInputMethodEvent *);
+ virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
private:
Q_DISABLE_COPY(QFxKeyProxy)
diff --git a/src/declarative/fx/qfxlineedit.cpp b/src/declarative/fx/qfxlineedit.cpp
index d23c325..24cf3fc 100644
--- a/src/declarative/fx/qfxlineedit.cpp
+++ b/src/declarative/fx/qfxlineedit.cpp
@@ -207,23 +207,6 @@ QString QFxLineEdit::selectedText() const
return d->control->selectedText();
}
-bool QFxLineEdit::isAwesome() const
-{
- Q_D(const QFxLineEdit);
- return d->awesome;
-}
-
-#include <QTimer> //Can be removed along wit the property
-void QFxLineEdit::setAwesome(bool a)
-{
- Q_D(QFxLineEdit);
- d->awesome = a;
- if(a){
- setColor(QColor(0,0,255));
- rainbowRedraw();
- }
-}
-
QObject* QFxLineEdit::validator() const
{
Q_D(const QFxLineEdit);
@@ -462,7 +445,7 @@ void QFxLineEditPrivate::init()
{
Q_Q(QFxLineEdit);
control->setCursorWidth(1);
- control->setPasswordCharacter('*');
+ control->setPasswordCharacter(QLatin1Char('*'));
control->setLayoutDirection(Qt::LeftToRight);
control->setSelection(0,0);
q->setSmooth(true);
@@ -530,14 +513,5 @@ void QFxLineEdit::updateSize()
setContentsSize(QSize(width(), height()));
}
-void QFxLineEdit::rainbowRedraw()
-{
- Q_D(QFxLineEdit);
- if(!d->awesome)
- return;
- setColor(QColor::fromHsv((d->color.hue() + 5)%360, d->color.saturation(), d->color.value()));
- updateAll();
- QTimer::singleShot(50, this, SLOT(rainbowRedraw()));
-}
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxlineedit.h b/src/declarative/fx/qfxlineedit.h
index 5abb418..e053c54 100644
--- a/src/declarative/fx/qfxlineedit.h
+++ b/src/declarative/fx/qfxlineedit.h
@@ -84,8 +84,7 @@ class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem
/*
Q_PROPERTY(int scrollDuration READ scrollDuration SET setScrollDuration NOTIFY scrollDurationChanged);
*/
- //### Requested by Aaron K.(Remove before release?)
- Q_PROPERTY(bool awesome READ isAwesome WRITE setAwesome);
+
public:
QFxLineEdit(QFxItem* parent=0);
~QFxLineEdit();
@@ -148,9 +147,6 @@ public:
bool hasAcceptableInput() const;
- bool isAwesome() const;
- void setAwesome(bool a);
-
void drawContents(QPainter *p,const QRect &r);
Q_SIGNALS:
void textChanged();
@@ -178,7 +174,6 @@ private slots:
void updateAll();
void createCursor();
void moveCursor();
- void rainbowRedraw();
private:
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxLineEdit);
diff --git a/src/declarative/fx/qfxlineedit_p.h b/src/declarative/fx/qfxlineedit_p.h
index 8ee5cca..a0ab19c 100644
--- a/src/declarative/fx/qfxlineedit_p.h
+++ b/src/declarative/fx/qfxlineedit_p.h
@@ -65,9 +65,9 @@ class QFxLineEditPrivate : public QFxPaintedItemPrivate
public:
QFxLineEditPrivate() : control(new QLineControl(QString())),
font(0), color((QRgb)0), style(QFxText::Normal),
+ styleColor((QRgb)0),
hAlign(QFxText::AlignLeft), vAlign(QFxText::AlignTop),
- styleColor((QRgb)0), oldScroll(0), hscroll(0),
- focused(false), awesome(false)
+ hscroll(0), oldScroll(0), focused(false)
{
}
@@ -96,8 +96,6 @@ public:
int hscroll;
int oldScroll;
bool focused;
- bool awesome;
-
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp
index 5e86b73..ba4e160 100644
--- a/src/declarative/util/qmltransitionmanager.cpp
+++ b/src/declarative/util/qmltransitionmanager.cpp
@@ -109,13 +109,10 @@ void QmlTransitionManager::transition(const QList<Action> &list,
QmlStateOperation::ActionList applyList = list;
// Determine which actions are binding changes.
foreach(const Action &action, applyList) {
- if (action.toBinding) {
+ if (action.toBinding)
d->bindingsList << action;
- if (action.fromBinding)
- action.property.setBinding(0); // Disable current binding
- } else if (action.fromBinding) {
+ if (action.fromBinding)
action.property.setBinding(0); // Disable current binding
- }
}
// Animated transitions need both the start and the end value for
@@ -156,7 +153,7 @@ void QmlTransitionManager::transition(const QList<Action> &list,
continue;
if (action.toBinding)
- action.property.setBinding(0);
+ action.property.setBinding(0); // Make sure this is disabled during the transition
action.property.write(action.fromValue);
}