File indexing completed on 2024-03-24 15:27:39
0001 /* This file is part of the KDE libraries 0002 0003 Copyright (C) 2007 Fredrik Höglund <fredrik@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Lesser General Public 0007 License (LGPL) as published by the Free Software Foundation; 0008 either version 2 of the License, or (at your option) any later 0009 version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Lesser General Public License for more details. 0015 0016 You should have received a copy of the GNU Lesser General Public License 0017 along with this library; see the file COPYING.LIB. If not, write to 0018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #include "kdeuiwidgetsproxystyle_p.h" 0023 0024 #include <QApplication> 0025 #include <QWidget> 0026 0027 KdeUiProxyStyle::KdeUiProxyStyle(QWidget *referenceWidget) 0028 : QStyle(), m_referenceWidget(referenceWidget) 0029 { 0030 } 0031 0032 KdeUiProxyStyle::~KdeUiProxyStyle() 0033 { 0034 } 0035 0036 QStyle *KdeUiProxyStyle::style() const 0037 { 0038 QStyle *baseStyle; 0039 if (m_referenceWidget && m_referenceWidget->parentWidget()) { 0040 baseStyle = m_referenceWidget->parentWidget()->style(); 0041 } else { 0042 baseStyle = QApplication::style(); 0043 } 0044 return baseStyle; 0045 } 0046 0047 void KdeUiProxyStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, 0048 QPainter *painter, const QWidget *widget) const 0049 { 0050 style()->drawComplexControl(control, option, painter, widget); 0051 } 0052 0053 void KdeUiProxyStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, 0054 const QWidget *widget) const 0055 { 0056 style()->drawControl(element, option, painter, widget); 0057 } 0058 0059 void KdeUiProxyStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, 0060 const QPixmap &pixmap) const 0061 { 0062 style()->drawItemPixmap(painter, rectangle, alignment, pixmap); 0063 } 0064 0065 void KdeUiProxyStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, 0066 bool enabled, const QString &text, QPalette::ColorRole textRole) const 0067 { 0068 style()->drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole); 0069 } 0070 0071 void KdeUiProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, 0072 const QWidget *widget) const 0073 { 0074 style()->drawPrimitive(element, option, painter, widget); 0075 } 0076 0077 QPixmap KdeUiProxyStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, 0078 const QStyleOption *option) const 0079 { 0080 return style()->generatedIconPixmap(iconMode, pixmap, option); 0081 } 0082 0083 QStyle::SubControl KdeUiProxyStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, 0084 const QPoint &position, const QWidget *widget) const 0085 { 0086 return style()->hitTestComplexControl(control, option, position, widget); 0087 } 0088 0089 QRect KdeUiProxyStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const 0090 { 0091 return style()->itemPixmapRect(rectangle, alignment, pixmap); 0092 } 0093 0094 QRect KdeUiProxyStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, 0095 bool enabled, const QString &text) const 0096 { 0097 return style()->itemTextRect(metrics, rectangle, alignment, enabled, text); 0098 } 0099 0100 int KdeUiProxyStyle::layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const 0101 { 0102 return style()->layoutSpacing(control1, control2, orientation, option, widget); 0103 } 0104 0105 int KdeUiProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const 0106 { 0107 return style()->pixelMetric(metric, option, widget); 0108 } 0109 0110 void KdeUiProxyStyle::polish(QWidget *widget) 0111 { 0112 style()->polish(widget); 0113 } 0114 0115 void KdeUiProxyStyle::polish(QApplication *application) 0116 { 0117 style()->polish(application); 0118 } 0119 0120 void KdeUiProxyStyle::polish(QPalette &palette) 0121 { 0122 style()->polish(palette); 0123 } 0124 0125 QSize KdeUiProxyStyle::sizeFromContents(ContentsType type, const QStyleOption *option, 0126 const QSize &contentsSize, const QWidget *widget) const 0127 { 0128 return style()->sizeFromContents(type, option, contentsSize, widget); 0129 } 0130 0131 QIcon KdeUiProxyStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, 0132 const QWidget *widget) const 0133 { 0134 return style()->standardIcon(standardIcon, option, widget); 0135 } 0136 0137 QPixmap KdeUiProxyStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option, 0138 const QWidget *widget) const 0139 { 0140 return style()->standardPixmap(standardPixmap, option, widget); 0141 } 0142 0143 QPalette KdeUiProxyStyle::standardPalette() const 0144 { 0145 return style()->standardPalette(); 0146 } 0147 0148 int KdeUiProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, 0149 QStyleHintReturn *returnData) const 0150 { 0151 return style()->styleHint(hint, option, widget, returnData); 0152 } 0153 0154 QRect KdeUiProxyStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, 0155 SubControl subControl, const QWidget *widget) const 0156 { 0157 return style()->subControlRect(control, option, subControl, widget); 0158 } 0159 0160 QRect KdeUiProxyStyle::subElementRect(SubElement element, const QStyleOption *option, 0161 const QWidget *widget) const 0162 { 0163 return style()->subElementRect(element, option, widget); 0164 } 0165 0166 void KdeUiProxyStyle::unpolish(QWidget *widget) 0167 { 0168 style()->unpolish(widget); 0169 } 0170 0171 void KdeUiProxyStyle::unpolish(QApplication *application) 0172 { 0173 style()->unpolish(application); 0174 } 0175 0176 #include "moc_kdeuiwidgetsproxystyle_p.cpp"