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.cpp45
1 files changed, 40 insertions, 5 deletions
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index f284c20af5..52b0372ea8 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -643,11 +643,22 @@ QPalette::QPalette(const QPalette &p)
}
/*!
+ \fn QPalette::QPalette(QPalette &&other)
+ \since 5.4
+
+ Move-constructs a QPalette instance, making it point at the same
+ object that \a other was pointing to.
+
+ After being moved from, you can only assign to or destroy \a other.
+ Any other operation will result in undefined behavior.
+*/
+
+/*!
Destroys the palette.
*/
QPalette::~QPalette()
{
- if(!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
}
@@ -668,7 +679,7 @@ QPalette &QPalette::operator=(const QPalette &p)
{
p.d->ref.ref();
data = p.data;
- if(!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
d = p.d;
return *this;
@@ -1141,9 +1152,33 @@ Q_GUI_EXPORT QPalette qt_fusionPalette()
}
#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, const QPalette &)
+QDebug operator<<(QDebug dbg, const QPalette &p)
{
- dbg.nospace() << "QPalette()";
+ const char *colorGroupNames[] = {"Active", "Disabled", "Inactive"};
+ const char *colorRoleNames[] =
+ {"WindowText", "Button", "Light", "Midlight", "Dark", "Mid", "Text",
+ "BrightText", "ButtonText", "Base", "Window", "Shadow", "Highlight",
+ "HighlightedText", "Link", "LinkVisited", "AlternateBase", "NoRole",
+ "ToolTipBase","ToolTipText" };
+ QDebug nospace = dbg.nospace();
+ const uint mask = p.resolve();
+ nospace << "QPalette(resolve=" << hex << showbase << mask << ',';
+ for (int role = 0; role < (int)QPalette::NColorRoles; ++role) {
+ if (mask & (1<<role)) {
+ if (role)
+ nospace << ',';
+ nospace << colorRoleNames[role] << ":[";
+ for (int group = 0; group < (int)QPalette::NColorGroups; ++group) {
+ if (group)
+ nospace << ',';
+ const QRgb color = p.color(static_cast<QPalette::ColorGroup>(group),
+ static_cast<QPalette::ColorRole>(role)).rgba();
+ nospace << colorGroupNames[group] << ':' << color;
+ }
+ nospace << ']';
+ }
+ }
+ nospace << ')' << noshowbase << dec;
return dbg.space();
}
#endif