summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-08-19 03:38:24 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-08-19 03:38:24 (GMT)
commite19fa69859c1abe8da0623c502d012cff214e1c4 (patch)
tree6bb3877ec78010082540275cd84b2dc57eafa9ec /src/declarative
parentf51450571addf2cb9a55153b209b8c1a45898193 (diff)
parent9f7f71160053b64a23abc472d9d9ddd5d9bb8b3d (diff)
downloadQt-e19fa69859c1abe8da0623c502d012cff214e1c4.zip
Qt-e19fa69859c1abe8da0623c502d012cff214e1c4.tar.gz
Qt-e19fa69859c1abe8da0623c502d012cff214e1c4.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/fx.pri6
-rw-r--r--src/declarative/fx/qfxtext.cpp8
-rw-r--r--src/declarative/fx/qfxtext.h4
-rw-r--r--src/declarative/fx/qfxtextedit.cpp8
-rw-r--r--src/declarative/fx/qfxtextedit.h4
-rw-r--r--src/declarative/fx/qfxtextinput.cpp (renamed from src/declarative/fx/qfxlineedit.cpp)226
-rw-r--r--src/declarative/fx/qfxtextinput.h (renamed from src/declarative/fx/qfxlineedit.h)33
-rw-r--r--src/declarative/fx/qfxtextinput_p.h (renamed from src/declarative/fx/qfxlineedit_p.h)18
-rw-r--r--src/declarative/util/qmlanimation.cpp237
-rw-r--r--src/declarative/util/qmlanimation.h35
-rw-r--r--src/declarative/util/qmlanimation_p.h11
11 files changed, 305 insertions, 285 deletions
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri
index 48af58e..47cce95 100644
--- a/src/declarative/fx/fx.pri
+++ b/src/declarative/fx/fx.pri
@@ -35,8 +35,8 @@ HEADERS += \
fx/qfxrepeater.h \
fx/qfxrepeater_p.h \
fx/qfxscalegrid_p.h \
- fx/qfxlineedit.h \
- fx/qfxlineedit_p.h \
+ fx/qfxtextinput.h \
+ fx/qfxtextinput_p.h \
fx/qfxtextedit.h \
fx/qfxtextedit_p.h \
fx/qfxtext.h \
@@ -69,7 +69,7 @@ SOURCES += \
fx/qfxrect.cpp \
fx/qfxrepeater.cpp \
fx/qfxscalegrid.cpp \
- fx/qfxlineedit.cpp \
+ fx/qfxtextinput.cpp \
fx/qfxtext.cpp \
fx/qfxtextedit.cpp \
fx/qfxpixmapcache.cpp \
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index 272102c..dcaaa54 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -283,14 +283,14 @@ QColor QFxText::styleColor() const
}
/*!
- \qmlproperty enumeration Text::hAlign
- \qmlproperty enumeration Text::vAlign
+ \qmlproperty enumeration Text::horizontalAlignment
+ \qmlproperty enumeration Text::verticalAlignment
Sets the horizontal and vertical alignment of the text within the Text items
width and height. By default, the text is top-left aligned.
- The valid values for \c hAlign are \c AlignLeft, \c AlignRight and
- \c AlignHCenter. The valid values for \c vAlign are \c AlignTop, \c AlignBottom
+ The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and
+ \c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom
and \c AlignVCenter.
*/
QFxText::HAlignment QFxText::hAlign() const
diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h
index 63fb3e9..fcfe2b1 100644
--- a/src/declarative/fx/qfxtext.h
+++ b/src/declarative/fx/qfxtext.h
@@ -63,8 +63,8 @@ class Q_DECLARATIVE_EXPORT QFxText : public QFxItem
Q_PROPERTY(QColor color READ color WRITE setColor)
Q_PROPERTY(TextStyle style READ style WRITE setStyle)
Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor)
- Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) // ### horizontalAlignment?
- Q_PROPERTY(VAlignment vAlign READ vAlign WRITE setVAlign) // ### verticalAlignment?
+ Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign)
+ Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign)
Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### there are several wrap modes in Qt
Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat)
Q_PROPERTY(Qt::TextElideMode elide READ elideMode WRITE setElideMode) //### elideMode?
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 5014185..f7f5f0a 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -316,14 +316,14 @@ void QFxTextEdit::setHighlightedTextColor(const QColor &color)
}
/*!
- \qmlproperty enumeration TextEdit::hAlign
- \qmlproperty enumeration TextEdit::vAlign
+ \qmlproperty enumeration TextEdit::horizontalAlignment
+ \qmlproperty enumeration TextEdit::verticalAlignment
Sets the horizontal and vertical alignment of the text within the TextEdit items
width and height. By default, the text is top-left aligned.
- The valid values for \c hAlign are \c AlignLeft, \c AlignRight and
- \c AlignHCenter. The valid values for \c vAlign are \c AlignTop, \c AlignBottom
+ The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and
+ \c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom
and \c AlignVCenter.
*/
QFxTextEdit::HAlignment QFxTextEdit::hAlign() const
diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h
index 8c402b0..f24faf9 100644
--- a/src/declarative/fx/qfxtextedit.h
+++ b/src/declarative/fx/qfxtextedit.h
@@ -71,8 +71,8 @@ class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem
Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor) //### selectionColor
Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor WRITE setHighlightedTextColor) //### selectedTextColor
Q_PROPERTY(QFont font READ font WRITE setFont)
- Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) //### horizontalAlignment
- Q_PROPERTY(VAlignment vAlign READ vAlign WRITE setVAlign) //### verticalAlignment
+ Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign)
+ Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign)
Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### other wrap modes
Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat)
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
diff --git a/src/declarative/fx/qfxlineedit.cpp b/src/declarative/fx/qfxtextinput.cpp
index 6e93782..1407a78 100644
--- a/src/declarative/fx/qfxlineedit.cpp
+++ b/src/declarative/fx/qfxtextinput.cpp
@@ -39,39 +39,41 @@
**
****************************************************************************/
-#include "qfxlineedit.h"
-#include "qfxlineedit_p.h"
+#include "qfxtextinput.h"
+#include "qfxtextinput_p.h"
#include <QValidator>
#include <QApplication>
#include <QFontMetrics>
#include <QPainter>
QT_BEGIN_NAMESPACE
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,LineEdit,QFxLineEdit);
+
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,TextInput,QFxTextInput);
+QML_DEFINE_NOCREATE_TYPE(QValidator);
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QIntValidator,QIntValidator);
/*!
\qmlclass LineEdit
The LineEdit item allows you to add an editable line of text to a scene.
*/
-QFxLineEdit::QFxLineEdit(QFxItem* parent)
- : QFxPaintedItem(*(new QFxLineEditPrivate), parent)
+QFxTextInput::QFxTextInput(QFxItem* parent)
+ : QFxPaintedItem(*(new QFxTextInputPrivate), parent)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->init();
}
/*
\internal
*/
-QFxLineEdit::QFxLineEdit(QFxLineEditPrivate &dd, QFxItem* parent)
+QFxTextInput::QFxTextInput(QFxTextInputPrivate &dd, QFxItem* parent)
: QFxPaintedItem(dd, parent)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->init();
}
-QFxLineEdit::~QFxLineEdit()
+QFxTextInput::~QFxTextInput()
{
}
@@ -81,15 +83,15 @@ QFxLineEdit::~QFxLineEdit()
The text in the LineEdit.
*/
-QString QFxLineEdit::text() const
+QString QFxTextInput::text() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->control->text();
}
-void QFxLineEdit::setText(const QString &s)
+void QFxTextInput::setText(const QString &s)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
if(s == text())
return;
d->control->setText(s);
@@ -101,15 +103,15 @@ void QFxLineEdit::setText(const QString &s)
Set the LineEdit's font attributes. \c font.size sets the font's point size.
*/
-QFont QFxLineEdit::font() const
+QFont QFxTextInput::font() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->font;
}
-void QFxLineEdit::setFont(const QFont &font)
+void QFxTextInput::setFont(const QFont &font)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->font = font;
d->control->setFont(d->font);
@@ -127,15 +129,15 @@ void QFxLineEdit::setFont(const QFont &font)
The text color.
*/
-QColor QFxLineEdit::color() const
+QColor QFxTextInput::color() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->color;
}
-void QFxLineEdit::setColor(const QColor &c)
+void QFxTextInput::setColor(const QColor &c)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->color = c;
}
@@ -145,15 +147,15 @@ void QFxLineEdit::setColor(const QColor &c)
The text highlight color, used behind selections.
*/
-QColor QFxLineEdit::highlightColor() const
+QColor QFxTextInput::highlightColor() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->highlightColor;
}
-void QFxLineEdit::setHighlightColor(const QColor &color)
+void QFxTextInput::setHighlightColor(const QColor &color)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
if (d->highlightColor == color)
return;
@@ -166,15 +168,15 @@ void QFxLineEdit::setHighlightColor(const QColor &color)
The highlighted text color, used in selections.
*/
-QColor QFxLineEdit::highlightedTextColor() const
+QColor QFxTextInput::highlightedTextColor() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->highlightedTextColor;
}
-void QFxLineEdit::setHighlightedTextColor(const QColor &color)
+void QFxTextInput::setHighlightedTextColor(const QColor &color)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
if (d->highlightedTextColor == color)
return;
@@ -182,39 +184,39 @@ void QFxLineEdit::setHighlightedTextColor(const QColor &color)
//TODO: implement
}
-QFxLineEdit::HAlignment QFxLineEdit::hAlign() const
+QFxTextInput::HAlignment QFxTextInput::hAlign() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->hAlign;
}
-void QFxLineEdit::setHAlign(HAlignment align)
+void QFxTextInput::setHAlign(HAlignment align)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->hAlign = align;
}
-bool QFxLineEdit::isReadOnly() const
+bool QFxTextInput::isReadOnly() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->control->isReadOnly();
}
-void QFxLineEdit::setReadOnly(bool ro)
+void QFxTextInput::setReadOnly(bool ro)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->control->setReadOnly(ro);
}
-int QFxLineEdit::maxLength() const
+int QFxTextInput::maxLength() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->control->maxLength();
}
-void QFxLineEdit::setMaxLength(int ml)
+void QFxTextInput::setMaxLength(int ml)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->control->setMaxLength(ml);
}
@@ -225,15 +227,15 @@ void QFxLineEdit::setMaxLength(int ml)
This property is set and unset when the line edit gets focus, but it can also
be set directly (useful, for example, if a KeyProxy might forward keys to it).
*/
-bool QFxLineEdit::isCursorVisible() const
+bool QFxTextInput::isCursorVisible() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->cursorVisible;
}
-void QFxLineEdit::setCursorVisible(bool on)
+void QFxTextInput::setCursorVisible(bool on)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
if (d->cursorVisible == on)
return;
d->cursorVisible = on;
@@ -245,14 +247,14 @@ void QFxLineEdit::setCursorVisible(bool on)
\qmlproperty int LineEdit::cursorPosition
The position of the cursor in the LineEdit.
*/
-int QFxLineEdit::cursorPosition() const
+int QFxTextInput::cursorPosition() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->control->cursor();
}
-void QFxLineEdit::setCursorPosition(int cp)
+void QFxTextInput::setCursorPosition(int cp)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->control->moveCursor(cp);
}
@@ -269,15 +271,15 @@ void QFxLineEdit::setCursorPosition(int cp)
\sa selectionEnd, cursorPosition, selectedText
*/
-int QFxLineEdit::selectionStart() const
+int QFxTextInput::selectionStart() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->lastSelectionStart;
}
-void QFxLineEdit::setSelectionStart(int s)
+void QFxTextInput::setSelectionStart(int s)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
if(d->lastSelectionStart == s || s < 0 || s > text().length())
return;
d->lastSelectionStart = s;
@@ -297,75 +299,71 @@ void QFxLineEdit::setSelectionStart(int s)
\sa selectionStart, cursorPosition, selectedText
*/
-int QFxLineEdit::selectionEnd() const
+int QFxTextInput::selectionEnd() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->lastSelectionEnd;
}
-void QFxLineEdit::setSelectionEnd(int s)
+void QFxTextInput::setSelectionEnd(int s)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
if(d->lastSelectionEnd == s || s < 0 || s > text().length())
return;
d->lastSelectionEnd = s;
d->control->setSelection(d->lastSelectionStart, s - d->lastSelectionStart);
}
-QString QFxLineEdit::selectedText() const
+QString QFxTextInput::selectedText() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->control->selectedText();
}
-QObject* QFxLineEdit::validator() const
+QValidator* QFxTextInput::validator() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
//###const cast isn't good, but needed for property system?
- //###same should be said about using QObject* as the property type
return const_cast<QValidator*>(d->control->validator());
}
-void QFxLineEdit::setValidator(QObject* v)
+void QFxTextInput::setValidator(QValidator* v)
{
- Q_D(QFxLineEdit);
- QValidator* valid = qobject_cast<QValidator*>(v);
- if(!valid)
- return;
- d->control->setValidator(valid);
+ Q_D(QFxTextInput);
+ d->control->setValidator(v);
if(!d->control->hasAcceptableInput()){
d->oldValidity = false;
emit acceptableInputChanged();
}
}
-QString QFxLineEdit::inputMask() const
+QString QFxTextInput::inputMask() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->control->inputMask();
}
-void QFxLineEdit::setInputMask(const QString &im)
+void QFxTextInput::setInputMask(const QString &im)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->control->setInputMask(im);
}
-bool QFxLineEdit::hasAcceptableInput() const
+bool QFxTextInput::hasAcceptableInput() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->control->hasAcceptableInput();
}
-uint QFxLineEdit::echoMode() const
+uint QFxTextInput::echoMode() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->control->echoMode();
}
-void QFxLineEdit::setEchoMode(uint echo)
+void QFxTextInput::setEchoMode(uint echo)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->control->setEchoMode(echo);
}
@@ -382,24 +380,24 @@ void QFxLineEdit::setEchoMode(uint echo)
Note that the root item of the delegate component must be a QFxItem or
QFxItem derived item.
*/
-QmlComponent* QFxLineEdit::cursorDelegate() const
+QmlComponent* QFxTextInput::cursorDelegate() const
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->cursorComponent;
}
-void QFxLineEdit::setCursorDelegate(QmlComponent* c)
+void QFxTextInput::setCursorDelegate(QmlComponent* c)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
if(d->cursorComponent)
delete d->cursorComponent;
d->cursorComponent = c;
d->startCreatingCursor();
}
-void QFxLineEditPrivate::startCreatingCursor()
+void QFxTextInputPrivate::startCreatingCursor()
{
- Q_Q(QFxLineEdit);
+ Q_Q(QFxTextInput);
if(!cursorComponent){
q->disconnect(control, SIGNAL(cursorPositionChanged(int, int)),
q, SLOT(moveCursor()));
@@ -413,13 +411,13 @@ void QFxLineEditPrivate::startCreatingCursor()
q->connect(cursorComponent, SIGNAL(statusChanged(int)),
q, SLOT(createCursor()));
}else{//isError
- qWarning() << "You could really use the error checking for QFxLineEdit. We'll implement it soon.";
+ qWarning() << "You could really use the error checking for QFxTextInput. We'll implement it soon.";
}
}
-void QFxLineEdit::createCursor()
+void QFxTextInput::createCursor()
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
//Handle isError too
if(!d->cursorComponent->isReady())
return;
@@ -428,7 +426,7 @@ void QFxLineEdit::createCursor()
delete d->cursorItem;
d->cursorItem = qobject_cast<QFxItem*>(d->cursorComponent->create());
if(!d->cursorItem){
- qWarning() << "You could really use the error reporting for QFxLineEdit. We'll implement it soon.";
+ qWarning() << "You could really use the error reporting for QFxTextInput. We'll implement it soon.";
return;
}
@@ -437,39 +435,39 @@ void QFxLineEdit::createCursor()
d->cursorItem->setHeight(d->control->height());
}
-void QFxLineEdit::moveCursor()
+void QFxTextInput::moveCursor()
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
if(!d->cursorItem)
return;
d->cursorItem->setX(d->control->cursorToX() - d->hscroll);
}
-int QFxLineEdit::xToPos(int x)
+int QFxTextInput::xToPos(int x)
{
- Q_D(const QFxLineEdit);
+ Q_D(const QFxTextInput);
return d->control->xToPos(x - d->hscroll);
}
-void QFxLineEdit::focusChanged(bool hasFocus)
+void QFxTextInput::focusChanged(bool hasFocus)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->focused = hasFocus;
setCursorVisible(hasFocus);
QFxItem::focusChanged(hasFocus);
}
-void QFxLineEdit::keyPressEvent(QKeyEvent* ev)
+void QFxTextInput::keyPressEvent(QKeyEvent* ev)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
d->control->processKeyEvent(ev);
if (!ev->isAccepted())
QFxPaintedItem::keyPressEvent(ev);
}
-void QFxLineEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void QFxTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
setFocus(true);//###Should we make 'focusOnPress' be optional like TextEdit?
setCursorVisible(true);
d->focused = true;
@@ -477,9 +475,9 @@ void QFxLineEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
//event->accept();
}
-bool QFxLineEdit::event(QEvent* ev)
+bool QFxTextInput::event(QEvent* ev)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
//Anything we don't deal with ourselves, pass to the control
switch(ev->type()){
case QEvent::GraphicsSceneMousePress:
@@ -490,7 +488,7 @@ bool QFxLineEdit::event(QEvent* ev)
return false;
}
-void QFxLineEdit::geometryChanged(const QRectF &newGeometry,
+void QFxTextInput::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
if (newGeometry.width() != oldGeometry.width())
@@ -498,9 +496,9 @@ void QFxLineEdit::geometryChanged(const QRectF &newGeometry,
QFxPaintedItem::geometryChanged(newGeometry, oldGeometry);
}
-void QFxLineEdit::drawContents(QPainter *p, const QRect &r)
+void QFxTextInput::drawContents(QPainter *p, const QRect &r)
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
p->setRenderHint(QPainter::TextAntialiasing, true);
p->save();
p->setPen(QPen(d->color));
@@ -528,9 +526,9 @@ void QFxLineEdit::drawContents(QPainter *p, const QRect &r)
filtering at the beginning of the animation and reenable it at the conclusion.
*/
-void QFxLineEditPrivate::init()
+void QFxTextInputPrivate::init()
{
- Q_Q(QFxLineEdit);
+ Q_Q(QFxTextInput);
control->setCursorWidth(1);
control->setPasswordCharacter(QLatin1Char('*'));
control->setLayoutDirection(Qt::LeftToRight);
@@ -559,9 +557,9 @@ void QFxLineEditPrivate::init()
lastSelectionEnd = 0;
}
-void QFxLineEdit::cursorPosChanged()
+void QFxTextInput::cursorPosChanged()
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
emit cursorPositionChanged();
if(!d->control->hasSelectedText()){
@@ -576,9 +574,9 @@ void QFxLineEdit::cursorPosChanged()
}
}
-void QFxLineEdit::selectionChanged()
+void QFxTextInput::selectionChanged()
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
emit selectedTextChanged();
if(d->lastSelectionStart != d->control->selectionStart()){
@@ -595,9 +593,9 @@ void QFxLineEdit::selectionChanged()
}
}
-void QFxLineEdit::q_textChanged()
+void QFxTextInput::q_textChanged()
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
updateAll();
emit textChanged();
if(hasAcceptableInput() != d->oldValidity){
@@ -607,16 +605,16 @@ void QFxLineEdit::q_textChanged()
}
//### Please replace this function with proper updating
-void QFxLineEdit::updateAll()
+void QFxTextInput::updateAll()
{
clearCache();
updateSize();
update();
}
-void QFxLineEdit::updateSize()
+void QFxTextInput::updateSize()
{
- Q_D(QFxLineEdit);
+ Q_D(QFxTextInput);
setImplicitHeight(d->control->height());
//d->control->width() is max width, not current width
QFontMetrics fm = QFontMetrics(d->font);
diff --git a/src/declarative/fx/qfxlineedit.h b/src/declarative/fx/qfxtextinput.h
index 1f4a5c6..fe72f1e 100644
--- a/src/declarative/fx/qfxlineedit.h
+++ b/src/declarative/fx/qfxtextinput.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QFXLINEEDIT_H
-#define QFXLINEEDIT_H
+#ifndef QFXTEXTINPUT_H
+#define QFXTEXTINPUT_H
#include "qfxtext.h"
#include "qfxpainteditem.h"
@@ -53,10 +53,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QFxLineEditPrivate;
+class QFxTextInputPrivate;
class QValidator;
-//### class QFxTextInput??
-class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem
+class Q_DECLARATIVE_EXPORT QFxTextInput : public QFxPaintedItem
{
Q_OBJECT
Q_ENUMS(HAlignment)
@@ -66,7 +65,7 @@ class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem
Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor) //### selectionColor
Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor WRITE setHighlightedTextColor) //### selectedTextColor
Q_PROPERTY(QFont font READ font WRITE setFont)
- Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) //### horizontalAlignment
+ Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign)
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible)
@@ -76,16 +75,16 @@ class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem
Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged)
- Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength) //### maximumLength
- Q_PROPERTY(QObject* validator READ validator WRITE setValidator) //### QValidator *
+ Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength)
+ Q_PROPERTY(QValidator* validator READ validator WRITE setValidator)
Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask)
Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged)
Q_PROPERTY(uint echoMode READ echoMode WRITE setEchoMode) //### enum
//### Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress)
public:
- QFxLineEdit(QFxItem* parent=0);
- ~QFxLineEdit();
+ QFxTextInput(QFxItem* parent=0);
+ ~QFxTextInput();
enum HAlignment {
AlignLeft = Qt::AlignLeft,
@@ -135,8 +134,8 @@ public:
int maxLength() const;
void setMaxLength(int ml);
- QObject * validator() const;
- void setValidator(QObject* v);
+ QValidator * validator() const;
+ void setValidator(QValidator* v);
QString inputMask() const;
void setInputMask(const QString &im);
@@ -160,7 +159,7 @@ Q_SIGNALS:
void acceptableInputChanged();
protected:
- QFxLineEdit(QFxLineEditPrivate &dd, QFxItem *parent);
+ QFxTextInput(QFxTextInputPrivate &dd, QFxItem *parent);
virtual void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
@@ -180,13 +179,15 @@ private Q_SLOTS:
void cursorPosChanged();
private:
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxLineEdit);
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxTextInput);
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QFxLineEdit)
+QML_DECLARE_TYPE(QFxTextInput)
+QML_DECLARE_TYPE(QValidator)
QML_DECLARE_TYPE(QIntValidator)
QT_END_HEADER
-#endif // QFXLINEEDIT_H
+
+#endif // QFXTEXTINPUT_H
diff --git a/src/declarative/fx/qfxlineedit_p.h b/src/declarative/fx/qfxtextinput_p.h
index 369669f..22a5306 100644
--- a/src/declarative/fx/qfxlineedit_p.h
+++ b/src/declarative/fx/qfxtextinput_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QFXLINEEDIT_P_H
-#define QFXLINEEDIT_P_H
+#ifndef QFXTEXTINPUT_P_H
+#define QFXTEXTINPUT_P_H
-#include "qfxlineedit.h"
+#include "qfxtextinput.h"
#include "qml.h"
#include "qfxpainteditem_p.h"
#include "private/qlinecontrol_p.h"
@@ -59,18 +59,18 @@
QT_BEGIN_NAMESPACE
-class QFxLineEditPrivate : public QFxPaintedItemPrivate
+class QFxTextInputPrivate : public QFxPaintedItemPrivate
{
- Q_DECLARE_PUBLIC(QFxLineEdit);
+ Q_DECLARE_PUBLIC(QFxTextInput);
public:
- QFxLineEditPrivate() : control(new QLineControl(QString())),
+ QFxTextInputPrivate() : control(new QLineControl(QString())),
color((QRgb)0), style(QFxText::Normal),
- styleColor((QRgb)0), hAlign(QFxLineEdit::AlignLeft),
+ styleColor((QRgb)0), hAlign(QFxTextInput::AlignLeft),
hscroll(0), oldScroll(0), focused(false), cursorVisible(false)
{
}
- ~QFxLineEditPrivate()
+ ~QFxTextInputPrivate()
{
}
@@ -85,7 +85,7 @@ public:
QColor highlightedTextColor;
QFxText::TextStyle style;
QColor styleColor;
- QFxLineEdit::HAlignment hAlign;
+ QFxTextInput::HAlignment hAlign;
QPointer<QmlComponent> cursorComponent;
QPointer<QFxItem> cursorItem;
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index ee16fae..5632dc0 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -55,6 +55,7 @@
#include <QtCore/qpoint.h>
#include <QtCore/qsize.h>
#include <QtDeclarative/qmlexpression.h>
+#include <QtDeclarative/qmlstateoperations.h>
#include <private/qmlstringconverters_p.h>
#include <private/qvariantanimation_p.h>
@@ -256,7 +257,7 @@ void QmlAbstractAnimation::setRunning(bool r)
d->startOnCompletion = true;
emit started();
} else {
- if (d->finishPlaying) {
+ if (d->alwaysRunToEnd) {
if (d->repeat)
qtAnimation()->setLoopCount(qtAnimation()->currentLoop()+1);
} else
@@ -321,8 +322,8 @@ void QmlAbstractAnimation::componentComplete()
}
/*!
- \qmlproperty bool Animation::finishPlaying
- This property holds whether the animation should finish playing when it is stopped.
+ \qmlproperty bool Animation::alwaysRunToEnd
+ This property holds whether the animation should run to completion when it is stopped.
If this true the animation will complete its current iteration when it
is stopped - either by setting the \c running property to false, or by
@@ -332,22 +333,22 @@ void QmlAbstractAnimation::componentComplete()
This behaviour is most useful when the \c repeat property is set, as the
animation will finish playing normally but not restart.
- By default, the finishPlaying property is not set.
+ By default, the alwaysRunToEnd property is not set.
*/
-bool QmlAbstractAnimation::finishPlaying() const
+bool QmlAbstractAnimation::alwaysRunToEnd() const
{
Q_D(const QmlAbstractAnimation);
- return d->finishPlaying;
+ return d->alwaysRunToEnd;
}
-void QmlAbstractAnimation::setFinishPlaying(bool f)
+void QmlAbstractAnimation::setAlwaysRunToEnd(bool f)
{
Q_D(QmlAbstractAnimation);
- if (d->finishPlaying == f)
+ if (d->alwaysRunToEnd == f)
return;
- d->finishPlaying = f;
- emit finishPlayingChanged(f);
+ d->alwaysRunToEnd = f;
+ emit alwaysRunToEndChanged(f);
}
/*!
@@ -421,7 +422,15 @@ void QmlAbstractAnimation::setGroup(QmlAnimationGroup *g)
}
/*!
- \qmlproperty Object Animation::target
+ \qmlproperty Object SetPropertyAction::target
+ This property holds an explicit target object to animate.
+
+ The exact effect of the \c target property depends on how the animation
+ is being used. Refer to the \l animation documentation for details.
+*/
+
+/*!
+ \qmlproperty Object PropertyAnimation::target
This property holds an explicit target object to animate.
The exact effect of the \c target property depends on how the animation
@@ -450,7 +459,15 @@ void QmlAbstractAnimation::setTarget(QObject *o)
}
/*!
- \qmlproperty string Animation::property
+ \qmlproperty string SetPropertyAction::property
+ This property holds an explicit property to animated.
+
+ The exact effect of the \c property property depends on how the animation
+ is being used. Refer to the \l animation documentation for details.
+*/
+
+/*!
+ \qmlproperty string PropertyAnimation::property
This property holds an explicit property to animated.
The exact effect of the \c property property depends on how the animation
@@ -530,7 +547,7 @@ void QmlAbstractAnimation::resume()
\endcode
was stopped at time 250ms, the \c x property will have a value of 50.
- However, if the \c finishPlaying property is set, the animation will
+ However, if the \c alwaysRunToEnd property is set, the animation will
continue running until it completes and then stop. The \c running property
will still become false immediately.
*/
@@ -603,7 +620,7 @@ void QmlAbstractAnimation::timelineComplete()
{
Q_D(QmlAbstractAnimation);
setRunning(false);
- if (d->finishPlaying && d->repeat) {
+ if (d->alwaysRunToEnd && d->repeat) {
qtAnimation()->setLoopCount(-1);
}
}
@@ -628,15 +645,6 @@ void QmlAbstractAnimation::timelineComplete()
/*!
\internal
\class QmlPauseAnimation
- \ingroup group_animation
- \ingroup group_states
- \brief The QmlPauseAnimation class provides a pause for an animation.
-
- When used in a QmlSequentialAnimation, QmlPauseAnimation is a step when
- nothing happens, for a specified duration.
-
- A QmlPauseAnimation object can be instantiated in Qml using the tag
- \l{xmlPauseAnimation} {&lt;PauseAnimation&gt;}.
*/
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PauseAnimation,QmlPauseAnimation)
@@ -664,12 +672,6 @@ void QmlPauseAnimationPrivate::init()
The default value is 250.
*/
-/*!
- \property QmlPauseAnimation::duration
- \brief the duration of the pause in milliseconds
-
- The default value is 250.
-*/
int QmlPauseAnimation::duration() const
{
Q_D(const QmlPauseAnimation);
@@ -712,12 +714,6 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation()
/*!
\internal
\class QmlColorAnimation
- \ingroup group_animation
- \ingroup group_states
- \brief The QmlColorAnimation class allows you to animate color changes.
-
- A QmlColorAnimation object can be instantiated in Qml using the tag
- \l{xmlColorAnimation} {&lt;ColorAnimation&gt;}.
*/
QmlColorAnimation::QmlColorAnimation(QObject *parent)
@@ -737,10 +733,6 @@ QmlColorAnimation::~QmlColorAnimation()
\qmlproperty color ColorAnimation::from
This property holds the starting color.
*/
-/*!
- \property QmlColorAnimation::from
- \brief the starting color.
-*/
QColor QmlColorAnimation::from() const
{
Q_D(const QmlPropertyAnimation);
@@ -756,10 +748,6 @@ void QmlColorAnimation::setFrom(const QColor &f)
\qmlproperty color ColorAnimation::from
This property holds the ending color.
*/
-/*!
- \property QmlColorAnimation::to
- \brief the ending color.
-*/
QColor QmlColorAnimation::to() const
{
Q_D(const QmlPropertyAnimation);
@@ -776,15 +764,12 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ColorAnimation,QmlColorAnimation
/*!
\qmlclass RunScriptAction QmlRunScriptAction
\inherits Animation
- \brief The RunScripAction allows scripts to be run during transitions.
+ \brief The RunScripAction allows scripts to be run during an animation.
*/
/*!
\internal
\class QmlRunScriptAction
- \brief The QmlRunScriptAction class allows scripts to be run during transitions
-
- \sa xmlRunScriptAction
*/
QmlRunScriptAction::QmlRunScriptAction(QObject *parent)
:QmlAbstractAnimation(*(new QmlRunScriptActionPrivate), parent)
@@ -805,7 +790,7 @@ void QmlRunScriptActionPrivate::init()
}
/*!
- \qmlproperty QString RunScript::script
+ \qmlproperty QString RunScriptAction::script
This property holds the script to run.
*/
QString QmlRunScriptAction::script() const
@@ -823,10 +808,29 @@ void QmlRunScriptAction::setScript(const QString &script)
emit scriptChanged(script);
}
+/*!
+ \qmlproperty QString RunScriptAction::runScriptName
+ This property holds the the name of the RunScript to run.
+
+ This property is only valid when RunScriptAction is used as part of a transition.
+ If both script and runScriptName are set, runScriptName will be used.
+*/
+QString QmlRunScriptAction::runScriptName() const
+{
+ Q_D(const QmlRunScriptAction);
+ return d->script;
+}
+
+void QmlRunScriptAction::setRunScriptName(const QString &name)
+{
+ Q_D(QmlRunScriptAction);
+ d->name = name;
+}
+
void QmlRunScriptActionPrivate::execute()
{
Q_Q(QmlRunScriptAction);
- QString scriptStr = script;
+ QString scriptStr = runScriptScript.isEmpty() ? script : runScriptScript;
if (!scriptStr.isEmpty()) {
QmlExpression expr(qmlContext(q), scriptStr, q);
@@ -835,6 +839,28 @@ void QmlRunScriptActionPrivate::execute()
}
}
+void QmlRunScriptAction::transition(QmlStateActions &actions,
+ QmlMetaProperties &modified,
+ TransitionDirection direction)
+{
+ Q_D(QmlRunScriptAction);
+ Q_UNUSED(modified);
+ Q_UNUSED(direction);
+
+ d->runScriptScript.clear();
+ for (int ii = 0; ii < actions.count(); ++ii) {
+ Action &action = actions[ii];
+
+ if (action.event && action.event->typeName() == QLatin1String("RunScript")
+ && static_cast<QmlRunScript*>(action.event)->name() == d->name) {
+ //### how should we handle reverse direction?
+ d->runScriptScript = static_cast<QmlRunScript*>(action.event)->script();
+ action.actionDone = true;
+ break; //assumes names are unique
+ }
+ }
+}
+
QAbstractAnimation *QmlRunScriptAction::qtAnimation()
{
Q_D(QmlRunScriptAction);
@@ -846,7 +872,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,RunScriptAction,QmlRunScriptActi
/*!
\qmlclass SetPropertyAction QmlSetPropertyAction
\inherits Animation
- \brief The SetPropertyAction allows property changes during transitions.
+ \brief The SetPropertyAction allows immediate property changes during animation.
Explicitly set \c theimage.smooth=true during a transition:
\code
@@ -864,10 +890,6 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,RunScriptAction,QmlRunScriptActi
/*!
\internal
\class QmlSetPropertyAction
- \brief The QmlSetPropertyAction class allows property changes during transitions.
-
- A QmlSetPropertyAction object can be instantiated in Qml using the tag
- \l{xmlSetPropertyAction} {&lt;SetPropertyAction&gt;}.
*/
QmlSetPropertyAction::QmlSetPropertyAction(QObject *parent)
: QmlAbstractAnimation(*(new QmlSetPropertyActionPrivate), parent)
@@ -1078,21 +1100,36 @@ void QmlParentChangeActionPrivate::init()
QFx_setParent_noEvent(cpa, q);
}
-void QmlParentChangeActionPrivate::doAction()
+QFxItem *QmlParentChangeAction::object() const
{
- //### property.write(value);
+ Q_D(const QmlParentChangeAction);
+ return d->pcTarget;
}
-void QmlParentChangeAction::prepare(QmlMetaProperty &p)
+void QmlParentChangeAction::setObject(QFxItem *target)
{
Q_D(QmlParentChangeAction);
+ d->pcTarget = target;
+}
- if (d->userProperty.isNull)
- d->property = p;
- else
- d->property = d->userProperty;
+QFxItem *QmlParentChangeAction::parent() const
+{
+ Q_D(const QmlParentChangeAction);
+ return d->pcParent;
+}
+
+void QmlParentChangeAction::setParent(QFxItem *parent)
+{
+ Q_D(QmlParentChangeAction);
+ d->pcParent = parent;
+}
- //###
+void QmlParentChangeActionPrivate::doAction()
+{
+ QmlParentChange pc;
+ pc.setObject(pcTarget);
+ pc.setParent(pcParent);
+ pc.execute();
}
QAbstractAnimation *QmlParentChangeAction::qtAnimation()
@@ -1111,8 +1148,12 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
struct QmlParentChangeActionData : public QAbstractAnimationAction
{
+ QmlParentChangeActionData(): pc(0) {}
+ ~QmlParentChangeActionData() { delete pc; }
+
QmlStateActions actions;
bool reverse;
+ QmlParentChange *pc;
virtual void doAction()
{
for (int ii = 0; ii < actions.count(); ++ii) {
@@ -1130,14 +1171,22 @@ void QmlParentChangeAction::transition(QmlStateActions &actions,
for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
- //### should we still use target to filter?
- //### still need type-specific matching
- if (action.event
- && action.event->typeName() == QLatin1String("ParentChange")) {
+ if (action.event && action.event->typeName() == QLatin1String("ParentChange")
+ && (!d->target || static_cast<QmlParentChange*>(action.event)->object() == d->target)) {
Action myAction = action;
data->reverse = action.reverseEvent;
- data->actions << myAction;
- action.actionDone = true;
+ if (d->pcParent) {
+ QmlParentChange *pc = new QmlParentChange;
+ pc->setObject(d->pcTarget);
+ pc->setParent(d->pcParent);
+ myAction.event = pc;
+ data->pc = pc;
+ data->actions << myAction;
+ break; //only match one
+ } else {
+ action.actionDone = true;
+ data->actions << myAction;
+ }
}
}
@@ -1165,12 +1214,6 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParentChangeAction,QmlParentChan
/*!
\internal
\class QmlNumberAnimation
- \ingroup group_animation
- \ingroup group_states
- \brief The QmlNumberAnimation class allows you to animate changes in properties of type qreal.
-
- A QmlNumberAnimation object can be instantiated in Qml using the tag
- \l{xmlNumberAnimation} {&lt;NumberAnimation&gt;}.
*/
QmlNumberAnimation::QmlNumberAnimation(QObject *parent)
@@ -1190,10 +1233,6 @@ QmlNumberAnimation::~QmlNumberAnimation()
This property holds the starting value.
If not set, then the value defined in the start state of the transition.
*/
-/*!
- \property QmlNumberAnimation::from
- \brief the starting value.
-*/
qreal QmlNumberAnimation::from() const
{
Q_D(const QmlPropertyAnimation);
@@ -1210,10 +1249,6 @@ void QmlNumberAnimation::setFrom(qreal f)
This property holds the ending value.
If not set, then the value defined in the end state of the transition.
*/
-/*!
- \property QmlNumberAnimation::to
- \brief the ending value.
-*/
qreal QmlNumberAnimation::to() const
{
Q_D(const QmlPropertyAnimation);
@@ -1339,16 +1374,6 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,SequentialAnimation,QmlSequentia
/*!
\internal
\class QmlParallelAnimation
- \ingroup group_animation
- \ingroup group_states
- \brief The QmlParallelAnimation class allows you to run animations in parallel.
-
- Animations controlled by QmlParallelAnimation will be run at the same time.
-
- \sa QmlSequentialAnimation
-
- A QmlParallelAnimation object can be instantiated in Qml using the tag
- \l{xmlParallelAnimation} {&lt;ParallelAnimation&gt;}.
*/
QmlParallelAnimation::QmlParallelAnimation(QObject *parent) :
@@ -1486,12 +1511,6 @@ void QmlPropertyAnimationPrivate::init()
The default value is 250.
*/
-/*!
- \property QmlPropertyAnimation::duration
- \brief the duration of the transition, in milliseconds.
-
- The default value is 250.
-*/
int QmlPropertyAnimation::duration() const
{
Q_D(const QmlPropertyAnimation);
@@ -1517,10 +1536,6 @@ void QmlPropertyAnimation::setDuration(int duration)
This property holds the starting value.
If not set, then the value defined in the start state of the transition.
*/
-/*!
- \property QmlPropertyAnimation::from
- \brief the starting value.
-*/
QVariant QmlPropertyAnimation::from() const
{
Q_D(const QmlPropertyAnimation);
@@ -1542,10 +1557,6 @@ void QmlPropertyAnimation::setFrom(const QVariant &f)
This property holds the ending value.
If not set, then the value defined in the end state of the transition.
*/
-/*!
- \property QmlPropertyAnimation::to
- \brief the ending value.
-*/
QVariant QmlPropertyAnimation::to() const
{
Q_D(const QmlPropertyAnimation);
@@ -1612,13 +1623,6 @@ void QmlPropertyAnimation::setTo(const QVariant &t)
\i \e easeOutInBounce - Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out/in: deceleration until halfway, then acceleration.
\endlist
*/
-
-/*!
- \property QmlPropertyAnimation::easing
- \brief the easing curve to use.
-
- \sa QEasingCurve
-*/
QString QmlPropertyAnimation::easing() const
{
Q_D(const QmlPropertyAnimation);
@@ -1643,13 +1647,6 @@ void QmlPropertyAnimation::setEasing(const QString &e)
This is a comma-separated list of properties that should use
this animation when they change.
*/
-/*!
- \property QmlPropertyAnimation::properties
- \brief the properties this animation should be applied to
-
- properties holds a copy separated list of properties that should use
- this animation when they change.
-*/
QString QmlPropertyAnimation::properties() const
{
Q_D(const QmlPropertyAnimation);
diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h
index ef7842c..602bf37 100644
--- a/src/declarative/util/qmlanimation.h
+++ b/src/declarative/util/qmlanimation.h
@@ -66,10 +66,10 @@ class QmlAbstractAnimation : public QmlPropertyValueSource, public QmlParserStat
Q_INTERFACES(QmlParserStatus)
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
- Q_PROPERTY(bool finishPlaying READ finishPlaying WRITE setFinishPlaying NOTIFY finishPlayingChanged())
+ Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged())
Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged)
- Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
- Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
+ //Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
+ //Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
Q_CLASSINFO("DefaultMethod", "start()")
Q_INTERFACES(QmlParserStatus)
@@ -81,8 +81,8 @@ public:
void setRunning(bool);
bool isPaused() const;
void setPaused(bool);
- bool finishPlaying() const;
- void setFinishPlaying(bool);
+ bool alwaysRunToEnd() const;
+ void setAlwaysRunToEnd(bool);
bool repeat() const;
void setRepeat(bool);
@@ -92,6 +92,7 @@ public:
QmlAnimationGroup *group() const;
void setGroup(QmlAnimationGroup *);
+ //### these belong at a lower level in the hierarchy
QObject *target() const;
void setTarget(QObject *);
QString property() const;
@@ -109,7 +110,7 @@ Q_SIGNALS:
void pausedChanged(bool);
void repeatChanged(bool);
void targetChanged(QObject *, const QString &);
- void finishPlayingChanged(bool);
+ void alwaysRunToEndChanged(bool);
public Q_SLOTS:
void restart();
@@ -163,6 +164,7 @@ class QmlRunScriptAction : public QmlAbstractAnimation
Q_DECLARE_PRIVATE(QmlRunScriptAction)
Q_PROPERTY(QString script READ script WRITE setScript NOTIFY scriptChanged)
+ Q_PROPERTY(QString runScriptName READ runScriptName WRITE setRunScriptName)
public:
QmlRunScriptAction(QObject *parent=0);
@@ -171,10 +173,16 @@ public:
QString script() const;
void setScript(const QString &);
+ QString runScriptName() const;
+ void setRunScriptName(const QString &);
+
Q_SIGNALS:
void scriptChanged(const QString &);
protected:
+ virtual void transition(QmlStateActions &actions,
+ QmlMetaProperties &modified,
+ TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
};
@@ -184,6 +192,8 @@ class QmlSetPropertyAction : public QmlAbstractAnimation
Q_OBJECT
Q_DECLARE_PRIVATE(QmlSetPropertyAction)
+ Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
Q_PROPERTY(QList<QObject *>* targets READ targets)
Q_PROPERTY(QList<QObject *>* exclude READ exclude)
@@ -214,24 +224,31 @@ protected:
virtual void prepare(QmlMetaProperty &);
};
+class QFxItem;
class QmlParentChangeActionPrivate;
class QmlParentChangeAction : public QmlAbstractAnimation
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlParentChangeAction)
- //XXX should have parent property as well for when it isn't part of a transition
+ Q_PROPERTY(QFxItem *target READ object WRITE setObject)
+ Q_PROPERTY(QFxItem *parent READ parent WRITE setParent)
public:
QmlParentChangeAction(QObject *parent=0);
virtual ~QmlParentChangeAction();
+ QFxItem *object() const;
+ void setObject(QFxItem *);
+
+ QFxItem *parent() const;
+ void setParent(QFxItem *);
+
protected:
virtual void transition(QmlStateActions &actions,
QmlMetaProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
- virtual void prepare(QmlMetaProperty &);
};
class QmlPropertyAnimationPrivate;
@@ -244,6 +261,8 @@ class QmlPropertyAnimation : public QmlAbstractAnimation
Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged)
Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged)
Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged)
+ Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
Q_PROPERTY(QList<QObject *>* targets READ targets)
Q_PROPERTY(QList<QObject *>* exclude READ exclude)
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index 3868255..fb4dae0 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -183,13 +183,13 @@ class QmlAbstractAnimationPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QmlAbstractAnimation)
public:
QmlAbstractAnimationPrivate()
- : running(false), paused(false), finishPlaying(false), repeat(false),
+ : running(false), paused(false), alwaysRunToEnd(false), repeat(false),
connectedTimeLine(false), componentComplete(true), startOnCompletion(false),
target(0), group(0) {}
bool running;
bool paused;
- bool finishPlaying;
+ bool alwaysRunToEnd;
bool repeat;
bool connectedTimeLine;
@@ -230,6 +230,8 @@ public:
void init();
QString script;
+ QString name;
+ QString runScriptScript;
void execute();
@@ -265,10 +267,13 @@ class QmlParentChangeActionPrivate : public QmlAbstractAnimationPrivate
Q_DECLARE_PUBLIC(QmlParentChangeAction)
public:
QmlParentChangeActionPrivate()
- : QmlAbstractAnimationPrivate() {}
+ : QmlAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {}
void init();
+ QFxItem *pcTarget;
+ QFxItem *pcParent;
+
void doAction();
QActionAnimation *cpa;
};