22 #include "kdeuiwidgetsproxystyle_p.h"
24 #include <QtGui/QApplication>
25 #include <QtGui/QWidget>
26 #include <QtGui/QWindowsStyle>
28 KdeUiProxyStyle::KdeUiProxyStyle(
QWidget *referenceWidget)
29 : QStyle(), m_referenceWidget(referenceWidget)
33 KdeUiProxyStyle::~KdeUiProxyStyle()
37 QStyle *KdeUiProxyStyle::style()
const
40 if (m_referenceWidget && m_referenceWidget->parentWidget()) {
41 baseStyle = m_referenceWidget->parentWidget()->style();
43 baseStyle = QApplication::style();
48 void KdeUiProxyStyle::drawComplexControl(ComplexControl control,
const QStyleOptionComplex *option,
49 QPainter *painter,
const QWidget *widget)
const
51 style()->drawComplexControl(control, option, painter, widget);
54 void KdeUiProxyStyle::drawControl(ControlElement element,
const QStyleOption *option, QPainter *painter,
57 style()->drawControl(element, option, painter, widget);
60 void KdeUiProxyStyle::drawItemPixmap(QPainter *painter,
const QRect &rectangle,
int alignment,
61 const QPixmap &pixmap)
const
63 style()->drawItemPixmap(painter, rectangle, alignment, pixmap);
66 void KdeUiProxyStyle::drawItemText(QPainter *painter,
const QRect &rectangle,
int alignment,
const QPalette &palette,
67 bool enabled,
const QString &text, QPalette::ColorRole textRole)
const
69 style()->drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
72 void KdeUiProxyStyle::drawPrimitive(PrimitiveElement element,
const QStyleOption *option, QPainter *painter,
75 style()->drawPrimitive(element, option, painter, widget);
78 QPixmap KdeUiProxyStyle::generatedIconPixmap(QIcon::Mode iconMode,
const QPixmap &pixmap,
79 const QStyleOption *option)
const
81 return style()->generatedIconPixmap(iconMode, pixmap, option);
84 QStyle::SubControl KdeUiProxyStyle::hitTestComplexControl(ComplexControl control,
const QStyleOptionComplex *option,
87 return style()->hitTestComplexControl(control, option, position, widget);
90 QRect KdeUiProxyStyle::itemPixmapRect(
const QRect &rectangle,
int alignment,
const QPixmap &pixmap)
const
92 return style()->itemPixmapRect(rectangle, alignment, pixmap);
95 QRect KdeUiProxyStyle::itemTextRect(
const QFontMetrics &metrics,
const QRect &rectangle,
int alignment,
96 bool enabled,
const QString &text)
const
98 return style()->itemTextRect(metrics, rectangle, alignment, enabled, text);
101 int KdeUiProxyStyle::pixelMetric(PixelMetric
metric,
const QStyleOption *option,
const QWidget *widget)
const
103 return style()->pixelMetric(metric, option, widget);
106 void KdeUiProxyStyle::polish(
QWidget *widget)
108 style()->polish(widget);
113 style()->polish(application);
116 void KdeUiProxyStyle::polish(QPalette &palette)
118 style()->polish(palette);
121 QSize KdeUiProxyStyle::sizeFromContents(ContentsType type,
const QStyleOption *option,
124 return style()->sizeFromContents(type, option, contentsSize, widget);
127 QIcon KdeUiProxyStyle::standardIcon(StandardPixmap standardIcon,
const QStyleOption *option,
130 return style()->standardIcon(standardIcon, option, widget);
133 QPixmap KdeUiProxyStyle::standardPixmap(StandardPixmap standardPixmap,
const QStyleOption *option,
136 return style()->standardPixmap(standardPixmap, option, widget);
141 return style()->standardPalette();
144 int KdeUiProxyStyle::styleHint(StyleHint hint,
const QStyleOption *option,
const QWidget *widget,
145 QStyleHintReturn *returnData)
const
147 return style()->styleHint(hint, option, widget, returnData);
150 QRect KdeUiProxyStyle::subControlRect(ComplexControl control,
const QStyleOptionComplex *option,
151 SubControl subControl,
const QWidget *widget)
const
153 return style()->subControlRect(control, option, subControl, widget);
156 QRect KdeUiProxyStyle::subElementRect(SubElement element,
const QStyleOption *option,
159 return style()->subElementRect(element, option, widget);
162 void KdeUiProxyStyle::unpolish(
QWidget *widget)
164 style()->unpolish(widget);
167 void KdeUiProxyStyle::unpolish(
QApplication *application)
169 style()->unpolish(application);
float metric(float dx, float dy)
static const uchar standardPalette[][4]