diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-10-06 23:56:02 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-10-06 23:56:02 (GMT) |
commit | b8d72b6bf833ffd7e02afa1199a5d3beea8fe9a7 (patch) | |
tree | ac169cc9df2ff639e81b15dcaf268ed09d2e16cb /src/declarative | |
parent | 5584feca163e91588f08b0aa1f3ae2817cd90823 (diff) | |
parent | d7fe798e022884dcbc58844e686a7d4fd39cf027 (diff) | |
download | Qt-b8d72b6bf833ffd7e02afa1199a5d3beea8fe9a7.zip Qt-b8d72b6bf833ffd7e02afa1199a5d3beea8fe9a7.tar.gz Qt-b8d72b6bf833ffd7e02afa1199a5d3beea8fe9a7.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/qfxlistview.cpp | 49 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.h | 11 | ||||
-rw-r--r-- | src/declarative/fx/qfxrect.cpp | 37 | ||||
-rw-r--r-- | src/declarative/util/qmlstateoperations.cpp | 7 |
4 files changed, 70 insertions, 34 deletions
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 501b4df..1247021 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -178,6 +178,7 @@ public: , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0), spacing(0.0) , ownModel(false), wrap(false), autoHighlight(true) , haveHighlightRange(false), strictHighlightRange(false) + , highlightMoveSpeed(400), highlightResizeSpeed(400) {} void init(); @@ -390,6 +391,8 @@ public: QString sectionExpression; QString currentSection; qreal spacing; + qreal highlightMoveSpeed; + qreal highlightResizeSpeed; bool ownModel : 1; bool wrap : 1; @@ -667,11 +670,11 @@ void QFxListViewPrivate::createHighlight() const QLatin1String posProp(orient == Qt::Vertical ? "y" : "x"); highlightPosAnimator = new QmlEaseFollow(q); highlightPosAnimator->setTarget(QmlMetaProperty(highlight->item, posProp)); - highlightPosAnimator->setVelocity(400); + highlightPosAnimator->setVelocity(highlightMoveSpeed); highlightPosAnimator->setEnabled(autoHighlight); const QLatin1String sizeProp(orient == Qt::Vertical ? "height" : "width"); highlightSizeAnimator = new QmlEaseFollow(q); - highlightSizeAnimator->setVelocity(400); + highlightSizeAnimator->setVelocity(highlightResizeSpeed); highlightSizeAnimator->setTarget(QmlMetaProperty(highlight->item, sizeProp)); highlightSizeAnimator->setEnabled(autoHighlight); } @@ -1259,6 +1262,48 @@ QString QFxListView::currentSection() const return d->currentSection; } +/*! + \qmlproperty real ListView::highlightMoveSpeed + + This property holds the moving animation speed of the highlight delegate. +*/ +qreal QFxListView::highlightMoveSpeed() const +{ + Q_D(const QFxListView);\ + return d->highlightMoveSpeed; +} + +void QFxListView::setHighlightMoveSpeed(qreal speed) +{ + Q_D(QFxListView);\ + if (d->highlightMoveSpeed != speed) + { + d->highlightMoveSpeed = speed; + emit highlightMoveSpeedChanged(); + } +} + +/*! + \qmlproperty real ListView::highlightResizeSpeed + + This property holds the resizing animation speed of the highlight delegate. +*/ +qreal QFxListView::highlightResizeSpeed() const +{ + Q_D(const QFxListView);\ + return d->highlightResizeSpeed; +} + +void QFxListView::setHighlightResizeSpeed(qreal speed) +{ + Q_D(QFxListView);\ + if (d->highlightResizeSpeed != speed) + { + d->highlightResizeSpeed = speed; + emit highlightResizeSpeedChanged(); + } +} + void QFxListView::viewportMoved() { Q_D(QFxListView); diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index fc15967..3cff422 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -77,6 +77,9 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer) Q_PROPERTY(QString sectionExpression READ sectionExpression WRITE setSectionExpression NOTIFY sectionExpressionChanged) Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged) + + Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged) + Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged) Q_CLASSINFO("DefaultProperty", "data") public: @@ -126,6 +129,12 @@ public: void setSectionExpression(const QString &); QString currentSection() const; + qreal highlightMoveSpeed() const; + void setHighlightMoveSpeed(qreal); + + qreal highlightResizeSpeed() const; + void setHighlightResizeSpeed(qreal); + static QFxListViewAttached *qmlAttachedProperties(QObject *); public Q_SLOTS: @@ -138,6 +147,8 @@ Q_SIGNALS: void currentIndexChanged(); void currentSectionChanged(); void sectionExpressionChanged(); + void highlightMoveSpeedChanged(); + void highlightResizeSpeedChanged(); protected: virtual void viewportMoved(); diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index e802c94..f35fe3d 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -74,7 +74,7 @@ void QFxPen::setColor(const QColor &c) void QFxPen::setWidth(int w) { - if (_width == w) + if (_width == w && _valid) return; _width = w; @@ -425,41 +425,18 @@ void QFxRect::drawRect(QPainter &p) if (d->smooth) p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); - int offset = 0; const int pw = d->pen && d->pen->isValid() ? (d->pen->width()+1)/2*2 : 0; - const int realpw = d->pen && d->pen->isValid() ? d->pen->width() : 0; - if (d->radius > 0) { + if (d->radius > 0) generateRoundedRect(); - //### implicit conversion to int - offset = int(d->radius+realpw+1); - } else { + else generateBorderedRect(); - offset = realpw+1; - } - //basically same code as QFxImage uses to paint sci images - int w = width()+pw; - int h = height()+pw; - int xOffset = offset; - int xSide = xOffset * 2; - bool xMiddles=true; - if (xSide > w) { - xMiddles=false; - xOffset = w/2 + 1; - xSide = xOffset * 2; - } - int yOffset = offset; - int ySide = yOffset * 2; - bool yMiddles=true; - if (ySide > h) { - yMiddles = false; - yOffset = h/2 + 1; - ySide = yOffset * 2; - } + int xOffset = (d->rectImage.width()-1)/2; + int yOffset = (d->rectImage.height()-1)/2; + Q_ASSERT(d->rectImage.width() == 2*xOffset + 1); + Q_ASSERT(d->rectImage.height() == 2*yOffset + 1); - Q_ASSERT(d->rectImage.width() >= 2*xOffset + 1); - Q_ASSERT(d->rectImage.height() >= 2*yOffset + 1); QMargins margins(xOffset, yOffset, xOffset, yOffset); QTileRules rules(Qt::StretchTile, Qt::StretchTile); qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width()+pw, height()+pw), margins, d->rectImage, d->rectImage.rect(), margins, rules); diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index a9a5bd5..921aa6c 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -208,9 +208,12 @@ void QmlParentChange::saveOriginals() d->origParent = d->target->parentItem(); - //try to determine the items original stack position so we can restore it - if (!d->origParent) + if (!d->origParent) { d->origStackBefore = 0; + return; + } + + //try to determine the item's original stack position so we can restore it int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1; QList<QGraphicsItem*> children = d->origParent->childItems(); for (int i = 0; i < children.count(); ++i) { |