src/declarative/util/qdeclarativesystempalette.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    57 
    57 
    58 
    58 
    59 /*!
    59 /*!
    60     \qmlclass SystemPalette QDeclarativeSystemPalette
    60     \qmlclass SystemPalette QDeclarativeSystemPalette
    61     \since 4.7
    61     \since 4.7
    62     \brief The SystemPalette item gives access to the Qt palettes.
    62     \brief The SystemPalette element provides access to the Qt palettes.
       
    63 
       
    64     The SystemPalette element provides access to the Qt application
       
    65     palettes. This provides information about the standard colors used 
       
    66     for application windows, buttons and other features. These colors
       
    67     are grouped into three \e {color groups}: \c Active, \c Inactive,
       
    68     and \c Disabled.  See the QPalette documentation for details about
       
    69     color groups and the properties provided by SystemPalette.
       
    70 
       
    71     This can be used to color items in a way that provides a more
       
    72     native look and feel.
       
    73 
       
    74     The following example creates a palette from the \c Active color
       
    75     group and uses this to color the window and text items
       
    76     appropriately:
       
    77 
       
    78     \snippet doc/src/snippets/declarative/systempalette.qml 0
       
    79 
    63     \sa QPalette
    80     \sa QPalette
    64 
       
    65     Example:
       
    66     \qml
       
    67     SystemPalette { id: myPalette; colorGroup: Qt.Active }
       
    68 
       
    69     Rectangle {
       
    70         width: 640; height: 480
       
    71         color: myPalette.window
       
    72         Text {
       
    73             anchors.fill: parent
       
    74             text: "Hello!"; color: myPalette.windowText
       
    75         }
       
    76     }
       
    77     \endqml
       
    78 */
    81 */
    79 QDeclarativeSystemPalette::QDeclarativeSystemPalette(QObject *parent)
    82 QDeclarativeSystemPalette::QDeclarativeSystemPalette(QObject *parent)
    80     : QObject(*(new QDeclarativeSystemPalettePrivate), parent)
    83     : QObject(*(new QDeclarativeSystemPalettePrivate), parent)
    81 {
    84 {
    82     Q_D(QDeclarativeSystemPalette);
    85     Q_D(QDeclarativeSystemPalette);
   256     Q_D(const QDeclarativeSystemPalette);
   259     Q_D(const QDeclarativeSystemPalette);
   257     return d->palette.color(d->group, QPalette::HighlightedText);
   260     return d->palette.color(d->group, QPalette::HighlightedText);
   258 }
   261 }
   259 
   262 
   260 /*!
   263 /*!
   261     \qmlproperty QDeclarativeSystemPalette::ColorGroup SystemPalette::colorGroup
   264     \qmlproperty enumeration SystemPalette::colorGroup
   262 
   265 
   263     The color group of the palette. It can be Active, Inactive or Disabled.
   266     The color group of the palette. This can be one of:
   264     Active is the default.
   267 
       
   268     \list
       
   269     \o SystemPalette.Active (default)
       
   270     \o SystemPalette.Inactive
       
   271     \o SystemPalette.Disabled
       
   272     \endlist
   265 
   273 
   266     \sa QPalette::ColorGroup
   274     \sa QPalette::ColorGroup
   267 */
   275 */
   268 QDeclarativeSystemPalette::ColorGroup QDeclarativeSystemPalette::colorGroup() const
   276 QDeclarativeSystemPalette::ColorGroup QDeclarativeSystemPalette::colorGroup() const
   269 {
   277 {