qstyle: Criando o estilo para as janelas do Kde4

Este artigo tem por objetivo expor cada detalhe de uma classe derivada de QStyle, que define no KDE a maneira como os objetos das janelas são desenhados. A classe QStyle é uma classe abstrata que encapsula a aparência de uma interface gráfica do Qt/KDE.

Um estilo do KDE4, após compilado, gera no mínimo dois arquivos:

  1. um arquivo nome_do_estilo.so, que é o plugin compilado que contém os itens do estilo. Para instruções de como compilar o código de seu tema como um plugin, leia esse artigo.

  2. um arquivo nome_do_tema.themerc, que contém as definições do tema, e possui a seguinte estrutura:
[Misc]
Name=nome_do_estilo
Comment=descrição_do_estilo

Também pode acompanhar o estilo um arquivo nome_do_estilo.colors, que contém as cores que combinam com o estilo desenhado. Um modelo de arquivo pode ser baixado aqui.
O primeiro arquivo (o plugin propriamente dito), é instalado no diretório /usr/lib64/kde4/plugins/styles, enquanto o arquivo .themerc ficará no diretório/usr/share/kde4/apps/kstyle/themes. O arquivo do esquema de crores fica em /usr/share/kde4/config/colors.

Tipos públicos

enum ComplexControl
{ CC_SpinBox, CC_ComboBox, CC_ScrollBar, CC_Slider, …,
CC_CustomBase }
enum ContentsType
{ CT_CheckBox, CT_ComboBox, CT_Q3DockWindow, CT_HeaderSection,
…, CT_MdiControls }
enum ControlElement
{ CE_PushButton, CE_PushButtonBevel, CE_PushButtonLabel,
CE_DockWidgetTitle, …, CE_ShapedFrame }
enum PixelMetric
{ PM_ButtonMargin, PM_DockWidgetTitleBarButtonMargin,
PM_ButtonDefaultIndicator, PM_MenuButtonIndicator, …,
PM_SubMenuOverlap }
enum PrimitiveElement
{ PE_FrameStatusBar, PE_PanelButtonCommand, PE_FrameDefaultButton,
PE_PanelButtonBevel, …, PE_PanelMenu }
enum RequestSoftwareInputPanel
{ RSIP_OnMouseClickAndAlreadyFocused, RSIP_OnMouseClick }
enum StandardPixmap
{ SP_TitleBarMinButton, SP_TitleBarMenuButton,
SP_TitleBarMaxButton, SP_TitleBarCloseButton, …, SP_CustomBase }
flags State
enum StateFlag
{ State_None, State_Active, State_AutoRaise, State_Children, …,
State_Small }
enum StyleHint
{ SH_EtchDisabledText, SH_DitherDisabledText, SH_GUIStyle,
SH_ScrollBar_ContextMenu, …, SH_RequestSoftwareInputPanel }
enum SubControl
{ SC_None, SC_ScrollBarAddLine, SC_ScrollBarSubLine,
SC_ScrollBarAddPage, …, SC_All }
flags SubControls
enum SubElement
{ SE_PushButtonContents, SE_PushButtonFocusRect,
SE_PushButtonLayoutItem, SE_CheckBoxIndicator, …,
SE_ToolBarHandle }

Funções públicas

QStyle ()
virtual ~QStyle
()
int combinedLayoutSpacing
( QSizePolicy::ControlTypes controls1,
QSizePolicy::ControlTypes controls2, Qt::Orientation
orientation, QStyleOption * option = 0, QWidget
* widget = 0 ) const
virtual void drawComplexControl
( ComplexControl control, const QStyleOptionComplex *
option, QPainter * painter, const QWidget *
widget = 0 ) const = 0
virtual void drawControl
( ControlElement element, const QStyleOption * option,
QPainter * painter, const QWidget * widget = 0 )
const = 0
virtual void drawItemPixmap
( QPainter * painter, const QRect & rectangle,
int alignment, const QPixmap & pixmap )
const
virtual void drawItemText
( QPainter * painter, const QRect & rectangle,
int alignment, const QPalette & palette,
bool enabled, const QString & text,
QPalette::ColorRole textRole = QPalette::NoRole ) const
virtual void drawPrimitive
( PrimitiveElement element, const QStyleOption * option,
QPainter * painter, const QWidget * widget = 0 )
const = 0
virtual QPixmap generatedIconPixmap
( QIcon::Mode iconMode, const QPixmap & pixmap,
const QStyleOption * option ) const = 0
virtual SubControl hitTestComplexControl
( ComplexControl control, const QStyleOptionComplex *
option, const QPoint & position, const
QWidget * widget = 0 ) const = 0
virtual QRect itemPixmapRect
( const QRect & rectangle, int alignment,
const QPixmap & pixmap ) const
virtual QRect itemTextRect
( const QFontMetrics & metrics, const QRect &
rectangle, int alignment, bool enabled,
const QString & text ) const
int layoutSpacing
( QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2, Qt::Orientation
orientation, const QStyleOption * option = 0,
const QWidget * widget = 0 ) const
virtual int pixelMetric
( PixelMetric metric, const QStyleOption * option
= 0, const QWidget * widget = 0 ) const = 0
virtual void polish (
QWidget * widget )
virtual void polish (
QApplication * application )
virtual void polish (
QPalette & palette )
const QStyle * proxy () const
virtual QSize sizeFromContents
( ContentsType type, const QStyleOption * option,
const QSize & contentsSize, const QWidget * widget
= 0 ) const = 0
QIcon standardIcon
( StandardPixmap standardIcon, const QStyleOption *
option = 0, const QWidget * widget = 0 ) const
virtual QPalette standardPalette
() const
virtual int styleHint
( StyleHint hint, const QStyleOption * option =
0, const QWidget * widget = 0, QStyleHintReturn *
returnData = 0 ) const = 0
virtual QRect subControlRect
( ComplexControl control, const QStyleOptionComplex *
option, SubControl subControl, const QWidget *
widget = 0 ) const = 0
virtual QRect subElementRect
( SubElement element, const QStyleOption * option,
const QWidget * widget = 0 ) const = 0
virtual void unpolish (
QWidget * widget )
virtual void unpolish
( QApplication * application )

Membros estáticos públicos

QRect alignedRect
( Qt::LayoutDirection direction, Qt::Alignment alignment,
const QSize & size, const QRect & rectangle
)
int sliderPositionFromValue
( int min, int max, int logicalValue,
int span, bool upsideDown = false )
int sliderValueFromPosition
( int min, int max, int position, int
span, bool upsideDown = false )
Qt::Alignment visualAlignment
( Qt::LayoutDirection direction, Qt::Alignment alignment
)
QPoint visualPos
( Qt::LayoutDirection direction, const QRect &
boundingRectangle, const QPoint & logicalPosition
)
QRect visualRect
( Qt::LayoutDirection direction, const QRect &
boundingRectangle, const QRect & logicalRectangle
)

Slots protegidos

int layoutSpacingImplementation
( QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2, Qt::Orientation
orientation, const QStyleOption * option = 0,
const QWidget * widget = 0 ) const
QIcon standardIconImplementation
( StandardPixmap standardIcon, const QStyleOption *
option = 0, const QWidget * widget = 0 ) const

Configurando um estilo

O estilo de uma aplicação pode ser configurado pela função QApplication::setStyle(). Pode também ser especificado pelo usuário da aplicação, usando a opção -style pela linha de comando:

 ./myapplication -style motif

Se nenhum estilo for especificado, o Qt escolherá o estilo mais apropriado para a plataforma ou ambiente desktop do usuário. Um estilo também pode ser configurado para um widget individual com a unção QWidget::setStyle().

Desenvolvendo estilos personalizados para widgets

Se você estiver desenvolvendo um widget próprio e quer que ele se encaixe bem em todas as plataformas, pode usar as funções do QStyle para executar partes do desenho do widget, como drawItemText(), drawItemPixmap(), drawPrimitive(), drawControl() e drawComplexControl(). Muitas funções de desenho do QStyle usam quatro argumentos:

  • Um valor de enum especificando qual elemento gráfico desenhar
  • um QStyleOption especificando como e onde renderizar esse elemento
  • um QPainter que deve ser usado para desenhar o elemento
  • um QWidget onde o desenho será executado (opcional)

Por exemplo, se você quer desenhar um retângulo de foco em seu widget, pode escrever:

void MyWidget::paintEvent(QPaintEvent * /* event */)
 {
     QPainter painter(this);
     QStyleOptionFocusRect option;
     option.initFrom(this);
     option.backgroundColor = palette().color(QPalette::Background);
     style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this);
 }

O QStyle obtém toda a informação de que precisa para renderizar o elemento gráfico de QStyleOption. O widget é passado como o último argumento para o caso de que o estilo precise executar efeitos especiais (como os botões animados padrão do Mac OS X), mas isso não é obrigatório.
De fato, você pode usar o QStyle para desenhar em qualquer dispositivo, não apenas widgets, apenas configurando o QPainter adequadamente. O QStyleOption possui várias sub-classes para vários tipos de elementos gráficos que podem ser desenhados. Por exemplo, PE_FrameFocusRect expera por um
argumento QStyleOptionFocusRect. Por conveniência, o Qt fornece a classe QStylePainter, que combina um QStyle, um QPainter e um QWidget. Com isso é possível escrever:

QStylePainter painter(this);
...
painter.drawPrimitive(QStyle::PE_FrameFocusRect, option);

ao invés de:

QPainter painter(this);
...
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this);

Criando um estilo personalizado

Você pode criar uma aparência personalizada para sua aplicação pela criação de um estilo personalizado. Existem duas formas de criar um estilo. Na abordagem estática, você escolhe uma classe QStyle existente, cria uma classe derivada dela, e re-implementa as funções virtuais para que fornecam o comportamento personalizado, ou cria uma classe QStyle inteira do zero. Na abordagem dinâmica, você modifica o comportamente do estilo de seu sistema em tempo de execução. Abaixo iremos ver a abordagem estática.
O primeiro passo da abordagem estática é escolher um dos estilos fornecidos pelo Qt sobre o qual você construirá seu estilo personalizado. Sua escolha de classe QStyle dependerá de qual se parece mais com o estilo que você quer criar. A classe mais geral quer você pode usar é QCommonStyle (não QStyle). Isso se deve por que o Qt requer que seus estilo sejam QCommonStyle’s. Dependendo de qual parte do estilo base você quiser mudar, precisa re-implementas as funções que são usadas para desenhar cada parte da interface. Para ilustrar isso, nós iremos modificar a aparência das setas da caixa de rotação que são desenhadas por QWindowsStyle. As setas são elementos primitivos que são desenhados pela função drawPrimitive(), então precisamos re-implementas essa função. Nós precisamos da seguinte declaração de classe:

class CustomStyle : public QWindowsStyle
 {
     Q_OBJECT
 public:
     CustomStyle()
     ~CustomStyle() {}
     void drawPrimitive(PrimitiveElement element, const QStyleOption *option,QPainter *painter, const QWidget *widget) const;
 };

Para desenhar as setas, o QSpinBox usa os elementos PE_IndicatorSpinUp e PE_IndicatorSpinDown. Aqui está a re-implementação da função drawPrimitive() para fazer o desenho diferentemente:

void CustomStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,QPainter *painter, const QWidget *widget) const
 {
     if (element == PE_IndicatorSpinUp || element == PE_IndicatorSpinDown) {
         QPolygon points(3);
         int x = option->rect.x();
         int y = option->rect.y();
         int w = option->rect.width() / 2;
         int h = option->rect.height() / 2;
         x += (option->rect.width() - w) / 2;
         y += (option->rect.height() - h) / 2;
         if (element == PE_IndicatorSpinUp) {
             points[0] = QPoint(x, y + h);
             points[1] = QPoint(x + w, y + h);
             points[2] = QPoint(x + w / 2, y);
         } else { // PE_SpinBoxDown
             points[0] = QPoint(x, y);
             points[1] = QPoint(x + w, y);
             points[2] = QPoint(x + w / 2, y + h);
         }
         if (option->state & State_Enabled) {
             painter->setPen(option->palette.mid().color());
             painter->setBrush(option->palette.buttonText());
         } else {
             painter->setPen(option->palette.buttonText().color());
             painter->setBrush(option->palette.mid());
         }
         painter->drawPolygon(points);
     } else {
         QWindowsStyle::drawPrimitive(element, option, painter, widget);
     }
 }

