Qt 4.8
Functions
qkde.cpp File Reference
#include "qkde_p.h"
#include <QtCore/QLibrary>
#include <QtCore/QDir>
#include <QtCore/qdebug.h>
#include <QtCore/QSettings>
#include "QtGui/qstylefactory.h"
#include "qt_x11_p.h"

Go to the source code of this file.

Functions

static bool kdeColor (QPalette *pal, QPalette::ColorRole role, const QSettings &kdeSettings, const QString &kde4Key, const QString &kde3Key=QString())
 

Function Documentation

◆ kdeColor()

static bool kdeColor ( QPalette pal,
QPalette::ColorRole  role,
const QSettings kdeSettings,
const QString kde4Key,
const QString kde3Key = QString() 
)
static
Warning
This function is not part of the public interface. Reads the color from the config, and store it in the palette with the given color role if found

Definition at line 78 of file qkde.cpp.

Referenced by QKde::kdePalette().

79 {
80  QVariant variant = kdeSettings.value(kde4Key);
81  if (!variant.isValid())
82  QVariant variant = kdeSettings.value(kde3Key);
83  if (variant.isValid()) {
84  QStringList values = variant.toStringList();
85  if (values.size() == 3) {
86  int r = values[0].toInt();
87  int g = values[1].toInt();
88  int b = values[2].toInt();
89  pal->setBrush(role, QColor(r, g, b));
90  return true;
91  }
92  }
93  return false;
94 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns the value for setting key.
Definition: qsettings.cpp:3460
QStringList toStringList() const
Returns the variant as a QStringList if the variant has type() StringList, String ...
Definition: qvariant.cpp:2259
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette...
Definition: qpalette.h:206
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
quint16 values[128]
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
const char * variant
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Definition: qvariant.h:485