110 PE_ItemBackground = QStyle::PE_CustomBase + 1,
114 PE_SwitchButtonGroove,
115 PE_SwitchButtonHandle,
117 PE_CustomBase = QStyle::PE_CustomBase + 0xf00000
120 enum ControlElement {
121 CE_IconButton = QStyle::CE_CustomBase + 1,
125 CE_ButtonBoxButtonBevel,
126 CE_ButtonBoxButtonLabel,
128 CE_CustomBase = QStyle::CE_CustomBase + 0xf00000
132 PM_FocusBorderWidth = QStyle::PM_CustomBase + 1,
133 PM_FocusBorderSpacing,
139 PM_IconButtonIconSize,
140 PM_TopLevelWindowRadius,
141 PM_SwitchButtonHandleWidth,
142 PM_SwithcButtonHandleHeight,
143 PM_FloatingWidgetRadius,
144 PM_FloatingWidgetShadowRadius,
145 PM_FloatingWidgetShadowMargins,
146 PM_FloatingWidgetShadowHOffset,
147 PM_FloatingWidgetShadowVOffset,
150 PM_ButtonMinimizedSize,
151 PM_ToolTipLabelWidth,
152 PM_FloatingButtonFrameMargin,
153 PM_CustomBase = QStyle::PM_CustomBase + 0xf00000
157 SE_IconButtonIcon = QStyle::SE_CustomBase + 1,
158 SE_SwitchButtonGroove,
159 SE_SwitchButtonHandle,
161 SE_ButtonBoxButtonContents,
162 SE_ButtonBoxButtonFocusRect,
163 SE_CustomBase = QStyle::SE_CustomBase + 0xf00000
167 CT_IconButton = QStyle::CT_CustomBase + 1,
171 CT_CustomBase = QStyle::CT_CustomBase + 0xf00000
175 SS_NormalState = 0x00000000,
176 SS_HoverState = 0x00000001,
177 SS_PressState = 0x00000002,
178 SS_StateCustomBase = 0x000000f0,
180 StyleState_Mask = 0x000000ff,
181 SS_CheckedFlag = 0x00000100,
182 SS_SelectedFlag = 0x00000200,
183 SS_FocusFlag = 0x00000400,
184 SS_FlagCustomBase = 0xf00000
186 Q_DECLARE_FLAGS(StateFlags, StyleState)
189 SP_ForkElement = QStyle::SP_CustomBase + 1,
199 SP_MediaVolumeLowElement,
200 SP_MediaVolumeHighElement,
201 SP_MediaVolumeMutedElement,
202 SP_MediaVolumeLeftElement,
203 SP_MediaVolumeRightElement,
211 SP_IndicatorMajuscule,
213 SP_IndicatorUnchecked,
217 SP_TitleQuitFullButton,
220 SP_Title_SS_LeftButton,
221 SP_Title_SS_RightButton,
222 SP_Title_SS_ShowMaximizeButton,
223 SP_Title_SS_ShowNormalButton,
224 SP_CustomBase = QStyle::SP_CustomBase + 0xf00000
227 static QColor adjustColor(
const QColor &base,
228 qint8 hueFloat = 0, qint8 saturationFloat = 0, qint8 lightnessFloat = 0,
229 qint8 redFloat = 0, qint8 greenFloat = 0, qint8 blueFloat = 0, qint8 alphaFloat = 0);
230 static QColor blendColor(
const QColor &substrate,
const QColor &superstratum);
231 static QPair<QIcon::Mode, QIcon::State> toIconModeState(
const QStyleOption *option);
232 static DDciIcon::Mode toDciIconMode(
const QStyleOption *option);
233#if DTK_VERSION < DTK_VERSION_CHECK(6, 0, 0, 0)
234 D_DECL_DEPRECATED_X(
"Use DToolTip::setToolTipTextFormat(Qt::TextFormat format)") static
void setTooltipTextFormat(Qt::TextFormat format);
235 D_DECL_DEPRECATED_X("Use
DToolTip::toolTipTextFormat()") static Qt::TextFormat tooltipTextFormat();
238 static void setFocusRectVisible(QWidget *widget,
bool visible);
239 static void setFrameRadius(QWidget *widget,
int radius);
240 static void setUncheckedItemIndicatorVisible(QWidget *widget,
bool visible);
241 static void setRedPointVisible(QObject *
object,
bool visible);
243 static void setShortcutUnderlineVisible(
bool visible);
244 static bool shortcutUnderlineVisible();
245 static void setMenuKeyboardSearchDisabled(
bool disabled);
246 static bool isMenuKeyboardSearchDisabled();
250 static void drawPrimitive(
const QStyle *style,
DStyle::PrimitiveElement pe,
const QStyleOption *opt, QPainter *p,
const QWidget *w =
nullptr);
251 static void drawControl(
const QStyle *style, DStyle::ControlElement ce,
const QStyleOption *opt, QPainter *p,
const QWidget *w =
nullptr);
252 static int pixelMetric(
const QStyle *style,
DStyle::PixelMetric m,
const QStyleOption *opt =
nullptr,
const QWidget *widget =
nullptr);
253 static QRect subElementRect(
const QStyle *style, DStyle::SubElement r,
const QStyleOption *opt,
const QWidget *widget =
nullptr);
254 static QSize sizeFromContents(
const QStyle *style, DStyle::ContentsType ct,
const QStyleOption *opt,
const QSize &contentsSize,
const QWidget *widget =
nullptr);
255 static QIcon standardIcon(
const QStyle *style, StandardPixmap st,
const QStyleOption *opt =
nullptr,
const QWidget *widget = 0);
257 inline void drawPrimitive(
DStyle::PrimitiveElement pe,
const QStyleOption *opt, QPainter *p,
const QWidget *w =
nullptr)
const
258 { proxy()->drawPrimitive(
static_cast<QStyle::PrimitiveElement
>(pe), opt, p, w); }
259 inline void drawControl(DStyle::ControlElement ce,
const QStyleOption *opt, QPainter *p,
const QWidget *w =
nullptr)
const
260 { proxy()->drawControl(
static_cast<QStyle::ControlElement
>(ce), opt, p, w); }
261 inline int pixelMetric(DStyle::PixelMetric m,
const QStyleOption *opt =
nullptr,
const QWidget *widget =
nullptr)
const
262 {
return proxy()->pixelMetric(
static_cast<QStyle::PixelMetric
>(m), opt, widget); }
263 inline QRect subElementRect(DStyle::SubElement r,
const QStyleOption *opt,
const QWidget *widget =
nullptr)
const
264 {
return proxy()->subElementRect(
static_cast<QStyle::SubElement
>(r), opt, widget); }
265 inline QSize sizeFromContents(DStyle::ContentsType ct,
const QStyleOption *opt,
const QSize &contentsSize,
const QWidget *widget =
nullptr)
const
266 {
return proxy()->sizeFromContents(
static_cast<QStyle::ContentsType
>(ct), opt, contentsSize, widget); }
267 inline QIcon standardIcon(DStyle::StandardPixmap st,
const QStyleOption *opt =
nullptr,
const QWidget *widget =
nullptr)
const
268 {
return proxy()->standardIcon(
static_cast<QStyle::StandardPixmap
>(st), opt, widget); }
270 void drawPrimitive(QStyle::PrimitiveElement pe,
const QStyleOption *opt, QPainter *p,
const QWidget *w =
nullptr)
const override;
271 void drawControl(QStyle::ControlElement ce,
const QStyleOption *opt, QPainter *p,
const QWidget *w =
nullptr)
const override;
272 int pixelMetric(QStyle::PixelMetric m,
const QStyleOption *opt =
nullptr,
const QWidget *widget =
nullptr)
const override;
273 int styleHint(StyleHint sh,
const QStyleOption *opt,
const QWidget *w, QStyleHintReturn *shret)
const override;
274 QRect subElementRect(QStyle::SubElement r,
const QStyleOption *opt,
const QWidget *widget =
nullptr)
const override;
275 QSize sizeFromContents(QStyle::ContentsType ct,
const QStyleOption *opt,
const QSize &contentsSize,
const QWidget *widget =
nullptr)
const override;
276 QIcon standardIcon(QStyle::StandardPixmap st,
const QStyleOption *opt =
nullptr,
const QWidget *widget =
nullptr)
const override;
278 QPalette standardPalette()
const override;
279 QPixmap generatedIconPixmap(QIcon::Mode iconMode,
const QPixmap &pixmap,
const QStyleOption *opt)
const override;
282 QBrush generatedBrush(
const QStyleOption *option,
const QBrush &base,
283 QPalette::ColorGroup cg = QPalette::Normal,
284 QPalette::ColorRole role = QPalette::NoRole)
const;
285 QBrush generatedBrush(StyleState state,
const QStyleOption *option,
const QBrush &base,
286 QPalette::ColorGroup cg = QPalette::Normal,
287 QPalette::ColorRole role = QPalette::NoRole)
const;
288 virtual QBrush generatedBrush(StateFlags flags,
const QBrush &base,
289 QPalette::ColorGroup cg = QPalette::Normal,
290 QPalette::ColorRole role = QPalette::NoRole,
291 const QStyleOption *option =
nullptr)
const;
293 QBrush generatedBrush(
const QStyleOption *option,
const QBrush &base,
294 DPalette::ColorGroup cg = DPalette::Normal,
295 DPalette::ColorType type = DPalette::ItemBackground)
const;
296 QBrush generatedBrush(StyleState state,
const QStyleOption *option,
const QBrush &base,
297 DPalette::ColorGroup cg = DPalette::Normal,
298 DPalette::ColorType type = DPalette::ItemBackground)
const;
299 virtual QBrush generatedBrush(StateFlags flags,
const QBrush &base,
300 DPalette::ColorGroup cg = DPalette::Normal,
301 DPalette::ColorType type = DPalette::ItemBackground,
302 const QStyleOption *option =
nullptr)
const;
304 using QCommonStyle::drawPrimitive;
305 using QCommonStyle::drawControl;
306 using QCommonStyle::pixelMetric;
307 using QCommonStyle::subElementRect;
308 using QCommonStyle::sizeFromContents;
309 using QCommonStyle::standardIcon;
311#if QT_CONFIG(itemviews)
312 static QSizeF viewItemTextLayout(QTextLayout &textLayout,
int lineWidth);
313 static QSize viewItemSize(
const QStyle *style,
const QStyleOptionViewItem *option,
int role);
314 static void viewItemLayout(
const QStyle *style,
const QStyleOptionViewItem *opt, QRect *pixmapRect,
315 QRect *textRect, QRect *checkRect,
bool sizehint);
316 virtual void viewItemLayout(
const QStyleOptionViewItem *opt, QRect *pixmapRect,
317 QRect *textRect, QRect *checkRect,
bool sizehint)
const;
319 static QRect viewItemDrawText(
const QStyle *style, QPainter *p,
const QStyleOptionViewItem *option,
const QRect &rect);
320 virtual QRect viewItemDrawText(QPainter *p,
const QStyleOptionViewItem *option,
const QRect &rect)
const;
327 inline DStyleHelper(
const QStyle *style = QApplication::style()) {
331 inline void setStyle(
const QStyle *style) {
333 m_dstyle = qobject_cast<const DStyle*>(style);
336 inline const QStyle *style()
const
338 inline const DStyle *dstyle()
const
341 inline QBrush generatedBrush(
const QStyleOption *option,
const QBrush &base,
342 QPalette::ColorGroup cg = QPalette::Normal,
343 QPalette::ColorRole role = QPalette::NoRole)
const
344 {
return m_dstyle ? m_dstyle->
generatedBrush(option, base, cg, role) : base; }
345 inline QBrush generatedBrush(
const QStyleOption *option,
const QBrush &base,
346 QPalette::ColorGroup cg = QPalette::Normal,
347 DPalette::ColorType type = DPalette::NoType)
const
348 {
return m_dstyle ? m_dstyle->generatedBrush(option, base, cg, type) : base; }
349 inline QColor getColor(
const QStyleOption *option, QPalette::ColorRole role)
const
350 {
return generatedBrush(option, option->palette.brush(role), option->palette.currentColorGroup(), role).color(); }
351 inline QColor getColor(
const QStyleOption *option,
const DPalette &palette, DPalette::ColorType type)
const
352 {
return generatedBrush(option, palette.brush(type), palette.currentColorGroup(), type).color(); }
354 inline QColor getColor(
const T *option, DPalette::ColorType type)
const
355 {
return getColor(option, option->dpalette, type); }
357 inline void drawPrimitive(
DStyle::PrimitiveElement pe,
const QStyleOption *opt, QPainter *p,
const QWidget *w =
nullptr)
const
358 { m_dstyle ? m_dstyle->drawPrimitive(pe, opt, p, w) : DStyle::drawPrimitive(m_style, pe, opt, p, w); }
359 inline void drawControl(DStyle::ControlElement ce,
const QStyleOption *opt, QPainter *p,
const QWidget *w =
nullptr)
const
360 { m_dstyle ? m_dstyle->drawControl(ce, opt, p, w) : DStyle::drawControl(m_style, ce, opt, p, w); }
361 inline int pixelMetric(
DStyle::PixelMetric m,
const QStyleOption *opt =
nullptr,
const QWidget *widget =
nullptr)
const
362 {
return m_dstyle ? m_dstyle->pixelMetric(m, opt, widget) : DStyle::pixelMetric(m_style, m, opt, widget); }
363 inline QRect subElementRect(DStyle::SubElement r,
const QStyleOption *opt,
const QWidget *widget =
nullptr)
const
364 {
return m_dstyle ? m_dstyle->subElementRect(r, opt, widget) : DStyle::subElementRect(m_style, r, opt, widget); }
365 inline QSize sizeFromContents(DStyle::ContentsType ct,
const QStyleOption *opt,
const QSize &contentsSize,
const QWidget *widget =
nullptr)
const
366 {
return m_dstyle ? m_dstyle->sizeFromContents(ct, opt, contentsSize, widget) : DStyle::sizeFromContents(m_style, ct, opt, contentsSize, widget); }
367 inline QIcon standardIcon(
DStyle::StandardPixmap standardIcon,
const QStyleOption *opt,
const QWidget *widget =
nullptr)
const
368 {
return m_dstyle ? m_dstyle->standardIcon(standardIcon, opt, widget) : DStyle::standardIcon(m_style, standardIcon, opt, widget); }
371 const QStyle *m_style;