Observe que não usamos o argumento widget, exceto para passa-lo para a função QWindowsStyle::drawPrimitive().
Como mencionado antes, a informação sobre o que será desenhado e como será desenhado deve ser especificado por um objeto QStyleOption, assim não existe necessidade de chamar o widget. Se você precisa usar o argumento widget para obter informações adicionais, tenha cuidado de garantir que não seja nulo e que seja o tipo correto antes de usa-lo. Por exemplo:

QSpinBox *spinBox = qobject_cast<QSpinBox *>(widget);
if (spinBox) {
...
}

Quando estiver implementando um estilo personalizado, você não pode assumir que o widget seja um QSpinBox só porque o valor de enum é chamado PE_IndicatorSpinUp ou PE_IndicatorSpinDown.

Desktops da Direita para a Esquerda

Linguagens que são escritas da direita para a esquerda (como Arabe e Hebraico) usualmente também espelham todo o layout dos widgets, e precisam que a iluminação venha do topo direito ao invés do topo esquerdo. Se você criar um estilo personalizado, deveria tomar cuidados especiais ao desenhar elementos asimétricos para certificar que eles sejam corretamente desenhados num layout espelhado. Uma maneira fácil de testar seus estilo é executar as aplicações com o comando -reverse na linha de comando ou chamar a função QApplication::setLayoutDirection() em seu main(). Aqui estão algumas coisas que devem ser mantidas em mente quando estiver criando um estilo para que ele funcione bem em um ambiente de desktop invertido:

  • subControlRect() e subElementRect() retornam retângulos em coordenadas da tela

  • QStyleOption::direction indica em qual direção o item deve ser desenhado

  • Se um estilo não estiver adaptado para o formato direita para a esquerda mostrará itens como se eles estivessem da esquerda para a direita

  • visualRect(), visualPos(), e visualAlignment() são funções úteis que traduzirão da lógica para representações da tela

  • alignedRect() retorna um retângulo lógico para a direção atual

Estilos em visões de itens

A pintura de itens em visões é executada por uma delegação. A delegação padrão do Qt, QStyledItemDelegate, é também usada para calcular os limites de retângulos de itens, e seus sub-elementos para vários tipos de regras de dados que oQStyleItemDelegate suporta. Veja a descrição da classe para encontrar  os tipos e regras de dados são suportadas. Você pode ler mais sobre regras de dados de itens em Model/View Programming.
Quando QStyledItemDelegate pinta os seus itens, ele desenha CE_ItemViewItem, e calcula seus tamanhos com CT_ItemViewItem. Note também que ele usa SE_ItemViewItemText para ajustar o tamanho dos editores. Quando implementando um estilo para personalizar o desenho de visões de itens, você precisa checar se a implementação de QCommonStyle (e qualquer outra subclasse que seu estilo é derivado). Dessa forma, você saberá quais e como outros elementos do estilo são pintados, e você pode re-implementar a pintura de elementos que devem ser desenhados de forma diferentes.
Abaixo segue um pequeno exemplo onde personalizamos o desenho do fundo de um item.

switch (element) {
         case (PE_PanelItemViewItem): {
             painter->save();
             QPoint topLeft = option->rect.topLeft();
             QPoint bottomRight = option->rect.topRight();
             QLinearGradient backgroundGradient(topLeft, bottomRight);
             backgroundGradient.setColorAt(0.0, QColor(Qt::yellow).lighter(190));
             backgroundGradient.setColorAt(1.0, Qt::white);
             painter->fillRect(option->rect, QBrush(backgroundGradient));
             painter->restore();
         break;
         }
         default:
             QWindowsStyle::drawPrimitive(element, option, painter, widget);
     }

O elementos primitivo PE_PanelItemViewItem é responsável por pintar o fundo de itens, e é chamado pela implementação do QCommonStyle de CE_ItemViewItem.
Para adicionar o suporte para desenho de novos tipos e regras de dados, é necessário criar uma delegação personalizada. Mas de você apenas precisa suportar os tipos implementados pela delegação padrão, um estilo personalizado não precisa de uma delegação. A descrição da classe QStyleItemDelegate fornece mais informações sobre as delegações personalizadas.
O desenho dos cabeçalhos das visões de itens é feita também pelo estilo, fornecendo controle sobre o tamanho do cabeçalho e tamanhos das linhas e colunas.

Documentação das funções membros

enum QStyle::ComplexControl

Esse enum descreve os controles complexos disponíveis. Controles complexos tem comportamentos diferentes dependendo de onde o usuário clica neles ou qual tecla é pressionada.

Constant Value Description
QStyle::CC_SpinBox 0 A spinbox, like QSpinBox.
QStyle::CC_ComboBox 1 A combobox, like QComboBox.
QStyle::CC_ScrollBar 2 A scroll bar, like QScrollBar.
QStyle::CC_Slider 3 A slider, like QSlider.
QStyle::CC_ToolButton 4 A tool button, like QToolButton.
QStyle::CC_TitleBar 5 A Title bar, like those used in QMdiSubWindow.
QStyle::CC_Q3ListView 6 Used for drawing the Q3ListView class.
QStyle::CC_GroupBox 8 A group box, like QGroupBox.
QStyle::CC_Dial 7 A dial, like QDial.
QStyle::CC_MdiControls 9 The minimize, close, and normal button in the menu bar for a maximized MDI subwindow.
QStyle::CC_CustomBase 0xf0000000 Base value for custom complex controls. Custom values must be greater than this value.

enum QStyle::ContentsType

Esse enum descreve os tipos de conteúdo disponíveis. Esses tipos são usados para calcular os tamanhos dos conteúdos de vários widgets.

Constant Value Description
QStyle::CT_CheckBox 1 A check box, like QCheckBox.
QStyle::CT_ComboBox 4 A combo box, like QComboBox.
QStyle::CT_Q3DockWindow 6 Q3DockWindow.
QStyle::CT_HeaderSection 21 A header section, like QHeader.
QStyle::CT_LineEdit 16 A line edit, like QLineEdit.
QStyle::CT_Menu 11 A menu, like QMenu.
QStyle::CT_Q3Header 15 A Qt 3 header section, like Q3Header.
QStyle::CT_MenuBar 10 A menu bar, like QMenuBar.
QStyle::CT_MenuBarItem 9 A menu bar item, like the buttons in a QMenuBar.
QStyle::CT_MenuItem 8 A menu item, like QMenuItem.
QStyle::CT_ProgressBar 7 A progress bar, like QProgressBar.
QStyle::CT_PushButton 0 A push button, like QPushButton.
QStyle::CT_RadioButton 2 A radio button, like QRadioButton.
QStyle::CT_SizeGrip 18 A size grip, like QSizeGrip.
QStyle::CT_Slider 13 A slider, like QSlider.
QStyle::CT_ScrollBar 14 A scroll bar, like QScrollBar.
QStyle::CT_SpinBox 17 A spin box, like QSpinBox.
QStyle::CT_Splitter 5 A splitter, like QSplitter.
QStyle::CT_TabBarTab 12 A tab on a tab bar, like QTabBar.
QStyle::CT_TabWidget 19 A tab widget, like QTabWidget.
QStyle::CT_ToolButton 3 A tool button, like QToolButton.
QStyle::CT_GroupBox 22 A group box, like QGroupBox.
QStyle::CT_ItemViewItem 24 An item inside an item view.
QStyle::CT_CustomBase 0xf0000000 Base value for custom contents types. Custom values must be greater than this value.
QStyle::CT_MdiControls 23 The minimize, normal, and close button in the menu bar for a maximized MDI subwindow.

enum QStyle::ControlElement

Esse enum representa um elemento de controle. Um elemento de controle é uma parte de um widget que executa alguma ação e exibe informação para o usuário.

Constant Value Description
QStyle::CE_PushButton 0 QPushButton, draws CE_PushButtonBevel, CE_PushButtonLabel and PE_FrameFocusRect.
QStyle::CE_PushButtonBevel 1 The bevel and default indicator of a QPushButton.
QStyle::CE_PushButtonLabel 2 The label (an icon with text or pixmap) of a QPushButton.
QStyle::CE_DockWidgetTitle 31 Dock window title.
QStyle::CE_Splitter 29 Splitter handle; see also QSplitter.
QStyle::CE_CheckBox 3 QCheckBox, draws a PE_IndicatorCheckBox, a CE_CheckBoxLabel and a PE_FrameFocusRect.
QStyle::CE_CheckBoxLabel 4 The label (text or pixmap) of a QCheckBox.
QStyle::CE_RadioButton 5 QRadioButton, draws a PE_IndicatorRadioButton, a CE_RadioButtonLabel and a PE_FrameFocusRect.
QStyle::CE_RadioButtonLabel 6 The label (text or pixmap) of a QRadioButton.
QStyle::CE_TabBarTab 7 The tab and label within a QTabBar.
QStyle::CE_TabBarTabShape 8 The tab shape within a tab bar.
QStyle::CE_TabBarTabLabel 9 The label within a tab.
QStyle::CE_ProgressBar 10 QProgressBar, draws CE_ProgressBarGroove, CE_ProgressBarContents and CE_ProgressBarLabel.
QStyle::CE_ProgressBarGroove 11 The groove where the progress indicator is drawn in a QProgressBar.
QStyle::CE_ProgressBarContents 12 The progress indicator of a QProgressBar.
QStyle::CE_ProgressBarLabel 13 The text label of a QProgressBar.
QStyle::CE_ToolButtonLabel 22 A tool button’s label.
QStyle::CE_MenuBarItem 20 A menu item in a QMenuBar.
QStyle::CE_MenuBarEmptyArea 21 The empty area of a QMenuBar.
QStyle::CE_MenuItem 14 A menu item in a QMenu.
QStyle::CE_MenuScroller 15 Scrolling areas in a QMenu when the style supports scrolling.
QStyle::CE_MenuTearoff 18 A menu item representing the tear off section of a QMenu.
QStyle::CE_MenuEmptyArea 19 The area in a menu without menu items.
QStyle::CE_MenuHMargin 17 The horizontal extra space on the left/right of a menu.
QStyle::CE_MenuVMargin 16 The vertical extra space on the top/bottom of a menu.
QStyle::CE_Q3DockWindowEmptyArea 26 The empty area of a QDockWidget.
QStyle::CE_ToolBoxTab 27 The toolbox’s tab and label within a QToolBox.
QStyle::CE_SizeGrip 28 Window resize handle; see also QSizeGrip.
QStyle::CE_Header 23 A header.
QStyle::CE_HeaderSection 24 A header section.
QStyle::CE_HeaderLabel 25 The header’s label.
QStyle::CE_ScrollBarAddLine 32 Scroll bar line increase indicator. (i.e., scroll down); see also QScrollBar.
QStyle::CE_ScrollBarSubLine 33 Scroll bar line decrease indicator (i.e., scroll up).
QStyle::CE_ScrollBarAddPage 34 Scolllbar page increase indicator (i.e., page down).
QStyle::CE_ScrollBarSubPage 35 Scroll bar page decrease indicator (i.e., page up).
QStyle::CE_ScrollBarSlider 36 Scroll bar slider.
QStyle::CE_ScrollBarFirst 37 Scroll bar first line indicator (i.e., home).
QStyle::CE_ScrollBarLast 38 Scroll bar last line indicator (i.e., end).
QStyle::CE_RubberBand 30 Rubber band used in for example an icon view.
QStyle::CE_FocusFrame 39 Focus frame that is style controlled.
QStyle::CE_ItemViewItem 46 An item inside an item view.
QStyle::CE_CustomBase 0xf0000000 Base value for custom control elements; custom values must be greater than this value.
QStyle::CE_ComboBoxLabel 40 The label of a non-editable QComboBox.
QStyle::CE_ToolBar 41 A toolbar like QToolBar.
QStyle::CE_ToolBoxTabShape 42 The toolbox’s tab shape.
QStyle::CE_ToolBoxTabLabel 43 The toolbox’s tab label.
QStyle::CE_HeaderEmptyArea 44 The area of a header view where there are no header sections.
QStyle::CE_ShapedFrame 47 The frame with the shape specified in the QStyleOptionFrameV3; see QFrame.

