diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-05 07:04:35 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-05 07:04:35 (GMT) |
commit | 70ffa3d571c5085d2702cdd0b43f85ddb2c0b8eb (patch) | |
tree | 67a0a904ef63a6f5e60881859c891ed71ca0644c /src | |
parent | 8b40fac7e97a629ddaf1c0f6de2ebb504f004060 (diff) | |
parent | 26cae0653332caf0b4e315fd35fd59469c66bac9 (diff) | |
download | Qt-70ffa3d571c5085d2702cdd0b43f85ddb2c0b8eb.zip Qt-70ffa3d571c5085d2702cdd0b43f85ddb2c0b8eb.tar.gz Qt-70ffa3d571c5085d2702cdd0b43f85ddb2c0b8eb.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts:
tests/auto/declarative/valuetypes/testtypes.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsgridview.cpp | 46 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicslistview.cpp | 7 | ||||
-rw-r--r-- | src/declarative/util/qmlsystempalette.cpp | 26 | ||||
-rw-r--r-- | src/declarative/util/qmlsystempalette_p.h | 13 |
4 files changed, 40 insertions, 52 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp index 9f9b336..7427266 100644 --- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp @@ -578,29 +578,35 @@ void QmlGraphicsGridViewPrivate::createHighlight() highlightYAnimator = 0; } - if (!highlightComponent) - return; - if (currentItem) { - QmlContext *highlightContext = new QmlContext(qmlContext(q)); - QObject *nobj = highlightComponent->create(highlightContext); - if (nobj) { - highlightContext->setParent(nobj); - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(nobj); - if (item) { - item->setParent(q->viewport()); - highlight = new FxGridItem(item, q); - highlightXAnimator = new QmlEaseFollow(q); - highlightXAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("x"))); - highlightXAnimator->setDuration(150); - highlightXAnimator->setEnabled(autoHighlight); - highlightYAnimator = new QmlEaseFollow(q); - highlightYAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("y"))); - highlightYAnimator->setDuration(150); - highlightYAnimator->setEnabled(autoHighlight); + QmlGraphicsItem *item = 0; + if (highlightComponent) { + QmlContext *highlightContext = new QmlContext(qmlContext(q)); + QObject *nobj = highlightComponent->create(highlightContext); + if (nobj) { + highlightContext->setParent(nobj); + item = qobject_cast<QmlGraphicsItem *>(nobj); + if (!item) + delete nobj; } else { delete highlightContext; } + } else { + item = new QmlGraphicsItem; + item->setParent(q->viewport()); + } + if (item) { + item->setZValue(0); + item->setParent(q->viewport()); + highlight = new FxGridItem(item, q); + highlightXAnimator = new QmlEaseFollow(q); + highlightXAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("x"))); + highlightXAnimator->setDuration(150); + highlightXAnimator->setEnabled(autoHighlight); + highlightYAnimator = new QmlEaseFollow(q); + highlightYAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("y"))); + highlightYAnimator->setDuration(150); + highlightYAnimator->setEnabled(autoHighlight); } } } @@ -1500,6 +1506,8 @@ void QmlGraphicsGridView::itemsMoved(int from, int to, int count) if (item->index > from && item->index != -1) { // move everything after the moved items. item->index -= count; + if (item->index < d->visibleIndex) + d->visibleIndex = item->index; } ++it; } diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index fc1ec4a..f9d4190 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -662,19 +662,16 @@ void QmlGraphicsListViewPrivate::createHighlight() if (nobj) { highlightContext->setParent(nobj); item = qobject_cast<QmlGraphicsItem *>(nobj); - if (!item) { + if (!item) delete nobj; - } else { - item->setParent(q->viewport()); - } } else { delete highlightContext; } } else { item = new QmlGraphicsItem; - item->setParent(q->viewport()); } if (item) { + item->setParent(q->viewport()); item->setZValue(0); highlight = new FxListItem(item, q); if (orient == QmlGraphicsListView::Vertical) diff --git a/src/declarative/util/qmlsystempalette.cpp b/src/declarative/util/qmlsystempalette.cpp index bb3ec70..4ddc82d 100644 --- a/src/declarative/util/qmlsystempalette.cpp +++ b/src/declarative/util/qmlsystempalette.cpp @@ -256,39 +256,23 @@ QColor QmlSystemPalette::highlightedText() const } /*! - \qmlproperty color SystemPalette::lighter -*/ -QColor QmlSystemPalette::lighter(const QColor& color) const -{ - return color.lighter(); -} - -/*! - \qmlproperty color SystemPalette::darker -*/ -QColor QmlSystemPalette::darker(const QColor& color) const -{ - return color.darker(); -} - -/*! - \qmlproperty QPalette::ColorGroup SystemPalette::colorGroup + \qmlproperty QmlSystemPalette::ColorGroup SystemPalette::colorGroup The color group of the palette. It can be Active, Inactive or Disabled. Active is the default. \sa QPalette::ColorGroup */ -QPalette::ColorGroup QmlSystemPalette::colorGroup() const +QmlSystemPalette::ColorGroup QmlSystemPalette::colorGroup() const { Q_D(const QmlSystemPalette); - return d->group; + return (QmlSystemPalette::ColorGroup)d->group; } -void QmlSystemPalette::setColorGroup(QPalette::ColorGroup colorGroup) +void QmlSystemPalette::setColorGroup(QmlSystemPalette::ColorGroup colorGroup) { Q_D(QmlSystemPalette); - d->group = colorGroup; + d->group = (QPalette::ColorGroup)colorGroup; emit paletteChanged(); } diff --git a/src/declarative/util/qmlsystempalette_p.h b/src/declarative/util/qmlsystempalette_p.h index e87534e..6abbfe0 100644 --- a/src/declarative/util/qmlsystempalette_p.h +++ b/src/declarative/util/qmlsystempalette_p.h @@ -56,9 +56,10 @@ class QmlSystemPalettePrivate; class Q_DECLARATIVE_EXPORT QmlSystemPalette : public QObject { Q_OBJECT + Q_ENUMS(ColorGroup) Q_DECLARE_PRIVATE(QmlSystemPalette) - Q_PROPERTY(QPalette::ColorGroup colorGroup READ colorGroup WRITE setColorGroup NOTIFY paletteChanged) + Q_PROPERTY(QmlSystemPalette::ColorGroup colorGroup READ colorGroup WRITE setColorGroup NOTIFY paletteChanged) Q_PROPERTY(QColor window READ window NOTIFY paletteChanged) Q_PROPERTY(QColor windowText READ windowText NOTIFY paletteChanged) Q_PROPERTY(QColor base READ base NOTIFY paletteChanged) @@ -78,6 +79,8 @@ public: QmlSystemPalette(QObject *parent=0); ~QmlSystemPalette(); + enum ColorGroup { Active = QPalette::Active, Inactive = QPalette::Inactive, Disabled = QPalette::Disabled }; + QColor window() const; QColor windowText() const; @@ -97,12 +100,8 @@ public: QColor highlight() const; QColor highlightedText() const; - QPalette::ColorGroup colorGroup() const; - void setColorGroup(QPalette::ColorGroup); - - // FIXME: Move to utility class? - Q_INVOKABLE QColor lighter(const QColor&) const; - Q_INVOKABLE QColor darker(const QColor&) const; + QmlSystemPalette::ColorGroup colorGroup() const; + void setColorGroup(QmlSystemPalette::ColorGroup); Q_SIGNALS: void paletteChanged(); |