summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 03:11:10 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 03:11:10 (GMT)
commitb1af9212cb0f7fe85458677aee8de3ad94a8883a (patch)
tree6d8789c1b8d96545a93cf1470778391b0adcf7b9
parentc0c89664feec6fa6d70b4ffb44a8cfdac9de532f (diff)
parent3a1a7cf24f54b3ef23accc777f10c6ebba12f37b (diff)
downloadQt-b1af9212cb0f7fe85458677aee8de3ad94a8883a.zip
Qt-b1af9212cb0f7fe85458677aee8de3ad94a8883a.tar.gz
Qt-b1af9212cb0f7fe85458677aee8de3ad94a8883a.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--examples/declarative/follow/follow.qml12
-rw-r--r--examples/declarative/loader/loader.qrc1
-rw-r--r--examples/declarative/loader/main.cpp118
-rw-r--r--src/declarative/fx/qfxflickable.cpp12
-rw-r--r--src/declarative/fx/qfxlineedit.cpp17
-rw-r--r--src/declarative/fx/qfxlineedit.h3
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp46
-rw-r--r--src/declarative/fx/qfxmouseregion.h40
-rw-r--r--src/declarative/fx/qfxmouseregion_p.h4
-rw-r--r--src/declarative/util/qmlfollow.cpp53
-rw-r--r--src/declarative/util/qmlfollow.h5
11 files changed, 246 insertions, 65 deletions
diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml
index b906c12..59561b3 100644
--- a/examples/declarative/follow/follow.qml
+++ b/examples/declarative/follow/follow.qml
@@ -25,6 +25,7 @@ Rect {
Rect {
color: "#ff0000"
x: Rect.width; width: Rect.width; height: 20
+ y: 200
y: Follow { source: Rect.y; velocity: 200 }
}
Text { x: Rect.width; y: 220; text: "Velocity" }
@@ -32,8 +33,15 @@ Rect {
// Spring
Rect {
color: "#ff0000"
- x: Rect.width * 2; width: Rect.width; height: 20
- y: Follow { source: Rect.y; spring: 1.2; damping: 0.1 }
+ x: Rect.width * 2; width: Rect.width/2; height: 20
+ y: 200
+ y: Follow { source: Rect.y; spring: 1.0; damping: 0.2 }
+ }
+ Rect {
+ color: "#880000"
+ x: Rect.width * 2.5; width: Rect.width/2; height: 20
+ y: 200
+ y: Follow { source: Rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object
}
Text { x: Rect.width * 2; y: 220; text: "Spring" }
diff --git a/examples/declarative/loader/loader.qrc b/examples/declarative/loader/loader.qrc
index bdbcd5c..73ee253 100644
--- a/examples/declarative/loader/loader.qrc
+++ b/examples/declarative/loader/loader.qrc
@@ -4,5 +4,6 @@
<file>Browser.qml</file>
<file>images/fileopen.png</file>
<file>images/up.png</file>
+ <file>Button.qml</file>
</qresource>
</RCC>
diff --git a/examples/declarative/loader/main.cpp b/examples/declarative/loader/main.cpp
index 762212b..070ba75 100644
--- a/examples/declarative/loader/main.cpp
+++ b/examples/declarative/loader/main.cpp
@@ -2,6 +2,12 @@
#include <QUrl>
#include <QFileInfo>
#include <QDir>
+#include <QPlainTextEdit>
+#include <QAction>
+#include <QVBoxLayout>
+#include <QMainWindow>
+#include <QMenuBar>
+#include <QDebug>
#include <QmlContext>
#include <QmlComponent>
#include <qfxview.h>
@@ -9,6 +15,61 @@
QFxView *canvas = 0;
+class Logger : public QWidget
+{
+ Q_OBJECT
+public:
+ Logger() : QWidget() {
+ logText = new QPlainTextEdit;
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(logText);
+ layout->setMargin(0);
+ setLayout(layout);
+#ifdef Q_OS_SYMBIAN
+ QAction *closeAction = new QAction("Close", this);
+ closeAction->setSoftKeyRole(QAction::BackSoftKey);
+ connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
+
+ QList<QAction*> softKeys;
+ softKeys.append(closeAction);
+ setSoftKeys(softKeys);
+#endif
+ }
+
+ void append(const QString &text) {
+ logText->appendPlainText(text);
+ }
+
+ static Logger *instance() {
+ static Logger *logger = 0;
+ if (!logger)
+ logger = new Logger();
+ return logger;
+ }
+
+private:
+ QPlainTextEdit *logText;
+};
+
+void myMessageOutput(QtMsgType type, const char *msg)
+{
+ switch (type) {
+ case QtDebugMsg:
+ Logger::instance()->append(QString(msg));
+ break;
+ case QtWarningMsg:
+ Logger::instance()->append(QString(msg));
+ break;
+ case QtCriticalMsg:
+ Logger::instance()->append(QString(msg));
+ break;
+ case QtFatalMsg:
+ Logger::instance()->append(QString(msg));
+ abort();
+ }
+}
+
+
class QmlLauncher : public QObject
{
Q_OBJECT
@@ -51,20 +112,75 @@ public:
canvas->setUrl(fileName);
canvas->execute();
}
+
+signals:
+ void logUpdated();
};
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+public:
+ MainWindow() : QMainWindow() {}
+
+
+public slots:
+ void toggleFullScreen()
+ {
+ if (isFullScreen()) {
+#ifdef Q_OS_SYMBIAN
+ showMaximized();
+#else
+ showNormal();
+#endif
+ } else {
+ showFullScreen();
+ }
+ }
+
+ void showLog()
+ {
+#ifdef Q_OS_SYMBIAN
+ Logger::instance()->showMaximized();
+#else
+ Logger::instance()->show();
+#endif
+ }
+};
+
+
int main(int argc, char *argv[])
{
+ qInstallMsgHandler(myMessageOutput);
QApplication app(argc, argv);
+ MainWindow *mw = new MainWindow;
+
QmlLauncher *launcher = new QmlLauncher;
+ QObject::connect(Logger::instance(), SIGNAL(textChanged()), launcher, SIGNAL(logUpdated()));
+
canvas = new QFxView;
+ mw->setCentralWidget(canvas);
+
+ QMenuBar *mb = mw->menuBar();
+ QAction *showLogAction = new QAction("View Log...", mw);
+ mb->addAction(showLogAction);
+ QObject::connect(showLogAction, SIGNAL(triggered()), mw, SLOT(showLog()));
+ QAction *toggleFSAction = new QAction("Fullscreen", mw);
+ mb->addAction(toggleFSAction);
+ QObject::connect(toggleFSAction, SIGNAL(triggered()), mw, SLOT(toggleFullScreen()));
+
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("qmlLauncher", launcher);
canvas->setUrl(QUrl("qrc:/loader.qml"));
+#ifdef Q_OS_SYMBIAN
+ canvas->setContentResizable(true);
+ mw->showMaximized();
+#else
+ mw->show();
+#endif
canvas->execute();
- canvas->show();
return app.exec();
}
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index d94c6d8..e73c8a4 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -128,16 +128,17 @@ void QFxFlickablePrivate::fixupX()
vTime = _tl.time();
- if (_moveX.value() > q->minXExtent() || q->maxXExtent() > 0) {
+ if (_moveX.value() > q->minXExtent() || (q->maxXExtent() > q->maxXExtent())) {
_tl.clear();
- _tl.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
- flicked = false;
+ if (_moveX.value() != q->minXExtent())
+ _tl.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
//emit flickingChanged();
} else if (_moveX.value() < q->maxXExtent()) {
_tl.clear();
_tl.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
- flicked = false;
//emit flickingChanged();
+ } else {
+ flicked = false;
}
}
@@ -151,7 +152,8 @@ void QFxFlickablePrivate::fixupY()
if (_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) {
_tl.clear();
- _tl.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
+ if (_moveY.value() != q->minYExtent())
+ _tl.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200);
//emit flickingChanged();
} else if (_moveY.value() < q->maxYExtent()) {
_tl.clear();
diff --git a/src/declarative/fx/qfxlineedit.cpp b/src/declarative/fx/qfxlineedit.cpp
index c88f1d0..4ff3504 100644
--- a/src/declarative/fx/qfxlineedit.cpp
+++ b/src/declarative/fx/qfxlineedit.cpp
@@ -108,6 +108,22 @@ QmlFont *QFxLineEdit::font()
}
/*!
+This signal is emitted when the font of the item changes.
+*/
+void QFxLineEdit::fontChanged()
+{
+ Q_D(QFxLineEdit);
+ d->control->setFont(d->font->font());
+ if(d->cursorItem){
+ d->cursorItem->setHeight(QFontMetrics(d->font->font()).height());
+ moveCursor();
+ }
+ //updateSize();
+ updateAll();//TODO: Only necessary updates
+ emit update();
+}
+
+/*!
\qmlproperty color LineEdit::color
The text color.
@@ -478,6 +494,7 @@ void QFxLineEditPrivate::init()
q, SLOT(updateAll()));
if(!font)
font = new QmlFont();
+ q->connect(font, SIGNAL(updated()), q, SLOT(fontChanged()));
q->updateSize();
oldValidity = control->hasAcceptableInput();
lastSelectionStart = 0;
diff --git a/src/declarative/fx/qfxlineedit.h b/src/declarative/fx/qfxlineedit.h
index 2c22d4b..0f56818 100644
--- a/src/declarative/fx/qfxlineedit.h
+++ b/src/declarative/fx/qfxlineedit.h
@@ -147,8 +147,9 @@ protected:
void focusChanged(bool hasFocus);
-private slots:
+private Q_SLOTS:
void updateSize();
+ void fontChanged();
void q_textChanged();
void selectionChanged();
void updateAll();
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index d7bb7c9..bc19c23 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -46,7 +46,7 @@
QT_BEGIN_NAMESPACE
-static const int DragThreshold = 5;
+static const qreal DragThreshold = 5;
static const int PressAndHoldDelay = 800;
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Drag,QFxDrag)
@@ -85,12 +85,12 @@ void QFxDrag::setAxis(const QString &a)
If x-axis dragging is enabled, xmin limits how far to the left the target can be dragged. If x-axis dragging is not enabled, this property has no effect.
*/
-int QFxDrag::xmin() const
+qreal QFxDrag::xmin() const
{
return _xmin;
}
-void QFxDrag::setXmin(int m)
+void QFxDrag::setXmin(qreal m)
{
_xmin = m;
}
@@ -101,12 +101,12 @@ void QFxDrag::setXmin(int m)
If x-axis dragging is enabled, xmax limits how far to the right the target can be dragged. If x-axis dragging is not enabled, this property has no effect.
*/
-int QFxDrag::xmax() const
+qreal QFxDrag::xmax() const
{
return _xmax;
}
-void QFxDrag::setXmax(int m)
+void QFxDrag::setXmax(qreal m)
{
_xmax = m;
}
@@ -117,12 +117,12 @@ void QFxDrag::setXmax(int m)
If y-axis dragging is enabled, ymin limits how far up the target can be dragged. If y-axis dragging is not enabled, this property has no effect.
*/
-int QFxDrag::ymin() const
+qreal QFxDrag::ymin() const
{
return _ymin;
}
-void QFxDrag::setYmin(int m)
+void QFxDrag::setYmin(qreal m)
{
_ymin = m;
}
@@ -133,12 +133,12 @@ void QFxDrag::setYmin(int m)
If y-axis dragging is enabled, ymax limits how far down the target can be dragged. If y-axis dragging is not enabled, this property has no effect.
*/
-int QFxDrag::ymax() const
+qreal QFxDrag::ymax() const
{
return _ymax;
}
-void QFxDrag::setYmax(int m)
+void QFxDrag::setYmax(qreal m)
{
_ymax = m;
}
@@ -266,21 +266,21 @@ QFxMouseRegion::~QFxMouseRegion()
}
/*!
- \qmlproperty int MouseRegion::mouseX
- \qmlproperty int MouseRegion::mouseY
+ \qmlproperty real MouseRegion::mouseX
+ \qmlproperty real MouseRegion::mouseY
The coordinates of the mouse while pressed. The coordinates are relative to the item that was pressed.
*/
-int QFxMouseRegion::mouseX() const
+qreal QFxMouseRegion::mouseX() const
{
Q_D(const QFxMouseRegion);
- return int(d->lastPos.x());
+ return d->lastPos.x();
}
-int QFxMouseRegion::mouseY() const
+qreal QFxMouseRegion::mouseY() const
{
Q_D(const QFxMouseRegion);
- return int(d->lastPos.y());
+ return d->lastPos.y();
}
/*!
@@ -342,8 +342,8 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (drag()->target()) {
if (!d->moved) {
- if (d->dragX) d->startX = int(drag()->target()->x()); //### change startX and startY to qreal?
- if (d->dragY) d->startY = int(drag()->target()->y());
+ if (d->dragX) d->startX = drag()->target()->x();
+ if (d->dragY) d->startY = drag()->target()->y();
}
QPointF startLocalPos;
@@ -356,8 +356,8 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
curLocalPos = event->scenePos();
}
- int dx = int(qAbs(curLocalPos.x() - startLocalPos.x()));
- int dy = int(qAbs(curLocalPos.y() - startLocalPos.y()));
+ qreal dx = qAbs(curLocalPos.x() - startLocalPos.x());
+ qreal dy = qAbs(curLocalPos.y() - startLocalPos.y());
if ((d->dragX && !(dx < DragThreshold)) || (d->dragY && !(dy < DragThreshold)))
d->dragged = true;
if (!keepMouseGrab()) {
@@ -530,10 +530,10 @@ QFxDrag *QFxMouseRegion::drag()
/*!
\qmlproperty Item MouseRegion::drag.target
\qmlproperty string MouseRegion::drag.axis
- \qmlproperty int MouseRegion::drag.xmin
- \qmlproperty int MouseRegion::drag.xmax
- \qmlproperty int MouseRegion::drag.ymin
- \qmlproperty int MouseRegion::drag.ymax
+ \qmlproperty real MouseRegion::drag.xmin
+ \qmlproperty real MouseRegion::drag.xmax
+ \qmlproperty real MouseRegion::drag.ymin
+ \qmlproperty real MouseRegion::drag.ymax
drag provides a convenient way to make an item draggable.
diff --git a/src/declarative/fx/qfxmouseregion.h b/src/declarative/fx/qfxmouseregion.h
index 47929be..6d85cea 100644
--- a/src/declarative/fx/qfxmouseregion.h
+++ b/src/declarative/fx/qfxmouseregion.h
@@ -56,10 +56,10 @@ class Q_DECLARATIVE_EXPORT QFxDrag : public QObject
Q_PROPERTY(QFxItem *target READ target WRITE setTarget)
Q_PROPERTY(QString axis READ axis WRITE setAxis)
- Q_PROPERTY(int xmin READ xmin WRITE setXmin)
- Q_PROPERTY(int xmax READ xmax WRITE setXmax)
- Q_PROPERTY(int ymin READ ymin WRITE setYmin)
- Q_PROPERTY(int ymax READ ymax WRITE setYmax)
+ Q_PROPERTY(qreal xmin READ xmin WRITE setXmin)
+ Q_PROPERTY(qreal xmax READ xmax WRITE setXmax)
+ Q_PROPERTY(qreal ymin READ ymin WRITE setYmin)
+ Q_PROPERTY(qreal ymax READ ymax WRITE setYmax)
public:
QFxDrag(QObject *parent=0);
~QFxDrag();
@@ -68,22 +68,22 @@ public:
void setTarget(QFxItem *);
QString axis() const;
void setAxis(const QString &);
- int xmin() const;
- void setXmin(int);
- int xmax() const;
- void setXmax(int);
- int ymin() const;
- void setYmin(int);
- int ymax() const;
- void setYmax(int);
+ qreal xmin() const;
+ void setXmin(qreal);
+ qreal xmax() const;
+ void setXmax(qreal);
+ qreal ymin() const;
+ void setYmin(qreal);
+ qreal ymax() const;
+ void setYmax(qreal);
private:
QFxItem *_target;
QString _axis;
- int _xmin;
- int _xmax;
- int _ymin;
- int _ymax;
+ qreal _xmin;
+ qreal _xmax;
+ qreal _ymin;
+ qreal _ymax;
Q_DISABLE_COPY(QFxDrag)
};
@@ -93,8 +93,8 @@ class Q_DECLARATIVE_EXPORT QFxMouseRegion : public QFxItem
{
Q_OBJECT
- Q_PROPERTY(int mouseX READ mouseX NOTIFY positionChanged)
- Q_PROPERTY(int mouseY READ mouseY NOTIFY positionChanged)
+ Q_PROPERTY(qreal mouseX READ mouseX NOTIFY positionChanged)
+ Q_PROPERTY(qreal mouseY READ mouseY NOTIFY positionChanged)
Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
@@ -103,8 +103,8 @@ public:
QFxMouseRegion(QFxItem *parent=0);
~QFxMouseRegion();
- int mouseX() const;
- int mouseY() const;
+ qreal mouseX() const;
+ qreal mouseY() const;
bool isEnabled() const;
void setEnabled(bool);
diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h
index a41f32a..70d78f3 100644
--- a/src/declarative/fx/qfxmouseregion_p.h
+++ b/src/declarative/fx/qfxmouseregion_p.h
@@ -95,8 +95,8 @@ public:
QFxDrag drag;
QPointF start;
QPointF startScene;
- int startX;
- int startY;
+ qreal startX;
+ qreal startY;
QPointF lastPos;
Qt::MouseButton lastButton;
Qt::MouseButtons lastButtons;
diff --git a/src/declarative/util/qmlfollow.cpp b/src/declarative/util/qmlfollow.cpp
index 36e7f14..987ccb0 100644
--- a/src/declarative/util/qmlfollow.cpp
+++ b/src/declarative/util/qmlfollow.cpp
@@ -56,7 +56,8 @@ class QmlFollowPrivate : public QObjectPrivate
public:
QmlFollowPrivate()
: sourceValue(0), maxVelocity(0), lastTime(0)
- , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01), modulus(0.0), enabled(true), mode(Track), clock(this) {}
+ , mass(1.0), useMass(false), spring(0.), damping(0.), velocity(0), epsilon(0.01)
+ , modulus(0.0), haveModulus(false), enabled(true), mode(Track), clock(this) {}
QmlMetaProperty property;
qreal currentValue;
@@ -70,6 +71,8 @@ public:
qreal velocity;
qreal epsilon;
qreal modulus;
+ bool haveModulus;
+ bool useMass;
bool enabled;
enum Mode {
@@ -95,7 +98,7 @@ void QmlFollowPrivate::tick(int time)
if (!elapsed)
return;
qreal srcVal = sourceValue;
- if (modulus != 0.0) {
+ if (haveModulus) {
currentValue = fmod(currentValue, modulus);
srcVal = fmod(srcVal, modulus);
}
@@ -107,15 +110,16 @@ void QmlFollowPrivate::tick(int time)
int count = elapsed / 16;
for (int i = 0; i < count; ++i) {
qreal diff = srcVal - currentValue;
- if (modulus != 0.0 && qAbs(diff) > modulus / 2) {
+ if (haveModulus && qAbs(diff) > modulus / 2) {
if (diff < 0)
diff += modulus;
else
diff -= modulus;
}
- velocity = velocity + spring * diff - damping * velocity;
- // The following line supports mass. Not sure its worth the extra divisions.
- // velocity = velocity + spring / mass * diff - damping / mass * velocity;
+ if (useMass)
+ velocity = velocity + (spring * diff - damping * velocity) / mass;
+ else
+ velocity = velocity + spring * diff - damping * velocity;
if (maxVelocity > 0.) {
// limit velocity
if (velocity > maxVelocity)
@@ -124,7 +128,7 @@ void QmlFollowPrivate::tick(int time)
velocity = -maxVelocity;
}
currentValue += velocity * 16.0 / 1000.0;
- if (modulus != 0.0) {
+ if (haveModulus) {
currentValue = fmod(currentValue, modulus);
if (currentValue < 0.0)
currentValue += modulus;
@@ -139,7 +143,7 @@ void QmlFollowPrivate::tick(int time)
} else {
qreal moveBy = elapsed * velocityms;
qreal diff = srcVal - currentValue;
- if (modulus != 0.0 && qAbs(diff) > modulus / 2) {
+ if (haveModulus && qAbs(diff) > modulus / 2) {
if (diff < 0)
diff += modulus;
else
@@ -147,7 +151,7 @@ void QmlFollowPrivate::tick(int time)
}
if (diff > 0) {
currentValue += moveBy;
- if (modulus != 0.0)
+ if (haveModulus)
currentValue = fmod(currentValue, modulus);
if (currentValue > sourceValue) {
currentValue = sourceValue;
@@ -155,7 +159,7 @@ void QmlFollowPrivate::tick(int time)
}
} else {
currentValue -= moveBy;
- if (modulus != 0.0 && currentValue < 0.0)
+ if (haveModulus && currentValue < 0.0)
currentValue = fmod(currentValue, modulus) + modulus;
if (currentValue < sourceValue) {
currentValue = sourceValue;
@@ -375,7 +379,34 @@ qreal QmlFollow::modulus() const
void QmlFollow::setModulus(qreal modulus)
{
Q_D(QmlFollow);
- d->modulus = modulus;
+ if (d->modulus != modulus) {
+ d->haveModulus = modulus != 0.0;
+ d->modulus = modulus;
+ emit modulusChanged();
+ }
+}
+
+/*!
+ \qmlproperty qreal Follow::mass
+ This property holds the "mass" of the property being moved.
+
+ mass is 1.0 by default. Setting a different mass changes the dynamics of
+ a \l spring follow.
+*/
+qreal QmlFollow::mass() const
+{
+ Q_D(const QmlFollow);
+ return d->mass;
+}
+
+void QmlFollow::setMass(qreal mass)
+{
+ Q_D(QmlFollow);
+ if (d->mass != mass && mass > 0.0) {
+ d->useMass = mass != 1.0;
+ d->mass = mass;
+ emit massChanged();
+ }
}
/*!
diff --git a/src/declarative/util/qmlfollow.h b/src/declarative/util/qmlfollow.h
index e0a588b..5c1093e 100644
--- a/src/declarative/util/qmlfollow.h
+++ b/src/declarative/util/qmlfollow.h
@@ -68,6 +68,7 @@ class Q_DECLARATIVE_EXPORT QmlFollow : public QmlPropertyValueSource,
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
Q_PROPERTY(qreal followValue READ value NOTIFY valueChanged)
Q_PROPERTY(qreal modulus READ modulus WRITE setModulus NOTIFY modulusChanged)
+ Q_PROPERTY(qreal mass READ mass WRITE setMass NOTIFY massChanged)
Q_PROPERTY(bool inSync READ inSync NOTIFY syncChanged)
public:
@@ -86,6 +87,8 @@ public:
void setDamping(qreal damping);
qreal epsilon() const;
void setEpsilon(qreal epsilon);
+ qreal mass() const;
+ void setMass(qreal modulus);
qreal modulus() const;
void setModulus(qreal modulus);
bool enabled() const;
@@ -96,6 +99,8 @@ public:
Q_SIGNALS:
void valueChanged(qreal);
+ void modulusChanged();
+ void massChanged();
void syncChanged();
};