enum QStyle::PixelMetric

Esse enum descreve as várias métricas de pixels disponíveis. Uma métrica de pixel é um estilo que depende do tamanho representado pelo valor de um pixel único.

Constant Value Description
QStyle::PM_ButtonMargin 0 Amount of whitespace between push button labels and the frame.
QStyle::PM_DockWidgetTitleBarButtonMargin ? Amount of whitespace between dock widget’s title bar button labels and the frame.
QStyle::PM_ButtonDefaultIndicator 1 Width of the default-button indicator frame.
QStyle::PM_MenuButtonIndicator 2 Width of the menu button indicator proportional to the widget height.
QStyle::PM_ButtonShiftHorizontal 3 Horizontal contents shift of a button when the button is down.
QStyle::PM_ButtonShiftVertical 4 Vertical contents shift of a button when the button is down.
QStyle::PM_DefaultFrameWidth 5 Default frame width (usually 2).
QStyle::PM_SpinBoxFrameWidth 6 Frame width of a spin box, defaults to PM_DefaultFrameWidth.
QStyle::PM_ComboBoxFrameWidth 7 Frame width of a combo box, defaults to PM_DefaultFrameWidth.
 
QStyle::PM_MdiSubWindowFrameWidth 46 Frame width of an MDI window.
 
QStyle::PM_MdiSubWindowMinimizedWidth ? Width of a minimized MDI window.
QStyle::PM_LayoutLeftMargin ? Default left margin for a QLayout.
QStyle::PM_LayoutTopMargin ? Default top margin for a QLayout.
QStyle::PM_LayoutRightMargin ? Default right margin for a QLayout.
QStyle::PM_LayoutBottomMargin ? Default bottom margin for a QLayout.
QStyle::PM_LayoutHorizontalSpacing ? Default horizontal spacing for a QLayout.
QStyle::PM_LayoutVerticalSpacing ? Default vertical spacing for a QLayout.
QStyle::PM_MaximumDragDistance 8 The maximum allowed distance between the mouse and a scrollbar when dragging. Exceeding the specified distance will cause the slider to jump back to the original position; a value of -1 disables this behavior.
QStyle::PM_ScrollBarExtent 9 Width of a vertical scroll bar and the height of a horizontal scroll bar.
QStyle::PM_ScrollBarSliderMin 10 The minimum height of a vertical scroll bar’s slider and the minimum width of a horizontal scroll bar’s slider.
QStyle::PM_SliderThickness 11 Total slider thickness.
QStyle::PM_SliderControlThickness 12 Thickness of the slider handle.
QStyle::PM_SliderLength 13 Length of the slider.
QStyle::PM_SliderTickmarkOffset 14 The offset between the tickmarks and the slider.
QStyle::PM_SliderSpaceAvailable 15 The available space for the slider to move.
QStyle::PM_DockWidgetSeparatorExtent 16 Width of a separator in a horizontal dock window and the height of a separator in a vertical dock window.
QStyle::PM_DockWidgetHandleExtent 17 Width of the handle in a horizontal dock window and the height of the handle in a vertical dock window.
QStyle::PM_DockWidgetFrameWidth 18 Frame width of a dock window.
QStyle::PM_DockWidgetTitleMargin ? Margin of the dock window title.
QStyle::PM_MenuBarPanelWidth 33 Frame width of a menu bar, defaults to PM_DefaultFrameWidth.
QStyle::PM_MenuBarItemSpacing 34 Spacing between menu bar items.
QStyle::PM_MenuBarHMargin 36 Spacing between menu bar items and left/right of bar.
QStyle::PM_MenuBarVMargin 35 Spacing between menu bar items and top/bottom of bar.
QStyle::PM_ToolBarFrameWidth ? Width of the frame around toolbars.
QStyle::PM_ToolBarHandleExtent ? Width of a toolbar handle in a horizontal toolbar and the height of the handle in a vertical toolbar.
QStyle::PM_ToolBarItemMargin ? Spacing between the toolbar frame and the items.
QStyle::PM_ToolBarItemSpacing ? Spacing between toolbar items.
QStyle::PM_ToolBarSeparatorExtent ? Width of a toolbar separator in a horizontal toolbar and the height of a separator in a vertical toolbar.
QStyle::PM_ToolBarExtensionExtent ? Width of a toolbar extension button in a horizontal toolbar and the height of the button in a vertical toolbar.
QStyle::PM_TabBarTabOverlap 19 Number of pixels the tabs should overlap. (Currently only used in styles, not inside of QTabBar)
QStyle::PM_TabBarTabHSpace 20 Extra space added to the tab width.
QStyle::PM_TabBarTabVSpace 21 Extra space added to the tab height.
QStyle::PM_TabBarBaseHeight 22 Height of the area between the tab bar and the tab pages.
QStyle::PM_TabBarBaseOverlap 23 Number of pixels the tab bar overlaps the tab bar base.
QStyle::PM_TabBarScrollButtonWidth ?
QStyle::PM_TabBarTabShiftHorizontal ? Horizontal pixel shift when a tab is selected.
QStyle::PM_TabBarTabShiftVertical ? Vertical pixel shift when a tab is selected.
QStyle::PM_ProgressBarChunkWidth 24 Width of a chunk in a progress bar indicator.
QStyle::PM_SplitterWidth 25 Width of a splitter.
QStyle::PM_TitleBarHeight 26 Height of the title bar.
QStyle::PM_IndicatorWidth 37 Width of a check box indicator.
QStyle::PM_IndicatorHeight 38 Height of a checkbox indicator.
QStyle::PM_ExclusiveIndicatorWidth 39 Width of a radio button indicator.
QStyle::PM_ExclusiveIndicatorHeight 40 Height of a radio button indicator.
QStyle::PM_MenuPanelWidth 30 Border width (applied on all sides) for a QMenu.
QStyle::PM_MenuHMargin 28 Additional border (used on left and right) for a QMenu.
QStyle::PM_MenuVMargin 29 Additional border (used for bottom and top) for a QMenu.
QStyle::PM_MenuScrollerHeight 27 Height of the scroller area in a QMenu.
QStyle::PM_MenuTearoffHeight 31 Height of a tear off area in a QMenu.
QStyle::PM_MenuDesktopFrameWidth 32 The frame width for the menu on the desktop.
QStyle::PM_CheckListButtonSize 41 Area (width/height) of the checkbox/radio button in a Q3CheckListItem.
QStyle::PM_CheckListControllerSize 42 Area (width/height) of the controller in a Q3CheckListItem.
QStyle::PM_HeaderMarkSize ? The size of the sort indicator in a header.
QStyle::PM_HeaderGripMargin ? The size of the resize grip in a header.
QStyle::PM_HeaderMargin ? The size of the margin between the sort indicator and the text.
QStyle::PM_SpinBoxSliderHeight ? The height of the optional spin box slider.
QStyle::PM_ToolBarIconSize ? Default tool bar icon size
QStyle::PM_SmallIconSize ? Default small icon size
QStyle::PM_LargeIconSize ? Default large icon size
QStyle::PM_FocusFrameHMargin ? Horizontal margin that the focus frame will outset the widget by.
QStyle::PM_FocusFrameVMargin ? Vertical margin that the focus frame will outset the widget by.
QStyle::PM_IconViewIconSize ? The default size for icons in an icon view.
QStyle::PM_ListViewIconSize ? The default size for icons in a list view.
QStyle::PM_ToolTipLabelFrameWidth ? The frame width for a tool tip label.
QStyle::PM_CheckBoxLabelSpacing ? The spacing between a check box indicator and its label.
QStyle::PM_RadioButtonLabelSpacing ? The spacing between a radio button indicator and its label.
QStyle::PM_TabBarIconSize ? The default icon size for a tab bar.
QStyle::PM_SizeGripSize ? The size of a size grip.
QStyle::PM_MessageBoxIconSize ? The size of the standard icons in a message box
QStyle::PM_ButtonIconSize ? The default size of button icons
QStyle::PM_TextCursorWidth ? The width of the cursor in a line edit or text edit
QStyle::PM_TabBar_ScrollButtonOverlap ? The distance between the left and right buttons in a tab bar.
QStyle::PM_TabCloseIndicatorWidth ? The default width of a close button on a tab in a tab bar.
QStyle::PM_TabCloseIndicatorHeight ? The default height of a close button on a tab in a tab bar.
QStyle::PM_CustomBase 0xf0000000 Base value for custom pixel metrics. Custom values must be greater than this value.

 

enum QStyle::PrimitiveElement

Esse enum descreve os vários elementos primitivos. Um elementos primitivo é um elemento gráfico comum, como um indicador de uma caixa de verificação ou um botão.

Constant Value Description
QStyle::PE_FrameStatusBar 12 Frame
QStyle::PE_PanelButtonCommand ? Button used to initiate an action, for example, a QPushButton.
QStyle::PE_FrameDefaultButton 6 This frame around a default button, e.g. in a dialog.
QStyle::PE_PanelButtonBevel ? Generic panel with a button bevel.
QStyle::PE_PanelButtonTool ? Panel for a Tool button, used with QToolButton.
QStyle::PE_PanelLineEdit ? Panel for a QLineEdit.
QStyle::PE_IndicatorButtonDropDown ? Indicator for a drop down button, for example, a tool button that displays a menu.
QStyle::PE_FrameFocusRect 8 Generic focus indicator.
QStyle::PE_IndicatorArrowUp ? Generic Up arrow.
QStyle::PE_IndicatorArrowDown ? Generic Down arrow.
QStyle::PE_IndicatorArrowRight ? Generic Right arrow.
QStyle::PE_IndicatorArrowLeft ? Generic Left arrow.
QStyle::PE_IndicatorSpinUp ? Up symbol for a spin widget, for example a QSpinBox.
QStyle::PE_IndicatorSpinDown ? Down symbol for a spin widget.
QStyle::PE_IndicatorSpinPlus ? Increase symbol for a spin widget.
QStyle::PE_IndicatorSpinMinus ? Decrease symbol for a spin widget.
QStyle::PE_IndicatorItemViewItemCheck (*) On/off indicator for a view item.
QStyle::PE_IndicatorCheckBox ? On/off indicator, for example, a QCheckBox.
QStyle::PE_IndicatorRadioButton ? Exclusive on/off indicator, for example, a QRadioButton.
QStyle::PE_Q3DockWindowSeparator 3 Item separator for Qt 3 compatible dock window and toolbar contents.
QStyle::PE_IndicatorDockWidgetResizeHandle ? Resize handle for dock windows.
QStyle::PE_Frame 5 Generic frame
QStyle::PE_FrameMenu 11 Frame for popup windows/menus; see also QMenu.
QStyle::PE_PanelMenuBar ? Panel for menu bars.
QStyle::PE_PanelScrollAreaCorner ? Panel at the bottom-right (or bottom-left) corner of a scroll area.
QStyle::PE_FrameDockWidget 7 Panel frame for dock windows and toolbars.
QStyle::PE_FrameTabWidget ? Frame for tab widgets.
QStyle::PE_FrameLineEdit 10 Panel frame for line edits.
QStyle::PE_FrameGroupBox 9 Panel frame around group boxes.
QStyle::PE_FrameButtonBevel ? Panel frame for a button bevel.
QStyle::PE_FrameButtonTool ? Panel frame for a tool button.
QStyle::PE_IndicatorHeaderArrow ? Arrow used to indicate sorting on a list or table header.
QStyle::PE_FrameStatusBarItem (**) Frame for an item of a status bar; see also QStatusBar.
QStyle::PE_FrameWindow ? Frame around a MDI window or a docking window.
QStyle::PE_Q3Separator 4 Qt 3 compatible generic separator.
QStyle::PE_IndicatorMenuCheckMark ? Check mark used in a menu.
QStyle::PE_IndicatorProgressChunk ? Section of a progress bar indicator; see also QProgressBar.
QStyle::PE_Q3CheckListController 0 Qt 3 compatible controller part of a list view item.
QStyle::PE_Q3CheckListIndicator 2 Qt 3 compatible checkbox part of a list view item.
QStyle::PE_Q3CheckListExclusiveIndicator 1 Qt 3 compatible radio button part of a list view item.
QStyle::PE_IndicatorBranch ? Lines used to represent the branch of a tree in a tree view.
QStyle::PE_IndicatorToolBarHandle ? The handle of a toolbar.
QStyle::PE_IndicatorToolBarSeparator ? The separator in a toolbar.
QStyle::PE_PanelToolBar ? The panel for a toolbar.
QStyle::PE_PanelTipLabel ? The panel for a tip label.
QStyle::PE_FrameTabBarBase ? The frame that is drawn for a tab bar, ususally drawn for a tab bar that isn’t part of a tab widget.
QStyle::PE_IndicatorTabTear ? An indicator that a tab is partially scrolled out of the visible tab bar when there are many tabs.
QStyle::PE_IndicatorColumnViewArrow ? An arrow in a QColumnView.
QStyle::PE_Widget ? A plain QWidget.
QStyle::PE_CustomBase 0xf000000 Base value for custom primitive elements. All values above this are reserved for custom use. Custom values must be greater than this value.
QStyle::PE_IndicatorItemViewItemDrop ? An indicator that is drawn to show where an item in an item view is about to be dropped during a drag-and-drop operation in an item view.
QStyle::PE_PanelItemViewItem ? The background for an item in an item view.
QStyle::PE_PanelItemViewRow ? The background of a row in an item view.
QStyle::PE_PanelStatusBar ? The panel for a status bar.
QStyle::PE_IndicatorTabClose ? The close button on a tab bar.
QStyle::PE_PanelMenu ? The panel for a menu.

