From a80468f33d8216ab06c23551b9f6a7b2722ddc14 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 31 Jul 2009 10:51:42 +1000 Subject: Docs --- src/declarative/util/qmlpalette.cpp | 34 +++++++++++++++++++++++++--------- src/declarative/util/qmlpalette.h | 10 +++++----- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/declarative/util/qmlpalette.cpp b/src/declarative/util/qmlpalette.cpp index 3a6dadc..25576f1 100644 --- a/src/declarative/util/qmlpalette.cpp +++ b/src/declarative/util/qmlpalette.cpp @@ -55,10 +55,24 @@ public: QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Palette,QmlPalette) /*! - \internal - \class QmlPalette + \qmlclass Palette QmlPalette \ingroup group_utility - \brief The QmlPalette class gives access to the Qt palettes. + \brief The Palette item gives access to the Qt palettes. + \sa QPalette + + + \code + Palette { id: MyPalette; colorGroup: "Active" } + + Rect { + width: 640; height: 480 + color: MyPalette.window + Text { + anchors.fill: parent + text: "Hello!"; color: MyPalette.windowText + } + } + \endcode */ QmlPalette::QmlPalette(QObject *parent) : QObject(*(new QmlPalettePrivate), parent) @@ -73,12 +87,20 @@ QmlPalette::~QmlPalette() { } +/*! + \qmlproperty Palette::window + \brief The window (general background) color of the current color group. +*/ QColor QmlPalette::window() const { Q_D(const QmlPalette); return d->palette.color(d->group, QPalette::Window); } +/*! + \qmlproperty Palette::windowText + \brief The window text (general foreground) color of the current color group. +*/ QColor QmlPalette::windowText() const { Q_D(const QmlPalette); @@ -174,12 +196,6 @@ void QmlPalette::setColorGroup(ColorGroup colorGroup) emit paletteChanged(); } -QPalette QmlPalette::palette() const -{ - Q_D(const QmlPalette); - return d->palette; -} - bool QmlPalette::eventFilter(QObject *watched, QEvent *event) { if (watched == qApp) { diff --git a/src/declarative/util/qmlpalette.h b/src/declarative/util/qmlpalette.h index 3030557..b601881 100644 --- a/src/declarative/util/qmlpalette.h +++ b/src/declarative/util/qmlpalette.h @@ -99,19 +99,19 @@ public: QColor highlight() const; QColor highlightedText() const; - QPalette palette() const; - ColorGroup colorGroup() const; void setColorGroup(ColorGroup); - bool virtual eventFilter(QObject *watched, QEvent *event); - bool virtual event(QEvent *event); - Q_INVOKABLE QColor lighter(const QColor&) const; Q_INVOKABLE QColor darker(const QColor&) const; Q_SIGNALS: void paletteChanged(); + +private: + bool eventFilter(QObject *watched, QEvent *event); + bool event(QEvent *event); + }; QT_END_NAMESPACE -- cgit v0.12