summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qpalette.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qpalette.cpp')
-rw-r--r--src/gui/kernel/qpalette.cpp321
1 files changed, 3 insertions, 318 deletions
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 490d442616..33b1c2a2a8 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "qpalette.h"
-#include "qapplication.h"
+#include "qguiapplication.h"
#include "qdatastream.h"
#include "qvariant.h"
@@ -63,103 +63,6 @@ static QColor qt_mix_colors(QColor a, QColor b)
(a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2);
}
-#ifdef QT3_SUPPORT
-
-#ifndef QT_NO_DATASTREAM
-QDataStream &qt_stream_out_qcolorgroup(QDataStream &s, const QColorGroup &g)
-{
- if(s.version() == 1) {
- // Qt 1.x
- s << g.color(QPalette::Foreground) << g.color(QPalette::Background)
- << g.color(QPalette::Light) << g.color(QPalette::Dark)
- << g.color(QPalette::Mid) << g.color(QPalette::Text) << g.color(QPalette::Base);
- } else {
- int max = QPalette::NColorRoles;
- if (s.version() <= QDataStream::Qt_2_1)
- max = QPalette::HighlightedText + 1;
- else if (s.version() <= QDataStream::Qt_4_3)
- max = QPalette::AlternateBase + 1;
- for(int r = 0 ; r < max ; r++)
- s << g.brush((QPalette::ColorRole)r);
- }
- return s;
-}
-
-QDataStream &qt_stream_in_qcolorgroup(QDataStream &s, QColorGroup &g)
-{
- if(s.version() == 1) { // Qt 1.x
- QColor fg, bg, light, dark, mid, text, base;
- s >> fg >> bg >> light >> dark >> mid >> text >> base;
- QPalette p(bg);
- p.setColor(QPalette::Active, QPalette::Foreground, fg);
- p.setColor(QPalette::Active, QPalette::Light, light);
- p.setColor(QPalette::Active, QPalette::Dark, dark);
- p.setColor(QPalette::Active, QPalette::Mid, mid);
- p.setColor(QPalette::Active, QPalette::Text, text);
- p.setColor(QPalette::Active, QPalette::Base, base);
- g = p;
- g.setCurrentColorGroup(QPalette::Active);
- } else {
- int max = QPalette::NColorRoles;
- if (s.version() <= QDataStream::Qt_2_1)
- max = QPalette::HighlightedText + 1;
- else if (s.version() <= QDataStream::Qt_3_0)
- max = QPalette::LinkVisited + 1;
- else if (s.version() <= QDataStream::Qt_4_3)
- max = QPalette::AlternateBase + 1;
- QBrush tmp;
- for(int r = 0 ; r < max; r++) {
- s >> tmp;
- g.setBrush((QPalette::ColorRole)r, tmp);
- }
- }
- return s;
-}
-
-QDataStream &operator<<(QDataStream &s, const QColorGroup &g)
-{
- return qt_stream_out_qcolorgroup(s, g);
-}
-
-QDataStream &operator>>(QDataStream &s, QColorGroup &g)
-{
- return qt_stream_in_qcolorgroup(s, g);
-}
-#endif // QT_NO_DATASTREAM
-
-/*!
- Constructs a palette with the specified \a active, \a disabled and
- \a inactive color groups.
-*/
-QPalette::QPalette(const QColorGroup &active, const QColorGroup &disabled,
- const QColorGroup &inactive)
-{
- Q_ASSERT(QPalette::NColorRoles == QPalette::ToolTipText + 1);
- init();
- setColorGroup(Active, active);
- setColorGroup(Disabled, disabled);
- setColorGroup(Inactive, inactive);
-}
-
-QColorGroup QPalette::createColorGroup(ColorGroup cr) const
-{
- QColorGroup ret(*this);
- ret.setCurrentColorGroup(cr);
- return ret;
-}
-
-void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g)
-{
- setColorGroup(cg, g.brush(WindowText), g.brush(Button), g.brush(Light),
- g.brush(Dark), g.brush(Mid), g.brush(Text), g.brush(BrightText),
- g.brush(Base), g.brush(AlternateBase), g.brush(Window),
- g.brush(Midlight), g.brush(ButtonText), g.brush(Shadow),
- g.brush(Highlight), g.brush(HighlightedText), g.brush(Link),
- g.brush(LinkVisited), g.brush(ToolTipBase), g.brush(ToolTipText));
-}
-
-#endif // QT3_SUPPORT
-
/*!
\fn const QColor &QPalette::color(ColorRole role) const
@@ -433,7 +336,7 @@ void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g)
roles are enumerated and defined in the \l ColorRole documentation.
We strongly recommend that you use the default palette of the
- current style (returned by QApplication::palette()) and
+ current style (returned by QGuiApplication::palette()) and
modify that as necessary. This is done by Qt's widgets when they
are drawn.
@@ -584,7 +487,7 @@ void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g)
\sa QApplication::setPalette(), QApplication::palette()
*/
QPalette::QPalette()
- : d(QApplication::palette().d),
+ : d(QGuiApplication::palette().d),
current_group(Active),
resolve_mask(0)
{
@@ -897,27 +800,6 @@ bool QPalette::operator==(const QPalette &p) const
return true;
}
-#ifdef QT3_SUPPORT
-bool QColorGroup::operator==(const QColorGroup &other) const
-{
- if (isCopyOf(other))
- return true;
- for (int role = 0; role < int(NColorRoles); role++) {
- if(d->br[current_group][role] != other.d->br[other.current_group][role])
- return false;
- }
- return true;
-}
-
-/*!
- Returns the color group as a QVariant
-*/
-QColorGroup::operator QVariant() const
-{
- return QVariant(QVariant::ColorGroup, this);
-}
-#endif
-
/*!
\fn bool QPalette::isEqual(ColorGroup cg1, ColorGroup cg2) const
@@ -1205,202 +1087,5 @@ void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBru
Use simple assignment instead.
*/
-/*!
- \fn QColorGroup QPalette::normal() const
- \obsolete
-
- Returns the active color group. Use active() instead.
-
- Use createColorGroup(Active) instead.
-*/
-
-/*!
- \fn void QPalette::setNormal(const QColorGroup &colorGroup)
-
- Sets the normal color group to \a colorGroup.
-
- \sa QColorGroup
-*/
-
-/*!
- \fn QColorGroup QPalette::active() const
-
- Returns the active color group.
- \sa QColorGroup
-*/
-
-/*!
- \fn QColorGroup QPalette::disabled() const
-
- Returns the disabled color group.
- \sa QColorGroup
-*/
-
-/*!
- \fn QColorGroup QPalette::inactive() const
-
- Returns the inactive color group.
- \sa QColorGroup
-*/
-
-/*!
- \fn void QPalette::setActive(const QColorGroup &colorGroup)
-
- Sets the active color group to \a colorGroup.
- \sa QColorGroup
-*/
-
-/*!
- \fn void QPalette::setDisabled(const QColorGroup &colorGroup)
-
- Sets the disabled color group to \a colorGroup.
- \sa QColorGroup
-*/
-
-/*!
- \fn void QPalette::setInactive(const QColorGroup &colorGroup)
-
- Sets the inactive color group.
- \sa QColorGroup
-*/
-
-/*! \class QColorGroup
- \brief The QColorGroup class contains color groups for each widget state.
- \compat
-*/
-
-/*! \fn QColorGroup::QColorGroup()
-
- Use QPalette() instead.
-*/
-
-/*! \fn QColorGroup::QColorGroup(const QBrush &foreground, const QBrush &button, \
- const QBrush &light, const QBrush &dark, const QBrush &mid, \
- const QBrush &text, const QBrush &bright_text,
- const QBrush &base, const QBrush &background)
-
- Use QPalette(\a foreground, \a button, \a light, \a dark, \a mid,
- \a text, \a bright_text, \a base, \a background) instead.
-*/
-
-/*! \fn QColorGroup::QColorGroup(const QColor &foreground, const QColor &background, \
- const QColor &light, const QColor &dark, const QColor &mid, \
- const QColor &text, const QColor &base)
-
- Use QColorGroup(\a foreground, \a background, \a light, \a dark,
- \a mid, \a text, \a base) instead.
-*/
-
-/*! \fn QColorGroup::QColorGroup(const QColorGroup &other)
-
- Use QPalette(\a other) instead.
-*/
-
-/*! \fn QColorGroup::QColorGroup(const QPalette &pal)
-
- Use QPalette(\a pal) instead.
-*/
-
-/*! \fn const QColor &QColorGroup::foreground() const
-
- Use QPalette::windowText().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::button() const
-
- Use QPalette::button().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::light() const
-
- Use QPalette::light().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::dark() const
-
- Use QPalette::dark().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::mid() const
-
- Use QPalette::mid().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::text() const
-
- Use QPalette::text().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::base() const
-
- Use QPalette::base().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::background() const
-
- Use QPalette::window().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::midlight() const
-
- Use QPalette::midlight().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::brightText() const
-
- Use QPalette::brightText().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::buttonText() const
-
- Use QPalette::buttonText().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::shadow() const
-
- Use QPalette::shadow().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::highlight() const
-
- Use QPalette::highlight().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::highlightedText() const
-
- Use QPalette::highlightedText().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::link() const
-
- Use QPalette::link().color() instead.
-*/
-
-/*! \fn const QColor &QColorGroup::linkVisited() const
-
- Use QPalette::linkVisited().color() instead.
-*/
-
-/*! \fn QDataStream &operator<<(QDataStream &ds, const QColorGroup &colorGroup)
- \relates QColorGroup
- \compat
-*/
-
-/*! \fn QDataStream &operator>>(QDataStream &ds, QColorGroup &colorGroup)
- \relates QColorGroup
- \compat
-*/
-
-/*! \fn bool QColorGroup::operator==(const QColorGroup &other) const
-
- Returns true if this color group is equal to \a other; otherwise
- returns false.
-*/
-
-/*! \fn bool QColorGroup::operator!=(const QColorGroup &other) const
-
- Returns true if this color group is not equal to \a other;
- otherwise returns false.
-*/
QT_END_NAMESPACE