(*) PE_IndicatorViewItemCheck
(**) PE_FrameStatusBar

enum QStyle::RequestSoftwareInputPanel

Esse enum descreve descreve sob quais circunstâncias um painel de entrada será requisitado por widgets com capacidade de entrada de dados.

Constant Value Description
QStyle::RSIP_OnMouseClickAndAlreadyFocused 0 Requests an input panel if the user clicks on the widget, but only if it is already focused.
QStyle::RSIP_OnMouseClick 1 Requests an input panel if the user clicks on the widget.

enum QStyle::StandardPixmap

Esse enum descreve os pixmaps disponíveis. Um pixmap é uma imagem que pode seguir algum estilo gráfico existente ou um guia.

Constant Value Description
QStyle::SP_TitleBarMinButton 1 Minimize button on title bars (e.g., in QMdiSubWindow).
QStyle::SP_TitleBarMenuButton 0 Menu button on a title bar.
QStyle::SP_TitleBarMaxButton 2 Maximize button on title bars.
QStyle::SP_TitleBarCloseButton 3 Close button on title bars.
QStyle::SP_TitleBarNormalButton 4 Normal (restore) button on title bars.
QStyle::SP_TitleBarShadeButton 5 Shade button on title bars.
QStyle::SP_TitleBarUnshadeButton 6 Unshade button on title bars.
QStyle::SP_TitleBarContextHelpButton 7 The Context help button on title bars.
QStyle::SP_MessageBoxInformation 9 The “information” icon.
QStyle::SP_MessageBoxWarning 10 The “warning” icon.
QStyle::SP_MessageBoxCritical 11 The “critical” icon.
QStyle::SP_MessageBoxQuestion 12 The “question” icon.
QStyle::SP_DesktopIcon 13 The “desktop” icon.
QStyle::SP_TrashIcon 14 The “trash” icon.
QStyle::SP_ComputerIcon 15 The “My computer” icon.
QStyle::SP_DriveFDIcon 16 The floppy icon.
QStyle::SP_DriveHDIcon 17 The harddrive icon.
QStyle::SP_DriveCDIcon 18 The CD icon.
QStyle::SP_DriveDVDIcon 19 The DVD icon.
QStyle::SP_DriveNetIcon 20 The network icon.
QStyle::SP_DirHomeIcon 55 The home directory icon.
QStyle::SP_DirOpenIcon 21 The open directory icon.
QStyle::SP_DirClosedIcon 22 The closed directory icon.
QStyle::SP_DirIcon 37 The directory icon.
QStyle::SP_DirLinkIcon 23 The link to directory icon.
QStyle::SP_FileIcon 24 The file icon.
QStyle::SP_FileLinkIcon 25 The link to file icon.
QStyle::SP_FileDialogStart 28 The “start” icon in a file dialog.
QStyle::SP_FileDialogEnd 29 The “end” icon in a file dialog.
QStyle::SP_FileDialogToParent 30 The “parent directory” icon in a file dialog.
QStyle::SP_FileDialogNewFolder 31 The “create new folder” icon in a file dialog.
QStyle::SP_FileDialogDetailedView 32 The detailed view icon in a file dialog.
QStyle::SP_FileDialogInfoView 33 The file info icon in a file dialog.
QStyle::SP_FileDialogContentsView 34 The contents view icon in a file dialog.
QStyle::SP_FileDialogListView 35 The list view icon in a file dialog.
QStyle::SP_FileDialogBack 36 The back arrow in a file dialog.
QStyle::SP_DockWidgetCloseButton 8 Close button on dock windows (see also QDockWidget).
QStyle::SP_ToolBarHorizontalExtensionButton 26 Extension button for horizontal toolbars.
QStyle::SP_ToolBarVerticalExtensionButton 27 Extension button for vertical toolbars.
QStyle::SP_DialogOkButton 38 Icon for a standard OK button in a QDialogButtonBox.
QStyle::SP_DialogCancelButton 39 Icon for a standard Cancel button in a QDialogButtonBox.
QStyle::SP_DialogHelpButton 40 Icon for a standard Help button in a QDialogButtonBox.
QStyle::SP_DialogOpenButton 41 Icon for a standard Open button in a QDialogButtonBox.
QStyle::SP_DialogSaveButton 42 Icon for a standard Save button in a QDialogButtonBox.
QStyle::SP_DialogCloseButton 43 Icon for a standard Close button in a QDialogButtonBox.
QStyle::SP_DialogApplyButton 44 Icon for a standard Apply button in a QDialogButtonBox.
QStyle::SP_DialogResetButton 45 Icon for a standard Reset button in a QDialogButtonBox.
QStyle::SP_DialogDiscardButton 46 Icon for a standard Discard button in a QDialogButtonBox.
QStyle::SP_DialogYesButton 47 Icon for a standard Yes button in a QDialogButtonBox.
QStyle::SP_DialogNoButton 48 Icon for a standard No button in a QDialogButtonBox.
QStyle::SP_ArrowUp 49 Icon arrow pointing up.
QStyle::SP_ArrowDown 50 Icon arrow pointing down.
QStyle::SP_ArrowLeft 51 Icon arrow pointing left.
QStyle::SP_ArrowRight 52 Icon arrow pointing right.
QStyle::SP_ArrowBack 53 Equivalent to SP_ArrowLeft when the current layout direction is Qt::LeftToRight, otherwise SP_ArrowRight.
QStyle::SP_ArrowForward 54 Equivalent to SP_ArrowRight when the current layout direction is Qt::LeftToRight, otherwise SP_ArrowLeft.
QStyle::SP_CommandLink 56 Icon used to indicate a Vista style command link glyph.
QStyle::SP_VistaShield 57 Icon used to indicate UAC prompts on Windows Vista. This will return a null pixmap or icon on all other platforms.
QStyle::SP_BrowserReload 58 Icon indicating that the current page should be reloaded.
QStyle::SP_BrowserStop 59 Icon indicating that the page loading should stop.
QStyle::SP_MediaPlay 60 Icon indicating that media should begin playback.
QStyle::SP_MediaStop 61 Icon indicating that media should stop playback.
QStyle::SP_MediaPause 62 Icon indicating that media should pause playback.
QStyle::SP_MediaSkipForward 63 Icon indicating that media should skip forward.
QStyle::SP_MediaSkipBackward 64 Icon indicating that media should skip backward.
QStyle::SP_MediaSeekForward 65 Icon indicating that media should seek forward.
QStyle::SP_MediaSeekBackward 66 Icon indicating that media should seek backward.
QStyle::SP_MediaVolume 67 Icon indicating a volume control.
QStyle::SP_MediaVolumeMuted 68 Icon indicating a muted volume control.
QStyle::SP_CustomBase 0xf0000000 Base value for custom standard pixmaps; custom values must be greater than this value.

enum QStyle::StateFlag
flags QStyle::State

Esse enum descreve flags que são usadas ao desenhar elementos primitivos. Observe que nem todos os elementos primitivos usam todas essas flags, e essas flags podem significar coisas diferentes para itens diferentes.

Constant Value Description
QStyle::State_None 0x00000000 Indicates that the widget does not have a state.
QStyle::State_Active 0x00010000 Indicates that the widget is active.
QStyle::State_AutoRaise 0x00001000 Used to indicate if auto-raise appearance should be usd on a tool button.
QStyle::State_Children 0x00080000 Used to indicate if an item view branch has children.
QStyle::State_DownArrow 0x00000040 Used to indicate if a down arrow should be visible on the widget.
QStyle::State_Editing 0x00400000 Used to indicate if an editor is opened on the widget.
QStyle::State_Enabled 0x00000001 Used to indicate if the widget is enabled.
QStyle::State_HasEditFocus 0x01000000 Used to indicate if the widget currently has edit focus.
QStyle::State_HasFocus 0x00000100 Used to indicate if the widget has focus.
QStyle::State_Horizontal 0x00000080 Used to indicate if the widget is laid out horizontally, for example. a tool bar.
QStyle::State_KeyboardFocusChange 0x00800000 Used to indicate if the focus was changed with the keyboard, e.g., tab, backtab or shortcut.
QStyle::State_MouseOver 0x00002000 Used to indicate if the widget is under the mouse.
QStyle::State_NoChange 0x00000010 Used to indicate a tri-state checkbox.
QStyle::State_Off 0x00000008 Used to indicate if the widget is not checked.
QStyle::State_On 0x00000020 Used to indicate if the widget is checked.
QStyle::State_Raised 0x00000002 Used to indicate if a button is raised.
QStyle::State_ReadOnly 0x02000000 Used to indicate if a widget is read-only.
QStyle::State_Selected 0x00008000 Used to indicate if a widget is selected.
QStyle::State_Item 0x00100000 Used by item views to indicate if a horizontal branch should be drawn.
QStyle::State_Open 0x00040000 Used by item views to indicate if the tree branch is open.
QStyle::State_Sibling 0x00200000 Used by item views to indicate if a vertical line needs to be drawn (for siblings).
QStyle::State_Sunken 0x00000004 Used to indicate if the widget is sunken or pressed.
QStyle::State_UpArrow 0x00004000 Used to indicate if an up arrow should be visible on the widget.
QStyle::State_Mini 0x08000000 Used to indicate a mini style Mac widget or button.
QStyle::State_Small 0x04000000 Used to indicate a small style Mac widget or button.

O tipo State é um typedef para QFlags<StateFlag>. Ele armazena uma combinação OR de valores StateFlag.

enum QStyle::StyleHint

Esse enum descreve uma dica de estilo disponível. Uma dica de estilo é uma dica de aparência genérica.

