|
|
|
@ -23,16 +23,55 @@ |
|
|
|
#include <QToolBar> |
|
|
|
#include <QToolBar> |
|
|
|
#include <KSharedConfig> |
|
|
|
#include <KSharedConfig> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const QStyle::StyleHint SH_KCustomStyleElement = (QStyle::StyleHint)0xff000001; |
|
|
|
|
|
|
|
static const int X_KdeBase = 0xff000000; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//_____________________________________________________________________
|
|
|
|
KStyleKDE4Compat::KStyleKDE4Compat() |
|
|
|
KStyleKDE4Compat::KStyleKDE4Compat() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
controlCounter = subElementCounter = X_KdeBase; |
|
|
|
|
|
|
|
hintCounter = X_KdeBase + 1; //sic! X_KdeBase is covered by SH_KCustomStyleElement
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//_____________________________________________________________________
|
|
|
|
KStyleKDE4Compat::~KStyleKDE4Compat() |
|
|
|
KStyleKDE4Compat::~KStyleKDE4Compat() |
|
|
|
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//_____________________________________________________________________
|
|
|
|
|
|
|
|
static inline int newStyleElement(const QString &element, const char *check, int &counter, QHash<QString, int> *elements) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (!element.contains(check)) { |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int id = elements->value(element, 0); |
|
|
|
|
|
|
|
if (!id) { |
|
|
|
|
|
|
|
++counter; |
|
|
|
|
|
|
|
id = counter; |
|
|
|
|
|
|
|
elements->insert(element, id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//_____________________________________________________________________
|
|
|
|
|
|
|
|
QStyle::StyleHint KStyleKDE4Compat::newStyleHint(const QString &element) |
|
|
|
|
|
|
|
{ return (StyleHint)newStyleElement(element, "SH_", hintCounter, &styleElements); } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//_____________________________________________________________________
|
|
|
|
|
|
|
|
QStyle::ControlElement KStyleKDE4Compat::newControlElement(const QString &element) |
|
|
|
|
|
|
|
{ return (ControlElement)newStyleElement(element, "CE_", controlCounter, &styleElements); } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//_____________________________________________________________________
|
|
|
|
|
|
|
|
QStyle::SubElement KStyleKDE4Compat::newSubElement(const QString &element) |
|
|
|
|
|
|
|
{ return (SubElement)newStyleElement(element, "SE_", subElementCounter, &styleElements); } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//_____________________________________________________________________
|
|
|
|
int KStyleKDE4Compat::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const |
|
|
|
int KStyleKDE4Compat::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( hint == SH_KCustomStyleElement && widget ) |
|
|
|
|
|
|
|
{ return styleElements.value(widget->objectName(), 0); } |
|
|
|
|
|
|
|
|
|
|
|
switch (hint) { |
|
|
|
switch (hint) { |
|
|
|
case SH_ItemView_ActivateItemOnSingleClick: { |
|
|
|
case SH_ItemView_ActivateItemOnSingleClick: { |
|
|
|
KConfigGroup g(KSharedConfig::openConfig(), "KDE"); |
|
|
|
KConfigGroup g(KSharedConfig::openConfig(), "KDE"); |
|
|
|
@ -81,4 +120,4 @@ int KStyleKDE4Compat::styleHint(StyleHint hint, const QStyleOption *option, cons |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return QCommonStyle::styleHint(hint, option, widget, returnData); |
|
|
|
return QCommonStyle::styleHint(hint, option, widget, returnData); |
|
|
|
} |
|
|
|
} |
|
|
|
|