Widget Style Reference
This reference describes how Qt's widgets use the style. Use it when you implement a style, to see which elements you need to draw and which information the widgets pass to you, or when you write a style-aware widget or a delegate, to draw the same elements that Qt's widgets draw.
The reference is split into three pages:
- Styling Buttons and Input Widgets: push buttons, checkboxes and radio buttons, tool buttons, combo boxes, spin boxes, sliders, scroll bars, and progress bars.
- Styling Containers and Windows: tab widgets, group boxes, splitters, toolboxes, toolbars, dock widgets, title bars, size grips, and rubber bands.
- Styling Menus and Item Views: menus, menu bars, item view headers, tree branch indicators, and item view items.
What the reference lists for each widget
- The element tree. The style elements that the widget draws, in drawing order. A nested element is drawn by the element above it in QCommonStyle. Next to each element, the reference names the sub element rectangles, subcontrols, and pixel metrics that QCommonStyle uses when it draws that element. Your own style can structure its drawing differently; only the elements the widget calls are fixed.
- A screenshot. The widget in the Fusion style, with the bounding rectangles of the elements outlined. The colors only tell the rectangles apart. Rectangles that coincide are drawn one pixel inside each other.
- The state flags. The QStyle::StateFlag values that the widget sets on its style option, in addition to the common flags that QStyleOption::initFrom() sets.
- The style option members. The members of the widget's QStyleOption subclass and what the widget stores in them.
The common state flags and members are described in How a Style Draws a Widget.
What the reference leaves out
The widgets also use the style for calculations that aren't part of drawing. They ask for their size hints with sizeFromContents(), for their frame widths and margins with pixelMetric(), and for the position of their subelements with subElementRect(). The reference names the contents types and the pixel metrics that each widget queries but doesn't describe how the built-in styles calculate them. How a style performs those calculations is up to the style. Qt doesn't impose a structure. When in doubt, read the QCommonStyle implementation.
See also Styles and Style Aware Widgets, How a Style Draws a Widget, QStyle, and QStyleOption.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.