Constant Value Description
QStyle::SH_EtchDisabledText 0 Disabled text is “etched” as it is on Windows.
QStyle::SH_DitherDisabledText 1 Disabled text is dithered as it is on Motif.
QStyle::SH_GUIStyle 0x00000100 The GUI style to use.
QStyle::SH_ScrollBar_ContextMenu ? Whether or not a scroll bar has a context menu.
QStyle::SH_ScrollBar_MiddleClickAbsolutePosition 2 A boolean value. If true, middle clicking on a scroll bar causes the slider to jump to that position. If false, middle clicking is ignored.
QStyle::SH_ScrollBar_LeftClickAbsolutePosition ? A boolean value. If true, left clicking on a scroll bar causes the slider to jump to that position. If false, left clicking will behave as appropriate for each control.
QStyle::SH_ScrollBar_ScrollWhenPointerLeavesControl 3 A boolean value. If true, when clicking a scroll bar SubControl, holding the mouse button down and moving the pointer outside the SubControl, the scroll bar continues to scroll. If false, the scollbar stops scrolling when the pointer leaves the SubControl.
QStyle::SH_ScrollBar_RollBetweenButtons ? A boolean value. If true, when clicking a scroll bar button (SC_ScrollBarAddLine orSC_ScrollBarSubLine) and dragging over to the opposite button (rolling) will press the new button and release the old one. When it is false, the original button is released and nothing happens (like a push button).
QStyle::SH_TabBar_Alignment 5 The alignment for tabs in a QTabWidget. Possible values are Qt::AlignLeftQt::AlignCenterand Qt::AlignRight.
QStyle::SH_Header_ArrowAlignment 6 The placement of the sorting indicator may appear in list or table headers. Possible values are Qt::Left or Qt::Right.
QStyle::SH_Slider_SnapToValue 7 Sliders snap to values while moving, as they do on Windows.
QStyle::SH_Slider_SloppyKeyEvents 8 Key presses handled in a sloppy manner, i.e., left on a vertical slider subtracts a line.
QStyle::SH_ProgressDialog_CenterCancelButton 9 Center button on progress dialogs, like Motif, otherwise right aligned.
QStyle::SH_ProgressDialog_TextLabelAlignment 10 The alignment for text labels in progress dialogs; Qt::AlignCenter on Windows,Qt::AlignVCenter otherwise.
QStyle::SH_PrintDialog_RightAlignButtons 11 Right align buttons in the print dialog, as done on Windows.
QStyle::SH_MainWindow_SpaceBelowMenuBar 12 One or two pixel space between the menu bar and the dockarea, as done on Windows.
QStyle::SH_FontDialog_SelectAssociatedText 13 Select the text in the line edit, or when selecting an item from the listbox, or when the line edit receives focus, as done on Windows.
QStyle::SH_Menu_KeyboardSearch ? Typing causes a menu to be search for relevant items, otherwise only mnemnonic is considered.
QStyle::SH_Menu_AllowActiveAndDisabled 14 Allows disabled menu items to be active.
QStyle::SH_Menu_SpaceActivatesItem 15 Pressing the space bar activates the item, as done on Motif.
QStyle::SH_Menu_SubMenuPopupDelay 16 The number of milliseconds to wait before opening a submenu (256 on Windows, 96 on Motif).
QStyle::SH_Menu_Scrollable ? Whether popup menus must support scrolling.
QStyle::SH_Menu_SloppySubMenus ? Whether popupmenu’s must support sloppy submenu; as implemented on Mac OS.
QStyle::SH_ScrollView_FrameOnlyAroundContents 17 Whether scrollviews draw their frame only around contents (like Motif), or around contents, scroll bars and corner widgets (like Windows).
QStyle::SH_MenuBar_AltKeyNavigation 18 Menu bars items are navigable by pressing Alt, followed by using the arrow keys to select the desired item.
QStyle::SH_ComboBox_ListMouseTracking 19 Mouse tracking in combobox drop-down lists.
QStyle::SH_Menu_MouseTracking 20 Mouse tracking in popup menus.
QStyle::SH_MenuBar_MouseTracking 21 Mouse tracking in menu bars.
QStyle::SH_Menu_FillScreenWithScroll ? Whether scrolling popups should fill the screen as they are scrolled.
QStyle::SH_Menu_SelectionWrap ? Whether popups should allow the selections to wrap, that is when selection should the next item be the first item.
QStyle::SH_ItemView_ChangeHighlightOnFocus 22 Gray out selected items when losing focus.
QStyle::SH_Widget_ShareActivation 23 Turn on sharing activation with floating modeless dialogs.
QStyle::SH_TabBar_SelectMouseType 4 Which type of mouse event should cause a tab to be selected.
QStyle::SH_Q3ListViewExpand_SelectMouseType ? Which type of mouse event should cause a list view expansion to be selected.
QStyle::SH_TabBar_PreferNoArrows ? Whether a tab bar should suggest a size to prevent scoll arrows.
QStyle::SH_ComboBox_Popup 25 Allows popups as a combobox drop-down menu.
QStyle::SH_Workspace_FillSpaceOnMaximize 24 The workspace should maximize the client area.
QStyle::SH_TitleBar_NoBorder 26 The title bar has no border.
QStyle::SH_ScrollBar_StopMouseOverSlider (*) Obsolete. Use SH_Slider_StopMouseOverSlider instead.
QStyle::SH_Slider_StopMouseOverSlider 27 Stops auto-repeat when the slider reaches the mouse position.
QStyle::SH_BlinkCursorWhenTextSelected ? Whether cursor should blink when text is selected.
QStyle::SH_RichText_FullWidthSelection ? Whether richtext selections should extend to the full width of the document.
QStyle::SH_GroupBox_TextLabelVerticalAlignment ? How to vertically align a group box’s text label.
QStyle::SH_GroupBox_TextLabelColor ? How to paint a group box’s text label.
QStyle::SH_DialogButtons_DefaultButton ? Which button gets the default status in a dialog’s button widget.
QStyle::SH_ToolBox_SelectedPageTitleBold ? Boldness of the selected page title in a QToolBox.
QStyle::SH_LineEdit_PasswordCharacter ? The Unicode character to be used for passwords.
QStyle::SH_Table_GridLineColor ? The RGB value of the grid for a table.
QStyle::SH_UnderlineShortcut ? Whether shortcuts are underlined.
QStyle::SH_SpellCheckUnderlineStyle ? QTextCharFormat::UnderlineStyle value that specifies the way misspelled words should be underlined.
QStyle::SH_SpinBox_AnimateButton ? Animate a click when up or down is pressed in a spin box.
QStyle::SH_SpinBox_KeyPressAutoRepeatRate ? Auto-repeat interval for spinbox key presses.
QStyle::SH_SpinBox_ClickAutoRepeatRate ? Auto-repeat interval for spinbox mouse clicks.
QStyle::SH_SpinBox_ClickAutoRepeatThreshold ? Auto-repeat threshold for spinbox mouse clicks.
QStyle::SH_ToolTipLabel_Opacity ? An integer indicating the opacity for the tip label, 0 is completely transparent, 255 is completely opaque.
QStyle::SH_DrawMenuBarSeparator ? Indicates whether or not the menu bar draws separators.
QStyle::SH_TitleBar_ModifyNotification ? Indicates if the title bar should show a ‘*’ for windows that are modified.
QStyle::SH_Button_FocusPolicy ? The default focus policy for buttons.
QStyle::SH_CustomBase 0xf0000000 Base value for custom style hints. Custom values must be greater than this value.
QStyle::SH_MenuBar_DismissOnSecondClick ? A boolean indicating if a menu in the menu bar should be dismissed when it is clicked on a second time. (Example: Clicking and releasing on the File Menu in a menu bar and then immediately clicking on the File Menu again.)
QStyle::SH_MessageBox_UseBorderForButtonSpacing ? A boolean indicating what the to use the border of the buttons (computed as half the button height) for the spacing of the button in a message box.
QStyle::SH_MessageBox_CenterButtons ? A boolean indicating whether the buttons in the message box should be centered or not (see QDialogButtonBox::setCentered()).
QStyle::SH_MessageBox_TextInteractionFlags ? A boolean indicating if the text in a message box should allow user interfactions (e.g. selection) or not.
QStyle::SH_TitleBar_AutoRaise ? A boolean indicating whether controls on a title bar ought to update when the mouse is over them.
QStyle::SH_ToolButton_PopupDelay ? An int indicating the popup delay in milliseconds for menus attached to tool buttons.
QStyle::SH_FocusFrame_Mask ? The mask of the focus frame.
QStyle::SH_RubberBand_Mask ? The mask of the rubber band.
QStyle::SH_WindowFrame_Mask ? The mask of the window frame.
QStyle::SH_SpinControls_DisableOnBounds ? Determines if the spin controls will shown as disabled when reaching the spin range boundary.
QStyle::SH_Dial_BackgroundRole ? Defines the style’s preferred background role (as QPalette::ColorRole) for a dial widget.
QStyle::SH_ScrollBar_BackgroundMode ? The background mode for a scroll bar.
QStyle::SH_ComboBox_LayoutDirection ? The layout direction for the combo box. By default it should be the same as indicated by theQStyleOption::direction variable.
QStyle::SH_ItemView_EllipsisLocation ? The location where ellipses should be added for item text that is too long to fit in an view item.
QStyle::SH_ItemView_ShowDecorationSelected ? When an item in an item view is selected, also highlight the branch or other decoration.
QStyle::SH_ItemView_ActivateItemOnSingleClick ? Emit the activated signal when the user single clicks on an item in an item in an item view. Otherwise the signal is emitted when the user double clicks on an item.
QStyle::SH_Slider_AbsoluteSetButtons ? Which mouse buttons cause a slider to set the value to the position clicked on.
QStyle::SH_Slider_PageSetButtons ? Which mouse buttons cause a slider to page step the value.
QStyle::SH_TabBar_ElideMode ? The default eliding style for a tab bar.
QStyle::SH_DialogButtonLayout ? Controls how buttons are laid out in a QDialogButtonBox, returns aQDialogButtonBox::ButtonLayout enum.
QStyle::SH_WizardStyle ? Controls the look and feel of a QWizard. Returns a QWizard::WizardStyle enum.
QStyle::SH_FormLayoutWrapPolicy ? Provides a default for how rows are wrapped in a QFormLayout. Returns aQFormLayout::RowWrapPolicy enum.
QStyle::SH_FormLayoutFieldGrowthPolicy ? Provides a default for how fields can grow in a QFormLayout. Returns aQFormLayout::FieldGrowthPolicy enum.
QStyle::SH_FormLayoutFormAlignment ? Provides a default for how a QFormLayout aligns its contents within the available space. Returns a Qt::Alignment enum.
QStyle::SH_FormLayoutLabelAlignment ? Provides a default for how a QFormLayout aligns labels within the available space. Returns aQt::Alignment enum.
QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren ? Controls whether the tree view will select the first child when it is exapanded and the right arrow key is pressed.
QStyle::SH_ComboBox_PopupFrameStyle ? The frame style used when drawing a combobox popup menu.
QStyle::SH_DialogButtonBox_ButtonsHaveIcons ? Indicates whether or not StandardButtons in QDialogButtonBox should have icons or not.
QStyle::SH_ItemView_MovementWithoutUpdatingSelection ? The item view is able to indicate a current item without changing the selection.
QStyle::SH_ToolTip_Mask ? The mask of a tool tip.
QStyle::SH_FocusFrame_AboveWidget ? The FocusFrame is stacked above the widget that it is “focusing on”.
QStyle::SH_TextControl_FocusIndicatorTextCharFormat ? Specifies the text format used to highlight focused anchors in rich text documents displayed for example in QTextBrowser. The format has to be a QTextCharFormat returned in the variant of the QStyleHintReturnVariant return value. The QTextFormat::OutlinePenproperty is used for the outline and QTextFormat::BackgroundBrush for the background of the highlighted area.
QStyle::SH_Menu_FlashTriggeredItem ? Flash triggered item.
QStyle::SH_Menu_FadeOutOnHide ? Fade out the menu instead of hiding it immediately.
QStyle::SH_TabWidget_DefaultTabPosition ? Default position of the tab bar in a tab widget.
QStyle::SH_ToolBar_Movable ? Determines if the tool bar is movable by default.
QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea ? Whether QTreeView paints alternating row colors for the area that does not have any items.
QStyle::SH_Menu_Mask ? The mask for a popup menu.
QStyle::SH_ItemView_DrawDelegateFrame ? Determines if there should be a frame for a delegate widget.
QStyle::SH_TabBar_CloseButtonPosition ? Determines the position of the close button on a tab in a tab bar.
QStyle::SH_DockWidget_ButtonsHaveFrame ? Determines if dockwidget buttons should have frames. Default is true.
QStyle::SH_ToolButtonStyle ? Determines the default system style for tool buttons that uses Qt::ToolButtonFollowStyle.
QStyle::SH_RequestSoftwareInputPanel ? Determines when a software input panel should be requested by input widgets. Returns an enum of type QStyle::RequestSoftwareInputPanel.

(*) SH_Slider_StopMouseOverSlider

enum QStyle::SubControl
flags QStyle::SubControls

Esse enum descreve os sub-controles disponíveis. Um sub-controle é um elemento de controle dentro de um controle complexo.

Constant Value Description
QStyle::SC_None 0x00000000 Special value that matches no other sub control.
QStyle::SC_ScrollBarAddLine 0x00000001 Scroll bar add line (i.e., down/right arrow); see also QScrollBar.
QStyle::SC_ScrollBarSubLine 0x00000002 Scroll bar sub line (i.e., up/left arrow).
QStyle::SC_ScrollBarAddPage 0x00000004 Scroll bar add page (i.e., page down).
QStyle::SC_ScrollBarSubPage 0x00000008 Scroll bar sub page (i.e., page up).
QStyle::SC_ScrollBarFirst 0x00000010 Scroll bar first line (i.e., home).
QStyle::SC_ScrollBarLast 0x00000020 Scroll bar last line (i.e., end).
QStyle::SC_ScrollBarSlider 0x00000040 Scroll bar slider handle.
QStyle::SC_ScrollBarGroove 0x00000080 Special sub-control which contains the area in which the slider handle may move.
QStyle::SC_SpinBoxUp 0x00000001 Spin widget up/increase; see also QSpinBox.
QStyle::SC_SpinBoxDown 0x00000002 Spin widget down/decrease.
QStyle::SC_SpinBoxFrame 0x00000004 Spin widget frame.
QStyle::SC_SpinBoxEditField 0x00000008 Spin widget edit field.
QStyle::SC_ComboBoxEditField 0x00000002 Combobox edit field; see also QComboBox.
QStyle::SC_ComboBoxArrow 0x00000004 Combobox arrow button.
QStyle::SC_ComboBoxFrame 0x00000001 Combobox frame.
QStyle::SC_ComboBoxListBoxPopup 0x00000008 The reference rectangle for the combobox popup. Used to calculate the position of the popup.
QStyle::SC_SliderGroove 0x00000001 Special sub-control which contains the area in which the slider handle may move.
QStyle::SC_SliderHandle 0x00000002 Slider handle.
QStyle::SC_SliderTickmarks 0x00000004 Slider tickmarks.
QStyle::SC_ToolButton 0x00000001 Tool button (see also QToolButton).
QStyle::SC_ToolButtonMenu 0x00000002 Sub-control for opening a popup menu in a tool button; see also Q3PopupMenu.
QStyle::SC_TitleBarSysMenu 0x00000001 System menu button (i.e., restore, close, etc.).
QStyle::SC_TitleBarMinButton 0x00000002 Minimize button.
QStyle::SC_TitleBarMaxButton 0x00000004 Maximize button.
QStyle::SC_TitleBarCloseButton 0x00000008 Close button.
QStyle::SC_TitleBarLabel 0x00000100 Window title label.
QStyle::SC_TitleBarNormalButton 0x00000010 Normal (restore) button.
QStyle::SC_TitleBarShadeButton 0x00000020 Shade button.
QStyle::SC_TitleBarUnshadeButton 0x00000040 Unshade button.
QStyle::SC_TitleBarContextHelpButton 0x00000080 Context Help button.
QStyle::SC_Q3ListView 0x00000001 The list view area.
QStyle::SC_Q3ListViewExpand 0x00000004 Expand item (i.e., show/hide child items).
QStyle::SC_DialHandle 0x00000002 The handle of the dial (i.e. what you use to control the dial).
QStyle::SC_DialGroove 0x00000001 The groove for the dial.
QStyle::SC_DialTickmarks 0x00000004 The tickmarks for the dial.
QStyle::SC_GroupBoxFrame 0x00000008 The frame of a group box.
QStyle::SC_GroupBoxLabel 0x00000002 The title of a group box.
QStyle::SC_GroupBoxCheckBox 0x00000001 The optional check box of a group box.
QStyle::SC_GroupBoxContents 0x00000004 The group box contents.
QStyle::SC_MdiNormalButton 0x00000002 The normal button for a MDI subwindow in the menu bar.
QStyle::SC_MdiMinButton 0x00000001 The minimize button for a MDI subwindow in the menu bar.
QStyle::SC_MdiCloseButton 0x00000004 The close button for a MDI subwindow in the menu bar.
QStyle::SC_All 0xffffffff Special value that matches all sub-controls.

O tipo SubControls é um typedef para QFlags<SubControl>. Ele armazena uma combinação OR de valores SubControl.

enum QStyle::SubElement

Esse enum representa uma sub-área de um widget. Implementações de estilo usam essas áreas para desenhar as diferentes partes de um widget.

Constant Value Description
QStyle::SE_PushButtonContents 0 Area containing the label (icon with text or pixmap).
QStyle::SE_PushButtonFocusRect 1 Area for the focus rect (usually larger than the contents rect).
QStyle::SE_PushButtonLayoutItem ? Area that counts for the parent layout.
QStyle::SE_CheckBoxIndicator 2 Area for the state indicator (e.g., check mark).
QStyle::SE_CheckBoxContents 3 Area for the label (text or pixmap).
QStyle::SE_CheckBoxFocusRect 4 Area for the focus indicator.
QStyle::SE_CheckBoxClickRect 5 Clickable area, defaults to SE_CheckBoxFocusRect.
QStyle::SE_CheckBoxLayoutItem ? Area that counts for the parent layout.
QStyle::SE_DateTimeEditLayoutItem ? Area that counts for the parent layout.
QStyle::SE_RadioButtonIndicator 6 Area for the state indicator.
QStyle::SE_RadioButtonContents 7 Area for the label.
QStyle::SE_RadioButtonFocusRect 8 Area for the focus indicator.
QStyle::SE_RadioButtonClickRect 9 Clickable area, defaults to SE_RadioButtonFocusRect.
QStyle::SE_RadioButtonLayoutItem ? Area that counts for the parent layout.
QStyle::SE_ComboBoxFocusRect 10 Area for the focus indicator.
QStyle::SE_SliderFocusRect 11 Area for the focus indicator.
QStyle::SE_SliderLayoutItem ? Area that counts for the parent layout.
QStyle::SE_SpinBoxLayoutItem ? Area that counts for the parent layout.
QStyle::SE_Q3DockWindowHandleRect 12 Area for the tear-off handle.
QStyle::SE_ProgressBarGroove 13 Area for the groove.
QStyle::SE_ProgressBarContents 14 Area for the progress indicator.
QStyle::SE_ProgressBarLabel 15 Area for the text label.
QStyle::SE_ProgressBarLayoutItem ? Area that counts for the parent layout.
QStyle::SE_FrameContents ? Area for a frame’s contents.
QStyle::SE_ShapedFrameContents ? Area for a frame’s contents using the shape in QStyleOptionFrameV3; see QFrame
QStyle::SE_FrameLayoutItem ? Area that counts for the parent layout.
QStyle::SE_HeaderArrow 27 Area for the sort indicator for a header.
QStyle::SE_HeaderLabel 26 Area for the label in a header.
QStyle::SE_LabelLayoutItem ? Area that counts for the parent layout.
QStyle::SE_LineEditContents ? Area for a line edit’s contents.
QStyle::SE_TabWidgetLeftCorner 31 Area for the left corner widget in a tab widget.
QStyle::SE_TabWidgetRightCorner 32 Area for the right corner widget in a tab widget.
QStyle::SE_TabWidgetTabBar 28 Area for the tab bar widget in a tab widget.
QStyle::SE_TabWidgetTabContents 30 Area for the contents of the tab widget.
QStyle::SE_TabWidgetTabPane 29 Area for the pane of a tab widget.
QStyle::SE_TabWidgetLayoutItem ? Area that counts for the parent layout.
QStyle::SE_ToolBoxTabContents 25 Area for a toolbox tab’s icon and label.
QStyle::SE_ToolButtonLayoutItem ? Area that counts for the parent layout.
QStyle::SE_ItemViewItemCheckIndicator (*) Area for a view item’s check mark.
QStyle::SE_TabBarTearIndicator ? Area for the tear indicator on a tab bar with scroll arrows.
QStyle::SE_TreeViewDisclosureItem ? Area for the actual disclosure item in a tree branch.
QStyle::SE_DialogButtonBoxLayoutItem ? Area that counts for the parent layout.
QStyle::SE_GroupBoxLayoutItem ? Area that counts for the parent layout.
QStyle::SE_CustomBase 0xf0000000 Base value for custom sub-elements. Custom values must be greater than this value.
QStyle::SE_DockWidgetFloatButton ? The float button of a dock widget.
QStyle::SE_DockWidgetTitleBarText ? The text bounds of the dock widgets title.
QStyle::SE_DockWidgetCloseButton ? The close button of a dock widget.
QStyle::SE_DockWidgetIcon ? The icon of a dock widget.
QStyle::SE_ComboBoxLayoutItem ? Area that counts for the parent layout.
QStyle::SE_ItemViewItemDecoration ? Area for a view item’s decoration (icon).
QStyle::SE_ItemViewItemText ? Area for a view item’s text.
QStyle::SE_ItemViewItemFocusRect ? Area for a view item’s focus rect.
QStyle::SE_TabBarTabLeftButton ? Area for a widget on the left side of a tab in a tab bar.
QStyle::SE_TabBarTabRightButton ? Area for a widget on the right side of a tab in a tab bar.
QStyle::SE_TabBarTabText ? Area for the text on a tab in a tab bar.
QStyle::SE_ToolBarHandle ? Area for the handle of a tool bar.
(*) SE_ViewItemCheckIndicator

Member Function Documentation

QStyle::QStyle ()

Construtor do objeto do estilo.

QStyle::~QStyle () [virtual]

Destrutor do objeto do estilo.

QRect QStyle::alignedRect ( Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize & size, const QRect & rectangle ) [static]

Retorna um novo retângulo de tamanho size que é alinhado pelo rectangle dado de acordo com os valores alignment e direction especificados.

int QStyle::combinedLayoutSpacing ( QSizePolicy::ControlTypes controls1, QSizePolicy::ControlTypes controls2, Qt::Orientation orientation,QStyleOption * option = 0, QWidget * widget = 0 ) const

Retorna o espaçamento que deve ser usado entre controls1 e controls2 em um layout. orientation especifica se os controles são estabelecidos lado a lado ou empilhados verticalmente. O parâmetro option pode ser usado para passar informações extra sobre o widget pai. O parâmetro widget é opcional e pode também ser usado se option tiver o valor 0.
Os parâmetros controls1 and controls2 são uma combinação OR de um ou mais tipos de controles.
Essa função é chamada pelo sistema  de layout. É usado apenas se PM_LayoutHorizontalSpacing ou PM_LayoutVerticalSpacing retornam um valor negativo.

void QStyle::drawComplexControl ( ComplexControl control, const QStyleOptionComplex * option, QPainter * painter, const QWidget * widget = 0 ) const [pure virtual]

Desenha um controle usando um painter fornecido com as opções de estilo especificadas por option.
O argumento widget é opcional e pode usado como uma ajuda no desenho do controle.
O parâmetro option é um ponteiro para um objeto QStyleOptionComplex que pode ser lançar a sub-classe orreta usando a função qstyleoption_cast(). Observe que o membro  rect da option especificada precisa estar em coordenadas lógicas. Re-implementações dessa função devem usar visualRect() para alterar as coordenadas lógicas em coordenadas de tela antes de chamar as funções drawPrimitive() ou drawControl().
A tabela abaixo lista os elementos dos controles complexos e suas sub-classes de opção associadas. As opções de estilo contém todos os parâmetros requeridos para desenhar os controles, incluindo QStyleOption::state que armazena as style flags que são usadas durante o desenho. A tabela também descreve quais flags são usadas quando são lançadas as opções fornecidas para as sub-classes apropriadas.

Complex Control QStyleOptionComplex Subclass Style Flag Remark
CC_SpinBox QStyleOptionSpinBox State_Enabled Set if the spin box is enabled.
State_HasFocus Set if the spin box has input focus.
CC_ComboBox QStyleOptionComboBox State_Enabled Set if the combobox is enabled.
State_HasFocus Set if the combobox has input focus.
CC_ScrollBar QStyleOptionSlider State_Enabled Set if the scroll bar is enabled.
State_HasFocus Set if the scroll bar has input focus.
CC_Slider QStyleOptionSlider State_Enabled Set if the slider is enabled.
State_HasFocus Set if the slider has input focus.
CC_Dial QStyleOptionSlider State_Enabled Set if the dial is enabled.
State_HasFocus Set if the dial has input focus.
CC_ToolButton QStyleOptionToolButton State_Enabled Set if the tool button is enabled.
State_HasFocus Set if the tool button has input focus.
State_DownArrow Set if the tool button is down (i.e., a mouse button or the space bar is pressed).
State_On Set if the tool button is a toggle button and is toggled on.
State_AutoRaise Set if the tool button has auto-raise enabled.
State_Raised Set if the button is not down, not on, and doesn’t contain the mouse when auto-raise is enabled.
CC_TitleBar QStyleOptionTitleBar State_Enabled Set if the title bar is enabled.
CC_Q3ListView QStyleOptionQ3ListView State_Enabled Set if the list view is enabled.
void QStyle::drawControl ( ControlElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = 0 ) const [pure virtual]

Desenha o element dado com o painter fornecido com as opções de estilo especificas por option.
O argumento widget é opcional e pode ser usado como uma ajuda no desenho do controle. O parâmetro option é um ponteiro para um objeto QStyleOption que pode lançar a sub-classe correta usando a função qstyleoption_cast().
A tabela abaixo lista os elementos de controle e as sub-classes de opção de estilo associadas. As opções de estilo contém todos os parâmetros requeridos para desenhar os controles, incluindo QStyleOption::state que armazena as flags de estilo que são usadas durante o desenho. A tabela também descreve quais flags que são configuradas quando  lançada a opção para um sub-classe apropriada.

Control Element QStyleOption Subclass Style Flag Remark
CE_MenuItemCE_MenuBarItem QStyleOptionMenuItem State_Selected The menu item is currently selected item.
State_Enabled The item is enabled.
State_DownArrow Indicates that a scroll down arrow should be drawn.
State_UpArrow Indicates that a scroll up arrow should be drawn
State_HasFocus Set if the menu bar has input focus.
CE_PushButton
CE_PushButtonBevel
CE_PushButtonLabel
QStyleOptionButton State_Enabled Set if the button is enabled.
State_HasFocus Set if the button has input focus.
State_Raised Set if the button is not down, not on and not flat.
State_On Set if the button is a toggle button and is toggled on.
State_Sunken Set if the button is down (i.e., the mouse button or the space bar is pressed on the button).
CE_RadioButton
CE_RadioButtonLabel
CE_CheckBox
CE_CheckBoxLabel
QStyleOptionButton State_Enabled Set if the button is enabled.
State_HasFocus Set if the button has input focus.
State_On Set if the button is checked.
State_Off Set if the button is not checked.
State_NoChange Set if the button is in the NoChange state.
State_Sunken Set if the button is down (i.e., the mouse button or the space bar is pressed on the button).
CE_ProgressBarContents
CE_ProgressBarLabel
CE_ProgressBarGroove
QStyleOptionProgressBar State_Enabled Set if the progress bar is enabled.
State_HasFocus Set if the progress bar has input focus.
CE_Header
CE_HeaderSection
CE_HeaderLabel
QStyleOptionHeader
CE_TabBarTab
CE_TabBarTabShape
CE_TabBarTabLabel
QStyleOptionTab State_Enabled Set if the tab bar is enabled.
State_Selected The tab bar is the currently selected tab bar.
State_HasFocus Set if the tab bar tab has input focus.
CE_ToolButtonLabel QStyleOptionToolButton State_Enabled Set if the tool button is enabled.
State_HasFocus Set if the tool button has input focus.
State_Sunken Set if the tool button is down (i.e., a mouse button or the space bar is pressed).
State_On Set if the tool button is a toggle button and is toggled on.
State_AutoRaise Set if the tool button has auto-raise enabled.
State_MouseOver Set if the mouse pointer is over the tool button.
State_Raised Set if the button is not down and is not on.
CE_ToolBoxTab QStyleOptionToolBox State_Selected The tab is the currently selected tab.
CE_HeaderSection QStyleOptionHeader State_Sunken Indicates that the section is pressed.
State_UpArrow Indicates that the sort indicator should be pointing up.
State_DownArrow Indicates that the sort indicator should be pointing down.

void QStyle::drawItemPixmap ( QPainter * painter, const QRect & rectangle, int alignment, const QPixmap & pixmap ) const [virtual]


Desenha um pixmap dado em um rectangle especificado, de acordo com o alignment passado, usando o painter fornecido.

void QStyle::drawItemText ( QPainter * painter, const QRect & rectangle, int alignment, const QPalette & palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole ) const [virtual]


Desenha o text dado em um rectangle especificado usando os painter e palette fornecidos.
O texto é desenhado usando a caneta do painter., e alinhado e envolto de acordo com o alinhamento especificado. Se um textRole for explicitamente fornecido, o texto será desenhado usando as cores da paleta da regra dada. O parâmetro enabled indica se um item está ativo ou não; quando re-implementar essa função, esse parâmetro deve influenciar como o item é desenhado.

void QStyle::drawPrimitive ( PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = 0 ) const [pure virtual]


Desenha o elemento primitivo dado com o painter fornecido usando as opções de estilo especificados por option.
O argumento widget é opcional e pode conter um widget que pode ajudar no desenho do elemento primitivo.
A tabela abaixo lista os elementos primitivos e suas sub-classes de opção de estilo associadas. As opções de estilo contém todos os parâmetros requeridos para desenhar os elementos, incluindo QStyleOption::state que armazena as flags de estilo que são usadas no desenho. A tabela também descreve quais flags são configuradas ao lançar a opção dada para a sub-classe apropriada.

Primitive Element QStyleOption Subclass Style Flag Remark
PE_FrameFocusRect QStyleOptionFocusRect State_FocusAtBorder Whether the focus is is at the border or inside the widget.
PE_IndicatorCheckBox QStyleOptionButton State_NoChange Indicates a “tri-state” checkbox.
State_On Indicates the indicator is checked.
PE_IndicatorRadioButton QStyleOptionButton State_On Indicates that a radio button is selected.
PE_Q3CheckListExclusiveIndicator
PE_Q3CheckListIndicator
QStyleOptionQ3ListView State_On Indicates whether or not the controller is selected.
State_NoChange Indicates a “tri-state” controller.
State_Enabled Indicates the controller is enabled.
PE_IndicatorBranch QStyleOption State_Children Indicates that the control for expanding the tree to show child items, should be drawn.
State_Item Indicates that a horizontal branch (to show a child item), should be drawn.
State_Open Indicates that the tree branch is expanded.
State_Sibling Indicates that a vertical line (to show a sibling item), should be drawn.
PE_IndicatorHeaderArrow QStyleOptionHeader State_UpArrow Indicates that the arrow should be drawn up; otherwise it should be down.
PE_FrameGroupBox
PE_Frame
PE_FrameLineEdit
PE_FrameMenu
PE_FrameDockWidget
PE_FrameWindow
QStyleOptionFrame State_Sunken Indicates that the Frame should be sunken.
PE_IndicatorToolBarHandle QStyleOption State_Horizontal Indicates that the window handle is horizontal instead of vertical.
PE_Q3DockWindowSeparator QStyleOption State_Horizontal Indicates that the separator is horizontal instead of vertical.
PE_IndicatorSpinPlus
PE_IndicatorSpinMinus
PE_IndicatorSpinUp
PE_IndicatorSpinDown,
QStyleOptionSpinBox State_Sunken Indicates that the button is pressed.
PE_PanelButtonCommand QStyleOptionButton State_Enabled Set if the button is enabled.
State_HasFocus Set if the button has input focus.
State_Raised Set if the button is not down, not on and not flat.
State_On Set if the button is a toggle button and is toggled on.
State_Sunken Set if the button is down (i.e., the mouse button or the space bar is pressed on the button).

QPixmap QStyle::generatedIconPixmap ( QIcon::Mode iconMode, const QPixmap & pixmap, const QStyleOption * option ) const [pure virtual]

Retorna uma cópia do pixmap dado, estilizado de acordo com o iconMode especificado e levando em conta a paleta especificado por option.
O parâmetro option pode passar informações extras, mas precisa conter uma paleta.
Observe que nem todos os pixmaps adaptar-se, nesse caso o pixmap retornado será uma cópia em branco.

SubControl QStyle::hitTestComplexControl ( ComplexControl control, const QStyleOptionComplex * option, const QPoint & position, const QWidget* widget = 0 ) const [pure virtual]

Retorna o sub-controle da posição dada no controle complexo passado (com as opções de estilo especificadas por option).
Observe que position é expressa em coordenadas de tela.
O argumento option é um ponteiro para um objeto  QStyleOptionComplex (ou uma de suas sub-classes). O objeto pode lançar o tipo apropriado usando a função qstyleoption_cast(). O argumento widget é opcional e pode conter informações adicionais para a função.

QRect QStyle::itemPixmapRect ( const QRect & rectangle, int alignment, const QPixmap & pixmap ) const [virtual]

Retorna a área interna de um rectangle dado no qual será  desenhado o pixmap de acordo como o alignment definido.

QRect QStyle::itemTextRect ( const QFontMetrics & metrics, const QRect & rectangle, int alignment, bool enabled, const QString & text ) const[virtual]

Retorna a área interna do rectangle dado no qual será desenhado o text fornecido de acordo com os valores de metrics and alignment especificados. O parâametro enabled indica se o item está ativo ou não.
Se o rectangle dado for maior que a área necessária para renderizar o texto, o retângulo retornado será deslocado dentro do rectangle de acordo com o  alignment. Por exemplo, se alignment for Qt::AlignCenter, o retângulo retornado será centralizado dentro do rectangle. Se o rectangle dado dor menor que a área necessária, o retângulo retornado será o menor retângulo grande o suficiente para renderizar o texto.

int QStyle::layoutSpacing ( QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption* option = 0, const QWidget * widget = 0 ) const


Retorna o espaçamento que deve usado entre control1 e control2 em um layout. orientation especifica se os controles são dispostos lado a lado ou empilhados verticalmente. O parâmetro option pode ser usado para passar informações extras sobre o widget pai. O parâmetro widget é opcional e pode ser usado também se  option for 0.
Essa função é chamada pelo sistema de layout. É usada apenas se PM_LayoutHorizontalSpacing ou PM_LayoutVerticalSpacing retornarem um valor negativo.
Por razões de compatibilidade, essa função não é virtual. Se vocÊ quiser especificar um espaçamento personalizado em uma sub-classe QStyle subclass, implemente um slot chamado layoutSpacingImplementation(). QStyle irá descobrir o slot durante a execução (usando o sistema de meta objetos do Qt) e direcionará todas as chamadas de  layoutSpacing() para layoutSpacingImplementation().

int QStyle::layoutSpacingImplementation ( QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, constQStyleOption * option = 0, const QWidget * widget = 0 ) const [protected slot]


Esse slot é chamado por layoutSpacing() para determinar o espaçamento que deve ser usado entre control1 e control2 em um layout. orientation especifica se os controles são dispostos lado a lado ou empilhados verticalmente. O parâmetro option pode ser usado para passar informações extras sobre o widget pai. O parâmetro widget é opcional e pode ser usado também se option for 0.
Se você quiser fornecer um espaçamento personalizado para um sub-classe do QStyle, implemente um slot chamado layoutSpacingImplementation() em sua sub-classe. Fique ciente de que esse slot é chamado apenas se PM_LayoutHorizontalSpacing or PM_LayoutVerticalSpacing retornarem um valor negativo.
A implementação padrão retorna -1.

int QStyle::pixelMetric ( PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const [pure virtual]


Retorna o valor da métrica de pixel dada.
Os parâmetros option e widget podem ser usados para calcular a métrica. Em geral, o argumento widget não é usado. O argumento option pode lançar o tipo apropriado usando a função qstyleoption_cast(). Observe que option pode ser zero mesmo para PixelMetrics que pode fazer uso dele. Veja a tabela abaixo para a option apropriada:

Pixel Metric QStyleOption Subclass
PM_SliderControlThickness QStyleOptionSlider
PM_SliderLength QStyleOptionSlider
PM_SliderTickmarkOffset QStyleOptionSlider
PM_SliderSpaceAvailable QStyleOptionSlider
PM_ScrollBarExtent QStyleOptionSlider
PM_TabBarTabOverlap QStyleOptionTab
PM_TabBarTabHSpace QStyleOptionTab
PM_TabBarTabVSpace QStyleOptionTab
PM_TabBarBaseHeight QStyleOptionTab
PM_TabBarBaseOverlap QStyleOptionTab

Algumas métricas de pixel são chamadas pelos widgets e algumas são chamadas apenas internamente pelo estilo. Se a métrica não for chamada por um widget, fica a critério do autor do estilo usa-la. Para alguns estilos, isso pode não ser adequado.

void QStyle::polish ( QWidget * widget ) [virtual]


Inicializa a aparência do widget.
Essa função é chamada para cada widget em algum ponto depois de ter sido totalmente criado mas antes de ser exibido pela primeira vez.
Observe que a implementação padrão não faz nada. As ações razoáveis para essa função podem ser chamar a função QWidget::setBackgroundMode() para o widget. Não use a função para ajustar, por exemplo, a geometria. A re-implementação dessa função fornece uma porta dos fundos pela qual a aparência do widget pode ser alterada, mas com o engine do Qt é raramente necessário implementar essa função; reimplemente drawItemPixmap(), drawItemText(), drawPrimitive(), etc. ao invés disso.
A função QWidget::inherits() pode fornecer informações suficientes para permitir personalizações específicas de classe. Mas por as novas sub-classes de QStyle serem experadas funcionarem bem com todos os widgets, limitar o uso de personalizações direto no código é recomendado.

void QStyle::polish ( QApplication * application ) [virtual]

Essa é uma função sobrecarregada.
Inicialização tardia do objeto application.

void QStyle::polish ( QPalette & palette ) [virtual]

Essa é uma função sobrecarregada.
Muda a paleta de acordo com os requisitos específicos do estilo para paletas de cores.

const QStyle * QStyle::proxy () const


Essa função retorna o proxy atual para esse estilo. Por padrão, muitos estilos retornarão eles mesmos. Porém, quando um proxy é usado, ele não permitirá que o estilo chame seu proxy.

QSize QStyle::sizeFromContents ( ContentsType type, const QStyleOption * option, const QSize & contentsSize, const QWidget * widget = 0 ) const[pure virtual]

Retorna o tamanho do elemento descrito pelos parâmetros option e type especificados, baseado no contentsSize fornecido.
O argumento option é um ponteiro para um QStyleOption ou uma de suas sub-classes. Ele pode lançar o tipo apropriado usando a função qstyleoption_cast(). O widget é um argumento opcional e pode conter informação extra usada para calcular o tamanho.
Veja na tabela abaixo para as opções apropriadas:

Contents Type QStyleOption Subclass
CT_PushButton QStyleOptionButton
CT_CheckBox QStyleOptionButton
CT_RadioButton QStyleOptionButton
CT_ToolButton QStyleOptionToolButton
CT_ComboBox QStyleOptionComboBox
CT_Splitter QStyleOption
CT_Q3DockWindow QStyleOptionQ3DockWindow
CT_ProgressBar QStyleOptionProgressBar
CT_MenuItem QStyleOptionMenuItem

int QStyle::sliderPositionFromValue ( int min, int max, int logicalValue, int span, bool upsideDown = false ) [static]

Converte o valor de logicalValue para uma posição de pixel. O parâmetro min é mapeado para 0, max é mapeado para span e outros valores são distribuidos nesse intervalo.
Essa função pode manipular toda a faixa de inteiros sem overflow, fazendo que esse span seja menor que que 4096.
Por padrão, essa função assume que o valor máximo está a direita para itens horizontais e na parte inferior para itens verticais. Ajuste o parâmetro upsideDown para true para inverter esse comportamento.

int QStyle::sliderValueFromPosition ( int min, int max, int position, int span, bool upsideDown = false ) [static]

Converte o valor de postion dado para um valor lógico. 0 é mapeado no parâmetro min, span mapeia max e os outros valores são distribuídos pelo intervalo.
Essa função pode manipular toda a faixa de inteiros sem overflow.
Por padrão, essa função assume que o valor máximo está a direita para itens horizontais e na parte inferior para itens verticais. Ajuste o parâmetro upsideDown para true para inverter esse comportamento.

QIcon QStyle::standardIcon ( StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0 ) const

Retorna um ícone para o standartIcon dado.
O standartIcon é o pixmap padrão que pode seguir algum estilo ou guia gráfico existente. O argumento option pode ser usado para passar informações extras necessárias quando for definir o ícone apropriado. O argumento widget é opcional e pode ser usado também para ajudar a determinar o ícone.
Por causa de restrições referentes a compatibilidade binária, essa função não é virtual. Se quiser fornecer seus próprios ícones em uma sub-classe QStyle, re-implemente o slot standardIconImplementation() em sua sub-classe. A função standartIcon() irá detectar dinamicamente o slot e irá chama-lo.

QIcon QStyle::standardIconImplementation ( StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0 ) const[protected slot]

Retorna o ícone para o standartICon dado.
Reimplemente esse slot para fornecer seus próprios ícones em uma sub-classe QStyle; por causa de restrições relativas a compatibilidade binária, a função standardIcon() não é virtual. Ao invés disso, standardIcon() irá automaticamente detectar e chamar esse slot.
standartIcon é o pixmap padrão que pode seguir algum estilo ou guia gráfico existente. O argumento option pode ser usado para passar informações extras necessárias quando for definir o ícone apropriado. O argumento widget é opcional e pode ser usado também para ajudar a determinar o ícone.

QPalette QStyle::standardPalette () const [virtual]

Retorna a paleta padrão do estilo.
Note que em sistemas que suportem cores do sistema, a paleta padrão do estilo não é usada. Em particular, os estilos do Windows XP, Vista e Mac não usam a paleta padrão, mas fazem uso de mecanismos de tema nativos. Com esses estilos você não pode ajustar a paleta com QApplication::setStandardPalette().

int QStyle::styleHint ( StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0 ) const[pure virtual]

Retorna um inteiro que representa a dica de estilo especifico para o widget descrito pela opção de estilo fornecida.

QRect QStyle::subControlRect ( ComplexControl control, const QStyleOptionComplex * option, SubControl subControl, const QWidget * widget = 0 ) const [pure virtual]

Retorna o retângulo contendo o subControl especificado do controle complexo dado (com o estilo especificado pela opção fornecida). O retângulo é definido em coordenadas da tela.
O argumento option é um ponteiro para QStyleOptionComplex ou uma de suas sub-classes, e pode lançar o tipo apropriado usando a função qstyleoption_cast(). O parâmetro widget é opcional e pode conter informações adicionais para a função.

QRect QStyle::subElementRect ( SubElement element, const QStyleOption * option, const QWidget * widget = 0 ) const [pure virtual]

Retorna a sub-área para o element dado como descrito pela opção de estilo fornecida. O retângulo retornado é definido em coordenadas de tela.
O argumento widget é opcional e pode ser usado como uma ajuda paradeterminar a área. O objeto QStyleOption pode lançar o tipo apropriado usando a função  qstyleoption_cast(). Veja a tabela abaixo para os lançamentos apropriados de opções:

Sub Element QStyleOption Subclass
SE_PushButtonContents QStyleOptionButton
SE_PushButtonFocusRect QStyleOptionButton
SE_CheckBoxIndicator QStyleOptionButton
SE_CheckBoxContents QStyleOptionButton
SE_CheckBoxFocusRect QStyleOptionButton
SE_RadioButtonIndicator QStyleOptionButton
SE_RadioButtonContents QStyleOptionButton
SE_RadioButtonFocusRect QStyleOptionButton
SE_ComboBoxFocusRect QStyleOptionComboBox
SE_Q3DockWindowHandleRect QStyleOptionQ3DockWindow
SE_ProgressBarGroove QStyleOptionProgressBar
SE_ProgressBarContents QStyleOptionProgressBar
SE_ProgressBarLabel QStyleOptionProgressBar

void QStyle::unpolish ( QWidget * widget ) [virtual]

Des-inicializa a aparência do widget dado.
Essa função é contra-parte de polish(). É chamada para cada widget polido toda vez que o estilo é alterado dinamicamente; o estilo anterior tem que despolir seus ajustes antes que o novo estilo possa polir novamente.
Observe que unpolish() apenas será chamado se o widget for destruído. Isso pode causar problemas em alguns casos, exemplo, se você remover um widget da interface, por ele no cache, e depois reinseri-lo depois que o estilo tiver sido alterado; algumas classes do Qt poem seus widgets em cache.

void QStyle::unpolish ( QApplication * application ) [virtual]

Essa é uma função sobrecarregada. Des-inicializa a  application dada.

Qt::Alignment QStyle::visualAlignment ( Qt::LayoutDirection direction, Qt::Alignment alignment ) [static]

Transforma um alignment de Qt::AlignLeft ou Qt::AlignRight sem Qt::AlignAbsolute em Qt::AlignLeft ou Qt::AlignRight com Qt::AlignAbsolute de acordo com a direction do layout. As demais flags de alinhamento são intocáveis.
Se nenhum alinhamento horizontal for especificado, a função retorna o alinhamento padrão para a  direction do layout.

QPoint QStyle::visualPos ( Qt::LayoutDirection direction, const QRect & boundingRectangle, const QPoint & logicalPosition ) [static]

Retorna a logicalPosition convertida para coordenadas de tela baseadas na direction especificada. O parâmetro boundingRectangle é usado para executar a tradução.

QRect QStyle::visualRect ( Qt::LayoutDirection direction, const QRect & boundingRectangle, const QRect & logicalRectangle ) [static]

Retorna a logicalRectangle convertidas para coordenadas de tela baseadas na direction especificada. O parâmetro boundingRectangle é usado para executar a tradução.
Essa função é fornecido para suporta desktops da direita para a esquerda, e tipicamente é usada nas implementações da função  subControlRect().

Traduzido de http://doc.trolltech.com/4.7/qstyle.html