Qt 4.8
Public Functions | Protected Slots | Properties | Friends | List of all members
QWindowsXPStyle Class Reference

The QWindowsXPStyle class provides a Microsoft Windows XP-like look and feel. More...

#include <qwindowsxpstyle.h>

Inheritance diagram for QWindowsXPStyle:
QWindowsStyle QCommonStyle QStyle QObject QWindowsVistaStyle

Public Functions

void drawComplexControl (ComplexControl cc, const QStyleOptionComplex *option, QPainter *p, const QWidget *widget=0) const
 Reimplemented Function More...
 
void drawControl (ControlElement element, const QStyleOption *option, QPainter *p, const QWidget *wwidget=0) const
 Reimplemented Function More...
 
void drawPrimitive (PrimitiveElement pe, const QStyleOption *option, QPainter *p, const QWidget *widget=0) const
 Reimplemented Function More...
 
int pixelMetric (PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
 Reimplemented Function More...
 
void polish (QApplication *)
 Reimplemented Function More...
 
void polish (QWidget *)
 Reimplemented Function More...
 
void polish (QPalette &)
 Reimplemented Function More...
 
 QWindowsXPStyle ()
 Constructs a QWindowsStyle. More...
 
 QWindowsXPStyle (QWindowsXPStylePrivate &dd)
 Constructs a QWindowsXPStyle object. More...
 
QSize sizeFromContents (ContentsType ct, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget=0) const
 Reimplemented Function More...
 
QPalette standardPalette () const
 Reimplemented Function More...
 
QPixmap standardPixmap (StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget=0) const
 Reimplemented Function More...
 
int styleHint (StyleHint hint, const QStyleOption *option=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
 Reimplemented Function More...
 
QRect subControlRect (ComplexControl cc, const QStyleOptionComplex *option, SubControl sc, const QWidget *widget=0) const
 Reimplemented Function More...
 
QRect subElementRect (SubElement r, const QStyleOption *option, const QWidget *widget=0) const
 Reimplemented Function More...
 
void unpolish (QApplication *)
 Reimplemented Function More...
 
void unpolish (QWidget *)
 Reimplemented Function More...
 
 ~QWindowsXPStyle ()
 Destroys the style. More...
 
- Public Functions inherited from QWindowsStyle
 QWindowsStyle ()
 Constructs a QWindowsStyle object. More...
 
 ~QWindowsStyle ()
 Destroys the QWindowsStyle object. More...
 
- Public Functions inherited from QCommonStyle
QPixmap generatedIconPixmap (QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
 Reimplemented Function More...
 
SubControl hitTestComplexControl (ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=0) const
 Reimplemented Function More...
 
 QCommonStyle ()
 Constructs a QCommonStyle. More...
 
 ~QCommonStyle ()
 Destroys the style. More...
 
- Public Functions inherited from QStyle
int combinedLayoutSpacing (QSizePolicy::ControlTypes controls1, QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, QStyleOption *option=0, QWidget *widget=0) const
 Returns the spacing that should be used between controls1 and controls2 in a layout. More...
 
virtual void drawItemPixmap (QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
 Draws the given pixmap in the specified rectangle, according to the specified alignment, using the provided painter. More...
 
virtual void drawItemText (QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
 Draws the given text in the specified rectangle using the provided painter and palette. More...
 
virtual QRect itemPixmapRect (const QRect &r, int flags, const QPixmap &pixmap) const
 Returns the area within the given rectangle in which to draw the specified pixmap according to the defined alignment. More...
 
virtual QRect itemTextRect (const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const
 Returns the area within the given rectangle in which to draw the provided text according to the specified font metrics and alignment. More...
 
int layoutSpacing (QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=0, const QWidget *widget=0) const
 Returns the spacing that should be used between control1 and control2 in a layout. More...
 
const QStyleproxy () const
 
 QStyle ()
 Constructs a style object. More...
 
QIcon standardIcon (StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
 Returns an icon for the given standardIcon. More...
 
virtual ~QStyle ()
 Destroys the style object. More...
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Protected Slots

QIcon standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget=0) const
 
- Protected Slots inherited from QWindowsStyle
QIcon standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget=0) const
 
- Protected Slots inherited from QCommonStyle
QIcon standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *opt=0, const QWidget *widget=0) const
 
- Protected Slots inherited from QStyle
int layoutSpacingImplementation (QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=0, const QWidget *widget=0) const
 This slot is called by layoutSpacing() to determine the spacing that should be used between control1 and control2 in a layout. More...
 
QIcon standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *opt=0, const QWidget *widget=0) const
 Returns an icon for the given standardIcon. More...
 

Properties

void * reserved
 

Friends

class QStyleFactory
 

Additional Inherited Members

- Public Types inherited from QStyle
enum  ComplexControl {
  CC_SpinBox, CC_ComboBox, CC_ScrollBar, CC_Slider,
  CC_ToolButton, CC_TitleBar, CC_Q3ListView, CC_Dial,
  CC_GroupBox, CC_MdiControls, CC_CustomBase = 0xf0000000
}
 This enum describes the available complex controls. More...
 
enum  ContentsType {
  CT_PushButton, CT_CheckBox, CT_RadioButton, CT_ToolButton,
  CT_ComboBox, CT_Splitter, CT_Q3DockWindow, CT_ProgressBar,
  CT_MenuItem, CT_MenuBarItem, CT_MenuBar, CT_Menu,
  CT_TabBarTab, CT_Slider, CT_ScrollBar, CT_Q3Header,
  CT_LineEdit, CT_SpinBox, CT_SizeGrip, CT_TabWidget,
  CT_DialogButtons, CT_HeaderSection, CT_GroupBox, CT_MdiControls,
  CT_ItemViewItem, CT_CustomBase = 0xf0000000
}
 This enum describes the available contents types. More...
 
enum  ControlElement {
  CE_PushButton, CE_PushButtonBevel, CE_PushButtonLabel, CE_CheckBox,
  CE_CheckBoxLabel, CE_RadioButton, CE_RadioButtonLabel, CE_TabBarTab,
  CE_TabBarTabShape, CE_TabBarTabLabel, CE_ProgressBar, CE_ProgressBarGroove,
  CE_ProgressBarContents, CE_ProgressBarLabel, CE_MenuItem, CE_MenuScroller,
  CE_MenuVMargin, CE_MenuHMargin, CE_MenuTearoff, CE_MenuEmptyArea,
  CE_MenuBarItem, CE_MenuBarEmptyArea, CE_ToolButtonLabel, CE_Header,
  CE_HeaderSection, CE_HeaderLabel, CE_Q3DockWindowEmptyArea, CE_ToolBoxTab,
  CE_SizeGrip, CE_Splitter, CE_RubberBand, CE_DockWidgetTitle,
  CE_ScrollBarAddLine, CE_ScrollBarSubLine, CE_ScrollBarAddPage, CE_ScrollBarSubPage,
  CE_ScrollBarSlider, CE_ScrollBarFirst, CE_ScrollBarLast, CE_FocusFrame,
  CE_ComboBoxLabel, CE_ToolBar, CE_ToolBoxTabShape, CE_ToolBoxTabLabel,
  CE_HeaderEmptyArea, CE_ColumnViewGrip, CE_ItemViewItem, CE_ShapedFrame,
  CE_CustomBase = 0xf0000000
}
 This enum represents a control element. More...
 
enum  PixelMetric {
  PM_ButtonMargin, PM_ButtonDefaultIndicator, PM_MenuButtonIndicator, PM_ButtonShiftHorizontal,
  PM_ButtonShiftVertical, PM_DefaultFrameWidth, PM_SpinBoxFrameWidth, PM_ComboBoxFrameWidth,
  PM_MaximumDragDistance, PM_ScrollBarExtent, PM_ScrollBarSliderMin, PM_SliderThickness,
  PM_SliderControlThickness, PM_SliderLength, PM_SliderTickmarkOffset, PM_SliderSpaceAvailable,
  PM_DockWidgetSeparatorExtent, PM_DockWidgetHandleExtent, PM_DockWidgetFrameWidth, PM_TabBarTabOverlap,
  PM_TabBarTabHSpace, PM_TabBarTabVSpace, PM_TabBarBaseHeight, PM_TabBarBaseOverlap,
  PM_ProgressBarChunkWidth, PM_SplitterWidth, PM_TitleBarHeight, PM_MenuScrollerHeight,
  PM_MenuHMargin, PM_MenuVMargin, PM_MenuPanelWidth, PM_MenuTearoffHeight,
  PM_MenuDesktopFrameWidth, PM_MenuBarPanelWidth, PM_MenuBarItemSpacing, PM_MenuBarVMargin,
  PM_MenuBarHMargin, PM_IndicatorWidth, PM_IndicatorHeight, PM_ExclusiveIndicatorWidth,
  PM_ExclusiveIndicatorHeight, PM_CheckListButtonSize, PM_CheckListControllerSize, PM_DialogButtonsSeparator,
  PM_DialogButtonsButtonWidth, PM_DialogButtonsButtonHeight, PM_MdiSubWindowFrameWidth, PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth,
  PM_MdiSubWindowMinimizedWidth, PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth, PM_HeaderMargin, PM_HeaderMarkSize,
  PM_HeaderGripMargin, PM_TabBarTabShiftHorizontal, PM_TabBarTabShiftVertical, PM_TabBarScrollButtonWidth,
  PM_ToolBarFrameWidth, PM_ToolBarHandleExtent, PM_ToolBarItemSpacing, PM_ToolBarItemMargin,
  PM_ToolBarSeparatorExtent, PM_ToolBarExtensionExtent, PM_SpinBoxSliderHeight, PM_DefaultTopLevelMargin,
  PM_DefaultChildMargin, PM_DefaultLayoutSpacing, PM_ToolBarIconSize, PM_ListViewIconSize,
  PM_IconViewIconSize, PM_SmallIconSize, PM_LargeIconSize, PM_FocusFrameVMargin,
  PM_FocusFrameHMargin, PM_ToolTipLabelFrameWidth, PM_CheckBoxLabelSpacing, PM_TabBarIconSize,
  PM_SizeGripSize, PM_DockWidgetTitleMargin, PM_MessageBoxIconSize, PM_ButtonIconSize,
  PM_DockWidgetTitleBarButtonMargin, PM_RadioButtonLabelSpacing, PM_LayoutLeftMargin, PM_LayoutTopMargin,
  PM_LayoutRightMargin, PM_LayoutBottomMargin, PM_LayoutHorizontalSpacing, PM_LayoutVerticalSpacing,
  PM_TabBar_ScrollButtonOverlap, PM_TextCursorWidth, PM_TabCloseIndicatorWidth, PM_TabCloseIndicatorHeight,
  PM_ScrollView_ScrollBarSpacing, PM_SubMenuOverlap, PM_CustomBase = 0xf0000000
}
 This enum describes the various available pixel metrics. More...
 
enum  PrimitiveElement {
  PE_Q3CheckListController, PE_Q3CheckListExclusiveIndicator, PE_Q3CheckListIndicator, PE_Q3DockWindowSeparator,
  PE_Q3Separator, PE_Frame, PE_FrameDefaultButton, PE_FrameDockWidget,
  PE_FrameFocusRect, PE_FrameGroupBox, PE_FrameLineEdit, PE_FrameMenu,
  PE_FrameStatusBar, PE_FrameStatusBarItem = PE_FrameStatusBar, PE_FrameTabWidget, PE_FrameWindow,
  PE_FrameButtonBevel, PE_FrameButtonTool, PE_FrameTabBarBase, PE_PanelButtonCommand,
  PE_PanelButtonBevel, PE_PanelButtonTool, PE_PanelMenuBar, PE_PanelToolBar,
  PE_PanelLineEdit, PE_IndicatorArrowDown, PE_IndicatorArrowLeft, PE_IndicatorArrowRight,
  PE_IndicatorArrowUp, PE_IndicatorBranch, PE_IndicatorButtonDropDown, PE_IndicatorViewItemCheck,
  PE_IndicatorItemViewItemCheck = PE_IndicatorViewItemCheck, PE_IndicatorCheckBox, PE_IndicatorDockWidgetResizeHandle, PE_IndicatorHeaderArrow,
  PE_IndicatorMenuCheckMark, PE_IndicatorProgressChunk, PE_IndicatorRadioButton, PE_IndicatorSpinDown,
  PE_IndicatorSpinMinus, PE_IndicatorSpinPlus, PE_IndicatorSpinUp, PE_IndicatorToolBarHandle,
  PE_IndicatorToolBarSeparator, PE_PanelTipLabel, PE_IndicatorTabTear, PE_PanelScrollAreaCorner,
  PE_Widget, PE_IndicatorColumnViewArrow, PE_IndicatorItemViewItemDrop, PE_PanelItemViewItem,
  PE_PanelItemViewRow, PE_PanelStatusBar, PE_IndicatorTabClose, PE_PanelMenu,
  PE_CustomBase = 0xf000000
}
 This enum describes the various primitive elements. More...
 
enum  RequestSoftwareInputPanel { RSIP_OnMouseClickAndAlreadyFocused, RSIP_OnMouseClick }
 This enum describes under what circumstances a software input panel will be requested by input capable widgets. More...
 
enum  StandardPixmap {
  SP_TitleBarMenuButton, SP_TitleBarMinButton, SP_TitleBarMaxButton, SP_TitleBarCloseButton,
  SP_TitleBarNormalButton, SP_TitleBarShadeButton, SP_TitleBarUnshadeButton, SP_TitleBarContextHelpButton,
  SP_DockWidgetCloseButton, SP_MessageBoxInformation, SP_MessageBoxWarning, SP_MessageBoxCritical,
  SP_MessageBoxQuestion, SP_DesktopIcon, SP_TrashIcon, SP_ComputerIcon,
  SP_DriveFDIcon, SP_DriveHDIcon, SP_DriveCDIcon, SP_DriveDVDIcon,
  SP_DriveNetIcon, SP_DirOpenIcon, SP_DirClosedIcon, SP_DirLinkIcon,
  SP_FileIcon, SP_FileLinkIcon, SP_ToolBarHorizontalExtensionButton, SP_ToolBarVerticalExtensionButton,
  SP_FileDialogStart, SP_FileDialogEnd, SP_FileDialogToParent, SP_FileDialogNewFolder,
  SP_FileDialogDetailedView, SP_FileDialogInfoView, SP_FileDialogContentsView, SP_FileDialogListView,
  SP_FileDialogBack, SP_DirIcon, SP_DialogOkButton, SP_DialogCancelButton,
  SP_DialogHelpButton, SP_DialogOpenButton, SP_DialogSaveButton, SP_DialogCloseButton,
  SP_DialogApplyButton, SP_DialogResetButton, SP_DialogDiscardButton, SP_DialogYesButton,
  SP_DialogNoButton, SP_ArrowUp, SP_ArrowDown, SP_ArrowLeft,
  SP_ArrowRight, SP_ArrowBack, SP_ArrowForward, SP_DirHomeIcon,
  SP_CommandLink, SP_VistaShield, SP_BrowserReload, SP_BrowserStop,
  SP_MediaPlay, SP_MediaStop, SP_MediaPause, SP_MediaSkipForward,
  SP_MediaSkipBackward, SP_MediaSeekForward, SP_MediaSeekBackward, SP_MediaVolume,
  SP_MediaVolumeMuted, SP_CustomBase = 0xf0000000
}
 This enum describes the available standard pixmaps. More...
 
enum  StateFlag {
  State_None = 0x00000000, State_Enabled = 0x00000001, State_Raised = 0x00000002, State_Sunken = 0x00000004,
  State_Off = 0x00000008, State_NoChange = 0x00000010, State_On = 0x00000020, State_DownArrow = 0x00000040,
  State_Horizontal = 0x00000080, State_HasFocus = 0x00000100, State_Top = 0x00000200, State_Bottom = 0x00000400,
  State_FocusAtBorder = 0x00000800, State_AutoRaise = 0x00001000, State_MouseOver = 0x00002000, State_UpArrow = 0x00004000,
  State_Selected = 0x00008000, State_Active = 0x00010000, State_Window = 0x00020000, State_Open = 0x00040000,
  State_Children = 0x00080000, State_Item = 0x00100000, State_Sibling = 0x00200000, State_Editing = 0x00400000,
  State_KeyboardFocusChange = 0x00800000, State_ReadOnly = 0x02000000, State_Small = 0x04000000, State_Mini = 0x08000000
}
 This enum describes flags that are used when drawing primitive elements. More...
 
enum  StyleHint {
  SH_EtchDisabledText, SH_DitherDisabledText, SH_ScrollBar_MiddleClickAbsolutePosition, SH_ScrollBar_ScrollWhenPointerLeavesControl,
  SH_TabBar_SelectMouseType, SH_TabBar_Alignment, SH_Header_ArrowAlignment, SH_Slider_SnapToValue,
  SH_Slider_SloppyKeyEvents, SH_ProgressDialog_CenterCancelButton, SH_ProgressDialog_TextLabelAlignment, SH_PrintDialog_RightAlignButtons,
  SH_MainWindow_SpaceBelowMenuBar, SH_FontDialog_SelectAssociatedText, SH_Menu_AllowActiveAndDisabled, SH_Menu_SpaceActivatesItem,
  SH_Menu_SubMenuPopupDelay, SH_ScrollView_FrameOnlyAroundContents, SH_MenuBar_AltKeyNavigation, SH_ComboBox_ListMouseTracking,
  SH_Menu_MouseTracking, SH_MenuBar_MouseTracking, SH_ItemView_ChangeHighlightOnFocus, SH_Widget_ShareActivation,
  SH_Workspace_FillSpaceOnMaximize, SH_ComboBox_Popup, SH_TitleBar_NoBorder, SH_Slider_StopMouseOverSlider,
  SH_ScrollBar_StopMouseOverSlider = SH_Slider_StopMouseOverSlider, SH_BlinkCursorWhenTextSelected, SH_RichText_FullWidthSelection, SH_Menu_Scrollable,
  SH_GroupBox_TextLabelVerticalAlignment, SH_GroupBox_TextLabelColor, SH_Menu_SloppySubMenus, SH_Table_GridLineColor,
  SH_LineEdit_PasswordCharacter, SH_DialogButtons_DefaultButton, SH_ToolBox_SelectedPageTitleBold, SH_TabBar_PreferNoArrows,
  SH_ScrollBar_LeftClickAbsolutePosition, SH_Q3ListViewExpand_SelectMouseType, SH_UnderlineShortcut, SH_SpinBox_AnimateButton,
  SH_SpinBox_KeyPressAutoRepeatRate, SH_SpinBox_ClickAutoRepeatRate, SH_Menu_FillScreenWithScroll, SH_ToolTipLabel_Opacity,
  SH_DrawMenuBarSeparator, SH_TitleBar_ModifyNotification, SH_Button_FocusPolicy, SH_MenuBar_DismissOnSecondClick,
  SH_MessageBox_UseBorderForButtonSpacing, SH_TitleBar_AutoRaise, SH_ToolButton_PopupDelay, SH_FocusFrame_Mask,
  SH_RubberBand_Mask, SH_WindowFrame_Mask, SH_SpinControls_DisableOnBounds, SH_Dial_BackgroundRole,
  SH_ComboBox_LayoutDirection, SH_ItemView_EllipsisLocation, SH_ItemView_ShowDecorationSelected, SH_ItemView_ActivateItemOnSingleClick,
  SH_ScrollBar_ContextMenu, SH_ScrollBar_RollBetweenButtons, SH_Slider_AbsoluteSetButtons, SH_Slider_PageSetButtons,
  SH_Menu_KeyboardSearch, SH_TabBar_ElideMode, SH_DialogButtonLayout, SH_ComboBox_PopupFrameStyle,
  SH_MessageBox_TextInteractionFlags, SH_DialogButtonBox_ButtonsHaveIcons, SH_SpellCheckUnderlineStyle, SH_MessageBox_CenterButtons,
  SH_Menu_SelectionWrap, SH_ItemView_MovementWithoutUpdatingSelection, SH_ToolTip_Mask, SH_FocusFrame_AboveWidget,
  SH_TextControl_FocusIndicatorTextCharFormat, SH_WizardStyle, SH_ItemView_ArrowKeysNavigateIntoChildren, SH_Menu_Mask,
  SH_Menu_FlashTriggeredItem, SH_Menu_FadeOutOnHide, SH_SpinBox_ClickAutoRepeatThreshold, SH_ItemView_PaintAlternatingRowColorsForEmptyArea,
  SH_FormLayoutWrapPolicy, SH_TabWidget_DefaultTabPosition, SH_ToolBar_Movable, SH_FormLayoutFieldGrowthPolicy,
  SH_FormLayoutFormAlignment, SH_FormLayoutLabelAlignment, SH_ItemView_DrawDelegateFrame, SH_TabBar_CloseButtonPosition,
  SH_DockWidget_ButtonsHaveFrame, SH_ToolButtonStyle, SH_RequestSoftwareInputPanel, SH_CustomBase = 0xf0000000
}
 This enum describes the available style hints. More...
 
enum  SubControl {
  SC_None = 0x00000000, SC_ScrollBarAddLine = 0x00000001, SC_ScrollBarSubLine = 0x00000002, SC_ScrollBarAddPage = 0x00000004,
  SC_ScrollBarSubPage = 0x00000008, SC_ScrollBarFirst = 0x00000010, SC_ScrollBarLast = 0x00000020, SC_ScrollBarSlider = 0x00000040,
  SC_ScrollBarGroove = 0x00000080, SC_SpinBoxUp = 0x00000001, SC_SpinBoxDown = 0x00000002, SC_SpinBoxFrame = 0x00000004,
  SC_SpinBoxEditField = 0x00000008, SC_ComboBoxFrame = 0x00000001, SC_ComboBoxEditField = 0x00000002, SC_ComboBoxArrow = 0x00000004,
  SC_ComboBoxListBoxPopup = 0x00000008, SC_SliderGroove = 0x00000001, SC_SliderHandle = 0x00000002, SC_SliderTickmarks = 0x00000004,
  SC_ToolButton = 0x00000001, SC_ToolButtonMenu = 0x00000002, SC_TitleBarSysMenu = 0x00000001, SC_TitleBarMinButton = 0x00000002,
  SC_TitleBarMaxButton = 0x00000004, SC_TitleBarCloseButton = 0x00000008, SC_TitleBarNormalButton = 0x00000010, SC_TitleBarShadeButton = 0x00000020,
  SC_TitleBarUnshadeButton = 0x00000040, SC_TitleBarContextHelpButton = 0x00000080, SC_TitleBarLabel = 0x00000100, SC_Q3ListView = 0x00000001,
  SC_Q3ListViewBranch = 0x00000002, SC_Q3ListViewExpand = 0x00000004, SC_DialGroove = 0x00000001, SC_DialHandle = 0x00000002,
  SC_DialTickmarks = 0x00000004, SC_GroupBoxCheckBox = 0x00000001, SC_GroupBoxLabel = 0x00000002, SC_GroupBoxContents = 0x00000004,
  SC_GroupBoxFrame = 0x00000008, SC_MdiMinButton = 0x00000001, SC_MdiNormalButton = 0x00000002, SC_MdiCloseButton = 0x00000004,
  SC_CustomBase = 0xf0000000, SC_All = 0xffffffff
}
 This enum describes the available sub controls. More...
 
enum  SubElement {
  SE_PushButtonContents, SE_PushButtonFocusRect, SE_CheckBoxIndicator, SE_CheckBoxContents,
  SE_CheckBoxFocusRect, SE_CheckBoxClickRect, SE_RadioButtonIndicator, SE_RadioButtonContents,
  SE_RadioButtonFocusRect, SE_RadioButtonClickRect, SE_ComboBoxFocusRect, SE_SliderFocusRect,
  SE_Q3DockWindowHandleRect, SE_ProgressBarGroove, SE_ProgressBarContents, SE_ProgressBarLabel,
  SE_DialogButtonAccept, SE_DialogButtonReject, SE_DialogButtonApply, SE_DialogButtonHelp,
  SE_DialogButtonAll, SE_DialogButtonAbort, SE_DialogButtonIgnore, SE_DialogButtonRetry,
  SE_DialogButtonCustom, SE_ToolBoxTabContents, SE_HeaderLabel, SE_HeaderArrow,
  SE_TabWidgetTabBar, SE_TabWidgetTabPane, SE_TabWidgetTabContents, SE_TabWidgetLeftCorner,
  SE_TabWidgetRightCorner, SE_ViewItemCheckIndicator, SE_ItemViewItemCheckIndicator = SE_ViewItemCheckIndicator, SE_TabBarTearIndicator,
  SE_TreeViewDisclosureItem, SE_LineEditContents, SE_FrameContents, SE_DockWidgetCloseButton,
  SE_DockWidgetFloatButton, SE_DockWidgetTitleBarText, SE_DockWidgetIcon, SE_CheckBoxLayoutItem,
  SE_ComboBoxLayoutItem, SE_DateTimeEditLayoutItem, SE_DialogButtonBoxLayoutItem, SE_LabelLayoutItem,
  SE_ProgressBarLayoutItem, SE_PushButtonLayoutItem, SE_RadioButtonLayoutItem, SE_SliderLayoutItem,
  SE_SpinBoxLayoutItem, SE_ToolButtonLayoutItem, SE_FrameLayoutItem, SE_GroupBoxLayoutItem,
  SE_TabWidgetLayoutItem, SE_ItemViewItemDecoration, SE_ItemViewItemText, SE_ItemViewItemFocusRect,
  SE_TabBarTabLeftButton, SE_TabBarTabRightButton, SE_TabBarTabText, SE_ShapedFrameContents,
  SE_ToolBarHandle, SE_CustomBase = 0xf0000000
}
 This enum represents a sub-area of a widget. More...
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Functions inherited from QStyle
static QRect alignedRect (Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
 Returns a new rectangle of the specified size that is aligned to the given rectangle according to the specified alignment and direction. More...
 
static int sliderPositionFromValue (int min, int max, int val, int space, bool upsideDown=false)
 Converts the given logicalValue to a pixel position. More...
 
static int sliderValueFromPosition (int min, int max, int pos, int space, bool upsideDown=false)
 Converts the given pixel position to a logical value. More...
 
static Qt::Alignment visualAlignment (Qt::LayoutDirection direction, Qt::Alignment alignment)
 Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLeft or Qt::AlignRight with Qt::AlignAbsolute according to the layout direction. More...
 
static QPoint visualPos (Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPos)
 Returns the given logicalPosition converted to screen coordinates based on the specified direction. More...
 
static QRect visualRect (Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
 Returns the given logicalRectangle converted to screen coordinates based on the specified direction. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QWindowsStyle
bool eventFilter (QObject *o, QEvent *e)
 Reimplemented Function More...
 
 QWindowsStyle (QWindowsStylePrivate &dd)
 Constructs a QWindowsStyle object. More...
 
void timerEvent (QTimerEvent *event)
 Reimplemented Function More...
 
- Protected Functions inherited from QCommonStyle
 QCommonStyle (QCommonStylePrivate &dd)
 
- Protected Functions inherited from QStyle
 QStyle (QStylePrivate &dd)
 Constructs a style object. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

The QWindowsXPStyle class provides a Microsoft Windows XP-like look and feel.

Warning
This style is only available on the Windows XP platform because it makes use of Windows XP's style engine.

Most of the functions are documented in the base classes QWindowsStyle, QCommonStyle, and QStyle, but the QWindowsXPStyle overloads of drawComplexControl(), drawControl(), drawControlMask(), drawPrimitive(), proxy()->subControlRect(), and sizeFromContents(), are documented here.

qwindowsxpstyle.png
See also
QMacStyle, QWindowsStyle, QPlastiqueStyle, QCDEStyle, QMotifStyle

Definition at line 56 of file qwindowsxpstyle.h.

Constructors and Destructors

◆ QWindowsXPStyle() [1/2]

QWindowsXPStyle::QWindowsXPStyle ( )

Constructs a QWindowsStyle.

Definition at line 1112 of file qwindowsxpstyle.cpp.

1114 {
1115 }
QWindowsStyle()
Constructs a QWindowsStyle object.

◆ QWindowsXPStyle() [2/2]

QWindowsXPStyle::QWindowsXPStyle ( QWindowsXPStylePrivate dd)

Constructs a QWindowsXPStyle object.

Warning
This function is not part of the public interface.

Definition at line 4044 of file qwindowsxpstyle.cpp.

4044  : QWindowsStyle(dd)
4045 {
4046 }
QWindowsStyle()
Constructs a QWindowsStyle object.

◆ ~QWindowsXPStyle()

QWindowsXPStyle::~QWindowsXPStyle ( )

Destroys the style.

Definition at line 1120 of file qwindowsxpstyle.cpp.

1121 {
1122 }

Functions

◆ drawComplexControl()

void QWindowsXPStyle::drawComplexControl ( ComplexControl  cc,
const QStyleOptionComplex option,
QPainter p,
const QWidget widget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 2491 of file qwindowsxpstyle.cpp.

Referenced by QWindowsVistaStyle::drawComplexControl().

2493 {
2494  QWindowsXPStylePrivate *d = const_cast<QWindowsXPStylePrivate*>(d_func());
2495 
2497  QWindowsStyle::drawComplexControl(cc, option, p, widget);
2498  return;
2499  }
2500 
2501  State flags = option->state;
2502  SubControls sub = option->subControls;
2503  QRect r = option->rect;
2504 
2505  int partId = 0;
2506  int stateId = 0;
2507  if (widget && widget->testAttribute(Qt::WA_UnderMouse) && widget->isActiveWindow())
2508  flags |= State_MouseOver;
2509 
2510  switch (cc) {
2511 #ifndef QT_NO_SPINBOX
2512  case CC_SpinBox:
2513  if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option))
2514  {
2515  XPThemeData theme(widget, p, QLatin1String("SPIN"));
2516 
2517  if (sb->frame && (sub & SC_SpinBoxFrame)) {
2518  partId = EP_EDITTEXT;
2519  if (!(flags & State_Enabled))
2520  stateId = ETS_DISABLED;
2521  else if (flags & State_HasFocus)
2522  stateId = ETS_FOCUSED;
2523  else
2524  stateId = ETS_NORMAL;
2525 
2526  XPThemeData ftheme(widget, p, QLatin1String("EDIT"), partId, stateId, r);
2527  ftheme.noContent = true;
2528  d->drawBackground(ftheme);
2529  }
2530  if (sub & SC_SpinBoxUp) {
2531  theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
2532  partId = SPNP_UP;
2533  if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled))
2534  stateId = UPS_DISABLED;
2535  else if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken))
2536  stateId = UPS_PRESSED;
2537  else if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_MouseOver))
2538  stateId = UPS_HOT;
2539  else
2540  stateId = UPS_NORMAL;
2541  theme.partId = partId;
2542  theme.stateId = stateId;
2543  d->drawBackground(theme);
2544  }
2545  if (sub & SC_SpinBoxDown) {
2546  theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
2547  partId = SPNP_DOWN;
2548  if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) || !(flags & State_Enabled))
2549  stateId = DNS_DISABLED;
2550  else if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken))
2551  stateId = DNS_PRESSED;
2552  else if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_MouseOver))
2553  stateId = DNS_HOT;
2554  else
2555  stateId = DNS_NORMAL;
2556  theme.partId = partId;
2557  theme.stateId = stateId;
2558  d->drawBackground(theme);
2559  }
2560  }
2561  break;
2562 #endif // QT_NO_SPINBOX
2563 #ifndef QT_NO_COMBOBOX
2564  case CC_ComboBox:
2565  if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option))
2566  {
2567  if (sub & SC_ComboBoxEditField) {
2568  if (cmb->frame) {
2569  partId = EP_EDITTEXT;
2570  if (!(flags & State_Enabled))
2571  stateId = ETS_DISABLED;
2572  else if (flags & State_HasFocus)
2573  stateId = ETS_FOCUSED;
2574  else
2575  stateId = ETS_NORMAL;
2576  XPThemeData theme(widget, p, QLatin1String("EDIT"), partId, stateId, r);
2577  d->drawBackground(theme);
2578  } else {
2579  QBrush editBrush = cmb->palette.brush(QPalette::Base);
2580  p->fillRect(option->rect, editBrush);
2581  }
2582  if (!cmb->editable) {
2583  QRect re = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget);
2584  if (option->state & State_HasFocus) {
2585  p->fillRect(re, option->palette.highlight());
2586  p->setPen(option->palette.highlightedText().color());
2587  p->setBackground(option->palette.highlight());
2588  } else {
2589  p->fillRect(re, option->palette.base());
2590  p->setPen(option->palette.text().color());
2591  p->setBackground(option->palette.base());
2592  }
2593  }
2594  }
2595 
2596  if (sub & SC_ComboBoxArrow) {
2597  XPThemeData theme(widget, p, QLatin1String("COMBOBOX"));
2598  theme.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
2599  partId = CP_DROPDOWNBUTTON;
2600  if (!(flags & State_Enabled))
2601  stateId = CBXS_DISABLED;
2602  else if (cmb->activeSubControls == SC_ComboBoxArrow && (cmb->state & State_Sunken))
2603  stateId = CBXS_PRESSED;
2604  else if (cmb->activeSubControls == SC_ComboBoxArrow && (cmb->state & State_MouseOver))
2605  stateId = CBXS_HOT;
2606  else
2607  stateId = CBXS_NORMAL;
2608  theme.partId = partId;
2609  theme.stateId = stateId;
2610  d->drawBackground(theme);
2611  }
2612  }
2613  break;
2614 #endif // QT_NO_COMBOBOX
2615  case CC_ScrollBar:
2616  if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option))
2617  {
2618  XPThemeData theme(widget, p, QLatin1String("SCROLLBAR"));
2619  bool maxedOut = (scrollbar->maximum == scrollbar->minimum);
2620  if (maxedOut)
2621  flags &= ~State_Enabled;
2622 
2623  bool isHorz = flags & State_Horizontal;
2624  bool isRTL = option->direction == Qt::RightToLeft;
2625  if (sub & SC_ScrollBarAddLine) {
2626  theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
2627  partId = SBP_ARROWBTN;
2628  if (!(flags & State_Enabled))
2629  stateId = (isHorz ? (isRTL ? ABS_LEFTDISABLED : ABS_RIGHTDISABLED) : ABS_DOWNDISABLED);
2630  else if (scrollbar->activeSubControls & SC_ScrollBarAddLine && (scrollbar->state & State_Sunken))
2631  stateId = (isHorz ? (isRTL ? ABS_LEFTPRESSED : ABS_RIGHTPRESSED) : ABS_DOWNPRESSED);
2632  else if (scrollbar->activeSubControls & SC_ScrollBarAddLine && (scrollbar->state & State_MouseOver))
2633  stateId = (isHorz ? (isRTL ? ABS_LEFTHOT : ABS_RIGHTHOT) : ABS_DOWNHOT);
2634  else
2635  stateId = (isHorz ? (isRTL ? ABS_LEFTNORMAL : ABS_RIGHTNORMAL) : ABS_DOWNNORMAL);
2636  theme.partId = partId;
2637  theme.stateId = stateId;
2638  d->drawBackground(theme);
2639  }
2640  if (sub & SC_ScrollBarSubLine) {
2641  theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
2642  partId = SBP_ARROWBTN;
2643  if (!(flags & State_Enabled))
2644  stateId = (isHorz ? (isRTL ? ABS_RIGHTDISABLED : ABS_LEFTDISABLED) : ABS_UPDISABLED);
2645  else if (scrollbar->activeSubControls & SC_ScrollBarSubLine && (scrollbar->state & State_Sunken))
2646  stateId = (isHorz ? (isRTL ? ABS_RIGHTPRESSED : ABS_LEFTPRESSED) : ABS_UPPRESSED);
2647  else if (scrollbar->activeSubControls & SC_ScrollBarSubLine && (scrollbar->state & State_MouseOver))
2648  stateId = (isHorz ? (isRTL ? ABS_RIGHTHOT : ABS_LEFTHOT) : ABS_UPHOT);
2649  else
2650  stateId = (isHorz ? (isRTL ? ABS_RIGHTNORMAL : ABS_LEFTNORMAL) : ABS_UPNORMAL);
2651  theme.partId = partId;
2652  theme.stateId = stateId;
2653  d->drawBackground(theme);
2654  }
2655  if (maxedOut) {
2656  theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
2657  theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
2658  theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
2659  partId = scrollbar->orientation == Qt::Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
2660  stateId = SCRBS_DISABLED;
2661  theme.partId = partId;
2662  theme.stateId = stateId;
2663  d->drawBackground(theme);
2664  } else {
2665  if (sub & SC_ScrollBarSubPage) {
2666  theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
2667  partId = flags & State_Horizontal ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT;
2668  if (!(flags & State_Enabled))
2669  stateId = SCRBS_DISABLED;
2670  else if (scrollbar->activeSubControls & SC_ScrollBarSubPage && (scrollbar->state & State_Sunken))
2671  stateId = SCRBS_PRESSED;
2672  else if (scrollbar->activeSubControls & SC_ScrollBarSubPage && (scrollbar->state & State_MouseOver))
2673  stateId = SCRBS_HOT;
2674  else
2675  stateId = SCRBS_NORMAL;
2676  theme.partId = partId;
2677  theme.stateId = stateId;
2678  d->drawBackground(theme);
2679  }
2680  if (sub & SC_ScrollBarAddPage) {
2681  theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
2682  partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
2683  if (!(flags & State_Enabled))
2684  stateId = SCRBS_DISABLED;
2685  else if (scrollbar->activeSubControls & SC_ScrollBarAddPage && (scrollbar->state & State_Sunken))
2686  stateId = SCRBS_PRESSED;
2687  else if (scrollbar->activeSubControls & SC_ScrollBarAddPage && (scrollbar->state & State_MouseOver))
2688  stateId = SCRBS_HOT;
2689  else
2690  stateId = SCRBS_NORMAL;
2691  theme.partId = partId;
2692  theme.stateId = stateId;
2693  d->drawBackground(theme);
2694  }
2695  if (sub & SC_ScrollBarSlider) {
2696  theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
2697  if (!(flags & State_Enabled))
2698  stateId = SCRBS_DISABLED;
2699  else if (scrollbar->activeSubControls & SC_ScrollBarSlider && (scrollbar->state & State_Sunken))
2700  stateId = SCRBS_PRESSED;
2701  else if (scrollbar->activeSubControls & SC_ScrollBarSlider && (scrollbar->state & State_MouseOver))
2702  stateId = SCRBS_HOT;
2703  else
2704  stateId = SCRBS_NORMAL;
2705 
2706  // Draw handle
2707  theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
2708  theme.partId = flags & State_Horizontal ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT;
2709  theme.stateId = stateId;
2710  d->drawBackground(theme);
2711 
2712  // Calculate rect of gripper
2713  const int swidth = theme.rect.width();
2714  const int sheight = theme.rect.height();
2715 
2716  MARGINS contentsMargin;
2717  RECT rect = theme.toRECT(theme.rect);
2718  pGetThemeMargins(theme.handle(), 0, theme.partId, theme.stateId, TMT_SIZINGMARGINS, &rect, &contentsMargin);
2719 
2720  SIZE size;
2721  theme.partId = flags & State_Horizontal ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT;
2722  pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
2723  int gw = size.cx, gh = size.cy;
2724 
2725 
2726  QRect gripperBounds;
2727  if (flags & State_Horizontal && ((swidth - contentsMargin.cxLeftWidth - contentsMargin.cxRightWidth) > gw)) {
2728  gripperBounds.setLeft(theme.rect.left() + swidth/2 - gw/2);
2729  gripperBounds.setTop(theme.rect.top() + sheight/2 - gh/2);
2730  gripperBounds.setWidth(gw);
2731  gripperBounds.setHeight(gh);
2732  } else if ((sheight - contentsMargin.cyTopHeight - contentsMargin.cyBottomHeight) > gh) {
2733  gripperBounds.setLeft(theme.rect.left() + swidth/2 - gw/2);
2734  gripperBounds.setTop(theme.rect.top() + sheight/2 - gh/2);
2735  gripperBounds.setWidth(gw);
2736  gripperBounds.setHeight(gh);
2737  }
2738 
2739  // Draw gripper if there is enough space
2740  if (!gripperBounds.isEmpty()) {
2741  p->save();
2742  theme.rect = gripperBounds;
2743  p->setClipRegion(d->region(theme));// Only change inside the region of the gripper
2744  d->drawBackground(theme); // Transparent gripper ontop of background
2745  p->restore();
2746  }
2747  }
2748  }
2749  }
2750  break;
2751 
2752 #ifndef QT_NO_SLIDER
2753  case CC_Slider:
2754  if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option))
2755  {
2756  XPThemeData theme(widget, p, QLatin1String("TRACKBAR"));
2757  QRect slrect = slider->rect;
2758  QRegion tickreg = slrect;
2759  if (sub & SC_SliderGroove) {
2760  theme.rect = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
2761  if (slider->orientation == Qt::Horizontal) {
2762  partId = TKP_TRACK;
2763  stateId = TRS_NORMAL;
2764  theme.rect = QRect(slrect.left(), theme.rect.center().y() - 2, slrect.width(), 4);
2765  } else {
2766  partId = TKP_TRACKVERT;
2767  stateId = TRVS_NORMAL;
2768  theme.rect = QRect(theme.rect.center().x() - 2, slrect.top(), 4, slrect.height());
2769  }
2770  theme.partId = partId;
2771  theme.stateId = stateId;
2772  d->drawBackground(theme);
2773  tickreg -= theme.rect;
2774  }
2775  if (sub & SC_SliderTickmarks) {
2776  int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
2777  int ticks = slider->tickPosition;
2778  int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
2779  int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
2780  int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
2781  int interval = slider->tickInterval;
2782  if (interval <= 0) {
2783  interval = slider->singleStep;
2784  if (QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval,
2785  available)
2786  - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum,
2787  0, available) < 3)
2788  interval = slider->pageStep;
2789  }
2790  if (!interval)
2791  interval = 1;
2792  int fudge = len / 2;
2793  int pos;
2794  int bothOffset = (ticks & QSlider::TicksAbove && ticks & QSlider::TicksBelow) ? 1 : 0;
2795  p->setPen(d->sliderTickColor);
2797  int v = slider->minimum;
2798  while (v <= slider->maximum + 1) {
2799  if (v == slider->maximum + 1 && interval == 1)
2800  break;
2801  const int v_ = qMin(v, slider->maximum);
2802  int tickLength = (v_ == slider->minimum || v_ >= slider->maximum) ? 4 : 3;
2803  pos = QStyle::sliderPositionFromValue(slider->minimum, slider->maximum,
2804  v_, available) + fudge;
2805  if (slider->orientation == Qt::Horizontal) {
2806  if (ticks & QSlider::TicksAbove)
2807  lines.append(QLine(pos, tickOffset - 1 - bothOffset,
2808  pos, tickOffset - 1 - bothOffset - tickLength));
2809 
2810  if (ticks & QSlider::TicksBelow)
2811  lines.append(QLine(pos, tickOffset + thickness + bothOffset,
2812  pos, tickOffset + thickness + bothOffset + tickLength));
2813  } else {
2814  if (ticks & QSlider::TicksAbove)
2815  lines.append(QLine(tickOffset - 1 - bothOffset, pos,
2816  tickOffset - 1 - bothOffset - tickLength, pos));
2817 
2818  if (ticks & QSlider::TicksBelow)
2819  lines.append(QLine(tickOffset + thickness + bothOffset, pos,
2820  tickOffset + thickness + bothOffset + tickLength, pos));
2821  }
2822  // in the case where maximum is max int
2823  int nextInterval = v + interval;
2824  if (nextInterval < v)
2825  break;
2826  v = nextInterval;
2827  }
2828  if (lines.size() > 0) {
2829  p->save();
2830  p->translate(slrect.topLeft());
2831  p->drawLines(lines.constData(), lines.size());
2832  p->restore();
2833  }
2834  }
2835  if (sub & SC_SliderHandle) {
2836  theme.rect = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
2837  if (slider->orientation == Qt::Horizontal) {
2838  if (slider->tickPosition == QSlider::TicksAbove)
2839  partId = TKP_THUMBTOP;
2840  else if (slider->tickPosition == QSlider::TicksBelow)
2841  partId = TKP_THUMBBOTTOM;
2842  else
2843  partId = TKP_THUMB;
2844 
2845  if (!(slider->state & State_Enabled))
2846  stateId = TUS_DISABLED;
2847  else if (slider->activeSubControls & SC_SliderHandle && (slider->state & State_Sunken))
2848  stateId = TUS_PRESSED;
2849  else if (slider->activeSubControls & SC_SliderHandle && (slider->state & State_MouseOver))
2850  stateId = TUS_HOT;
2851  else if (flags & State_HasFocus)
2852  stateId = TUS_FOCUSED;
2853  else
2854  stateId = TUS_NORMAL;
2855  } else {
2856  if (slider->tickPosition == QSlider::TicksLeft)
2857  partId = TKP_THUMBLEFT;
2858  else if (slider->tickPosition == QSlider::TicksRight)
2859  partId = TKP_THUMBRIGHT;
2860  else
2861  partId = TKP_THUMBVERT;
2862 
2863  if (!(slider->state & State_Enabled))
2864  stateId = TUVS_DISABLED;
2865  else if (slider->activeSubControls & SC_SliderHandle && (slider->state & State_Sunken))
2866  stateId = TUVS_PRESSED;
2867  else if (slider->activeSubControls & SC_SliderHandle && (slider->state & State_MouseOver))
2868  stateId = TUVS_HOT;
2869  else if (flags & State_HasFocus)
2870  stateId = TUVS_FOCUSED;
2871  else
2872  stateId = TUVS_NORMAL;
2873  }
2874  theme.partId = partId;
2875  theme.stateId = stateId;
2876  d->drawBackground(theme);
2877  }
2878  if (slider->state & State_HasFocus) {
2879  QStyleOptionFocusRect fropt;
2880  fropt.QStyleOption::operator=(*slider);
2881  fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
2882  proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
2883  }
2884  }
2885  break;
2886 #endif
2887 #ifndef QT_NO_TOOLBUTTON
2888  case CC_ToolButton:
2889  if (const QStyleOptionToolButton *toolbutton
2890  = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
2891  QRect button, menuarea;
2892  button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget);
2893  menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
2894 
2895  State bflags = toolbutton->state & ~State_Sunken;
2896  State mflags = bflags;
2897  bool autoRaise = flags & State_AutoRaise;
2898  if (autoRaise) {
2899  if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) {
2900  bflags &= ~State_Raised;
2901  }
2902  }
2903 
2904  if (toolbutton->state & State_Sunken) {
2905  if (toolbutton->activeSubControls & SC_ToolButton) {
2906  bflags |= State_Sunken;
2907  mflags |= State_MouseOver | State_Sunken;
2908  } else if (toolbutton->activeSubControls & SC_ToolButtonMenu) {
2909  mflags |= State_Sunken;
2910  bflags |= State_MouseOver;
2911  }
2912  }
2913 
2914  QStyleOption tool(0);
2915  tool.palette = toolbutton->palette;
2916  if (toolbutton->subControls & SC_ToolButton) {
2917  if (flags & (State_Sunken | State_On | State_Raised) || !autoRaise) {
2918  if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup && autoRaise) {
2919  XPThemeData theme(widget, p, QLatin1String("TOOLBAR"));
2920  theme.partId = TP_SPLITBUTTON;
2921  theme.rect = button;
2922  if (!(bflags & State_Enabled))
2923  stateId = TS_DISABLED;
2924  else if (bflags & State_Sunken)
2925  stateId = TS_PRESSED;
2926  else if (bflags & State_MouseOver || !(flags & State_AutoRaise))
2927  stateId = flags & State_On ? TS_HOTCHECKED : TS_HOT;
2928  else if (bflags & State_On)
2929  stateId = TS_CHECKED;
2930  else
2931  stateId = TS_NORMAL;
2932  if (option->direction == Qt::RightToLeft)
2933  theme.mirrorHorizontally = true;
2934  theme.stateId = stateId;
2935  d->drawBackground(theme);
2936  } else {
2937  tool.rect = option->rect;
2938  tool.state = bflags;
2939  if (autoRaise) // for tool bars
2940  proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
2941  else
2942  proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, widget);
2943  }
2944  }
2945  }
2946 
2947  if (toolbutton->state & State_HasFocus) {
2949  fr.QStyleOption::operator=(*toolbutton);
2950  fr.rect.adjust(3, 3, -3, -3);
2951  if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
2953  toolbutton, widget), 0);
2954  proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
2955  }
2956  QStyleOptionToolButton label = *toolbutton;
2957  label.state = bflags;
2958  int fw = 2;
2959  if (!autoRaise)
2960  label.state &= ~State_Sunken;
2961  label.rect = button.adjusted(fw, fw, -fw, -fw);
2962  proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
2963 
2964  if (toolbutton->subControls & SC_ToolButtonMenu) {
2965  tool.rect = menuarea;
2966  tool.state = mflags;
2967  if (autoRaise) {
2968  proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
2969  } else {
2970  tool.state = mflags;
2971  menuarea.adjust(-2, 0, 0, 0);
2972  // Draw menu button
2973  if ((bflags & State_Sunken) != (mflags & State_Sunken)){
2974  p->save();
2975  p->setClipRect(menuarea);
2976  tool.rect = option->rect;
2977  proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, 0);
2978  p->restore();
2979  }
2980  // Draw arrow
2981  p->save();
2982  p->setPen(option->palette.dark().color());
2983  p->drawLine(menuarea.left(), menuarea.top() + 3,
2984  menuarea.left(), menuarea.bottom() - 3);
2985  p->setPen(option->palette.light().color());
2986  p->drawLine(menuarea.left() - 1, menuarea.top() + 3,
2987  menuarea.left() - 1, menuarea.bottom() - 3);
2988 
2989  tool.rect = menuarea.adjusted(2, 3, -2, -1);
2990  proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
2991  p->restore();
2992  }
2993  } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
2994  int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
2995  QRect ir = toolbutton->rect;
2996  QStyleOptionToolButton newBtn = *toolbutton;
2997  newBtn.rect = QRect(ir.right() + 4 - mbi, ir.height() - mbi + 4, mbi - 5, mbi - 5);
2998  proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
2999  }
3000  }
3001  break;
3002 #endif // QT_NO_TOOLBUTTON
3003 
3004  case CC_TitleBar:
3005  {
3006  if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option))
3007  {
3008  bool isActive = tb->titleBarState & QStyle::State_Active;
3009  XPThemeData theme(widget, p, QLatin1String("WINDOW"));
3010  if (sub & SC_TitleBarLabel) {
3011 
3012 #ifdef QT3_SUPPORT
3013  if (widget && widget->inherits("Q3DockWindowTitleBar")) {
3014  partId = WP_SMALLCAPTION;
3015  } else
3016 #endif
3017  partId = (tb->titleBarState & Qt::WindowMinimized) ? WP_MINCAPTION : WP_CAPTION;
3018  theme.rect = option->rect;
3019  if (widget && !widget->isEnabled())
3020  stateId = CS_DISABLED;
3021  else if (isActive)
3022  stateId = CS_ACTIVE;
3023  else
3024  stateId = CS_INACTIVE;
3025 
3026  theme.partId = partId;
3027  theme.stateId = stateId;
3028  d->drawBackground(theme);
3029 
3030  QRect ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
3031 
3032  int result = TST_NONE;
3033  pGetThemeEnumValue(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result);
3034  if (result != TST_NONE) {
3035  COLORREF textShadowRef;
3036  pGetThemeColor(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef);
3037  QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef));
3038  p->setPen(textShadow);
3039  p->drawText(ir.x() + 3, ir.y() + 2, ir.width() - 1, ir.height(),
3041  }
3042  COLORREF captionText = GetSysColor(isActive ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT);
3043  QColor textColor = qRgb(GetRValue(captionText), GetGValue(captionText), GetBValue(captionText));
3044  p->setPen(textColor);
3045  p->drawText(ir.x() + 2, ir.y() + 1, ir.width() - 2, ir.height(),
3047  }
3048  if (sub & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
3049  theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarSysMenu, widget);
3050  partId = WP_SYSBUTTON;
3051  if ((widget && !widget->isEnabled()) || !isActive)
3052  stateId = SBS_DISABLED;
3053  else if (option->activeSubControls == SC_TitleBarSysMenu && (option->state & State_Sunken))
3054  stateId = SBS_PUSHED;
3055  else if (option->activeSubControls == SC_TitleBarSysMenu && (option->state & State_MouseOver))
3056  stateId = SBS_HOT;
3057  else
3058  stateId = SBS_NORMAL;
3059  if (!tb->icon.isNull()) {
3060  tb->icon.paint(p, theme.rect);
3061  } else {
3062  theme.partId = partId;
3063  theme.stateId = stateId;
3064  SIZE sz;
3065  pGetThemePartSize(theme.handle(), qt_win_display_dc(), theme.partId, theme.stateId, 0, TS_TRUE, &sz);
3066  if (sz.cx == 0 || sz.cy == 0) {
3067  int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget);
3068  QPixmap pm = proxy()->standardIcon(SP_TitleBarMenuButton, tb, widget).pixmap(iconSize, iconSize);
3069  p->save();
3070  drawItemPixmap(p, theme.rect, Qt::AlignCenter, pm);
3071  p->restore();
3072  } else {
3073  d->drawBackground(theme);
3074  }
3075  }
3076  }
3077 
3078  if (sub & SC_TitleBarMinButton && tb->titleBarFlags & Qt::WindowMinimizeButtonHint
3079  && !(tb->titleBarState & Qt::WindowMinimized)) {
3080  theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarMinButton, widget);
3081  partId = WP_MINBUTTON;
3082  if (widget && !widget->isEnabled())
3083  stateId = MINBS_DISABLED;
3084  else if (option->activeSubControls == SC_TitleBarMinButton && (option->state & State_Sunken))
3085  stateId = MINBS_PUSHED;
3086  else if (option->activeSubControls == SC_TitleBarMinButton && (option->state & State_MouseOver))
3087  stateId = MINBS_HOT;
3088  else if (!isActive)
3089  stateId = MINBS_INACTIVE;
3090  else
3091  stateId = MINBS_NORMAL;
3092  theme.partId = partId;
3093  theme.stateId = stateId;
3094  d->drawBackground(theme);
3095  }
3096  if (sub & SC_TitleBarMaxButton && tb->titleBarFlags & Qt::WindowMaximizeButtonHint
3097  && !(tb->titleBarState & Qt::WindowMaximized)) {
3098  theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarMaxButton, widget);
3099  partId = WP_MAXBUTTON;
3100  if (widget && !widget->isEnabled())
3101  stateId = MAXBS_DISABLED;
3102  else if (option->activeSubControls == SC_TitleBarMaxButton && (option->state & State_Sunken))
3103  stateId = MAXBS_PUSHED;
3104  else if (option->activeSubControls == SC_TitleBarMaxButton && (option->state & State_MouseOver))
3105  stateId = MAXBS_HOT;
3106  else if (!isActive)
3107  stateId = MAXBS_INACTIVE;
3108  else
3109  stateId = MAXBS_NORMAL;
3110  theme.partId = partId;
3111  theme.stateId = stateId;
3112  d->drawBackground(theme);
3113  }
3115  && tb->titleBarFlags & Qt::WindowContextHelpButtonHint) {
3116  theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarContextHelpButton, widget);
3117  partId = WP_HELPBUTTON;
3118  if (widget && !widget->isEnabled())
3119  stateId = MINBS_DISABLED;
3120  else if (option->activeSubControls == SC_TitleBarContextHelpButton && (option->state & State_Sunken))
3121  stateId = MINBS_PUSHED;
3122  else if (option->activeSubControls == SC_TitleBarContextHelpButton && (option->state & State_MouseOver))
3123  stateId = MINBS_HOT;
3124  else if (!isActive)
3125  stateId = MINBS_INACTIVE;
3126  else
3127  stateId = MINBS_NORMAL;
3128  theme.partId = partId;
3129  theme.stateId = stateId;
3130  d->drawBackground(theme);
3131  }
3132  bool drawNormalButton = (sub & SC_TitleBarNormalButton)
3133  && (((tb->titleBarFlags & Qt::WindowMinimizeButtonHint)
3134  && (tb->titleBarState & Qt::WindowMinimized))
3135  || ((tb->titleBarFlags & Qt::WindowMaximizeButtonHint)
3136  && (tb->titleBarState & Qt::WindowMaximized)));
3137  if (drawNormalButton) {
3138  theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarNormalButton, widget);
3139  partId = WP_RESTOREBUTTON;
3140  if (widget && !widget->isEnabled())
3141  stateId = RBS_DISABLED;
3142  else if (option->activeSubControls == SC_TitleBarNormalButton && (option->state & State_Sunken))
3143  stateId = RBS_PUSHED;
3144  else if (option->activeSubControls == SC_TitleBarNormalButton && (option->state & State_MouseOver))
3145  stateId = RBS_HOT;
3146  else if (!isActive)
3147  stateId = RBS_INACTIVE;
3148  else
3149  stateId = RBS_NORMAL;
3150  theme.partId = partId;
3151  theme.stateId = stateId;
3152  d->drawBackground(theme);
3153  }
3154  if (sub & SC_TitleBarShadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint
3155  && !(tb->titleBarState & Qt::WindowMinimized)) {
3156  theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarShadeButton, widget);
3157  partId = WP_MINBUTTON;
3158  if (widget && !widget->isEnabled())
3159  stateId = MINBS_DISABLED;
3160  else if (option->activeSubControls == SC_TitleBarShadeButton && (option->state & State_Sunken))
3161  stateId = MINBS_PUSHED;
3162  else if (option->activeSubControls == SC_TitleBarShadeButton && (option->state & State_MouseOver))
3163  stateId = MINBS_HOT;
3164  else if (!isActive)
3165  stateId = MINBS_INACTIVE;
3166  else
3167  stateId = MINBS_NORMAL;
3168  theme.partId = partId;
3169  theme.stateId = stateId;
3170  d->drawBackground(theme);
3171  }
3172  if (sub & SC_TitleBarUnshadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint
3173  && tb->titleBarState & Qt::WindowMinimized) {
3174  theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarUnshadeButton, widget);
3175  partId = WP_RESTOREBUTTON;
3176  if (widget && !widget->isEnabled())
3177  stateId = RBS_DISABLED;
3178  else if (option->activeSubControls == SC_TitleBarUnshadeButton && (option->state & State_Sunken))
3179  stateId = RBS_PUSHED;
3180  else if (option->activeSubControls == SC_TitleBarUnshadeButton && (option->state & State_MouseOver))
3181  stateId = RBS_HOT;
3182  else if (!isActive)
3183  stateId = RBS_INACTIVE;
3184  else
3185  stateId = RBS_NORMAL;
3186  theme.partId = partId;
3187  theme.stateId = stateId;
3188  d->drawBackground(theme);
3189  }
3190  if (sub & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
3191  theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarCloseButton, widget);
3192  //partId = titlebar->testWFlags(Qt::WA_WState_Tool) ? WP_SMALLCLOSEBUTTON : WP_CLOSEBUTTON;
3193  partId = WP_CLOSEBUTTON;
3194  if (widget && !widget->isEnabled())
3195  stateId = CBS_DISABLED;
3196  else if (option->activeSubControls == SC_TitleBarCloseButton && (option->state & State_Sunken))
3197  stateId = CBS_PUSHED;
3198  else if (option->activeSubControls == SC_TitleBarCloseButton && (option->state & State_MouseOver))
3199  stateId = CBS_HOT;
3200  else if (!isActive)
3201  stateId = CBS_INACTIVE;
3202  else
3203  stateId = CBS_NORMAL;
3204  theme.partId = partId;
3205  theme.stateId = stateId;
3206  d->drawBackground(theme);
3207  }
3208  }
3209  }
3210  break;
3211 
3212 #ifndef QT_NO_WORKSPACE
3213  case CC_MdiControls:
3214  {
3215  QRect buttonRect;
3216  XPThemeData theme(widget, p, QLatin1String("WINDOW"), WP_MDICLOSEBUTTON, CBS_NORMAL);
3217 
3218  if (option->subControls & SC_MdiCloseButton) {
3219  buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiCloseButton, widget);
3220  if (theme.isValid()) {
3221  theme.partId = WP_MDICLOSEBUTTON;
3222  theme.rect = buttonRect;
3223  if (!(flags & State_Enabled))
3224  theme.stateId = CBS_INACTIVE;
3225  else if (flags & State_Sunken && (option->activeSubControls & SC_MdiCloseButton))
3226  theme.stateId = CBS_PUSHED;
3227  else if (flags & State_MouseOver && (option->activeSubControls & SC_MdiCloseButton))
3228  theme.stateId = CBS_HOT;
3229  else
3230  theme.stateId = CBS_NORMAL;
3231  d->drawBackground(theme);
3232  }
3233  }
3234  if (option->subControls & SC_MdiNormalButton) {
3235  buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiNormalButton, widget);
3236  if (theme.isValid()) {
3237  theme.partId = WP_MDIRESTOREBUTTON;
3238  theme.rect = buttonRect;
3239  if (!(flags & State_Enabled))
3240  theme.stateId = CBS_INACTIVE;
3241  else if (flags & State_Sunken && (option->activeSubControls & SC_MdiNormalButton))
3242  theme.stateId = CBS_PUSHED;
3243  else if (flags & State_MouseOver && (option->activeSubControls & SC_MdiNormalButton))
3244  theme.stateId = CBS_HOT;
3245  else
3246  theme.stateId = CBS_NORMAL;
3247  d->drawBackground(theme);
3248  }
3249  }
3250  if (option->subControls & QStyle::SC_MdiMinButton) {
3251  buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiMinButton, widget);
3252  if (theme.isValid()) {
3253  theme.partId = WP_MDIMINBUTTON;
3254  theme.rect = buttonRect;
3255  if (!(flags & State_Enabled))
3256  theme.stateId = CBS_INACTIVE;
3257  else if (flags & State_Sunken && (option->activeSubControls & SC_MdiMinButton))
3258  theme.stateId = CBS_PUSHED;
3259  else if (flags & State_MouseOver && (option->activeSubControls & SC_MdiMinButton))
3260  theme.stateId = CBS_HOT;
3261  else
3262  theme.stateId = CBS_NORMAL;
3263  d->drawBackground(theme);
3264  }
3265  }
3266  }
3267  break;
3268 #endif //QT_NO_WORKSPACE
3269 #ifndef QT_NO_DIAL
3270  case CC_Dial:
3271  if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
3272  QStyleHelper::drawDial(dial, p);
3273  break;
3274 #endif // QT_NO_DIAL
3275  default:
3276  QWindowsStyle::drawComplexControl(cc, option, p, widget);
3277  break;
3278  }
3279 }
static PtrGetThemeEnumValue pGetThemeEnumValue
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
const T * constData() const
const QBrush & highlight() const
Returns the highlight brush of the current color group.
Definition: qpalette.h:140
QRect subElementRect(SubElement r, const QStyleOption *option, const QWidget *widget=0) const
Reimplemented Function
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
void setHeight(int h)
Sets the height of the rectangle to the given height.
Definition: qrect.h:445
const QBrush & base() const
Returns the base brush of the current color group.
Definition: qpalette.h:130
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:57
const QBrush & dark() const
Returns the dark brush of the current color group.
Definition: qpalette.h:127
bool isActiveWindow
whether this widget&#39;s window is the active window
Definition: qwidget.h:186
#define RBS_INACTIVE
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
#define TMT_TEXTSHADOWCOLOR
QRect united(const QRect &other) const
Returns the bounding rectangle of this rectangle and the given rectangle.
Definition: qrect.h:491
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation...
Definition: qpainter.cpp:2801
Q_GUI_EXPORT HDC qt_win_display_dc()
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
void restore()
Restores the current painter state (pops a saved state off the stack).
Definition: qpainter.cpp:1620
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void drawBackground(XPThemeData &themeData)
Main theme drawing function.
QStyle::SubControls activeSubControls
This variable holds a bitwise OR of the sub-controls that are active for the complex control...
Definition: qstyleoption.h:694
void drawLine(const QLineF &line)
Draws a line defined by line.
Definition: qpainter.h:573
static PtrGetThemeColor pGetThemeColor
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *option, SubControl sc, const QWidget *widget=0) const
Reimplemented Function
void append(const T &t)
#define SIZE(large, small, mini)
static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown=false)
Converts the given logicalValue to a pixel position.
Definition: qstyle.cpp:2176
The QStyleOptionToolButton class is used to describe the parameters for drawing a tool button...
Definition: qstyleoption.h:768
void save()
Saves the current painter state (pushes the state onto a stack).
Definition: qpainter.cpp:1590
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
Definition: qpainter.cpp:6231
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
Definition: qstyle.cpp:2327
void drawDial(const QStyleOptionSlider *option, QPainter *painter)
const QBrush & light() const
Returns the light brush of the current color group.
Definition: qpalette.h:126
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
Definition: qpainter.cpp:4873
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
The QStyleOptionSpinBox class is used to describe the parameters necessary for drawing a spin box...
Definition: qstyleoption.h:729
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
Definition: qrect.h:261
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QStyleOptionFocusRect class is used to describe the parameters for drawing a focus rectangle with...
Definition: qstyleoption.h:103
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static PtrGetThemePartSize pGetThemePartSize
The State element defines configurations of objects and properties.
#define MAXBS_INACTIVE
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition: qobject.h:275
bool isEnabled() const
Definition: qwidget.h:948
static PtrGetThemeMargins pGetThemeMargins
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Draws the given pixmap in the specified rectangle, according to the specified alignment, using the provided painter.
Definition: qstyle.cpp:570
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
Definition: qpainter.cpp:2917
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
Definition: qrect.h:258
QRegion region(XPThemeData &themeData)
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
Definition: qpalette.h:141
int pixelMetric(PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
#define TMT_TEXTSHADOWTYPE
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
Definition: qrgb.h:69
static const QStyle::SubControl SubControls[]
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
void setWidth(int w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:442
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static bool useXP(bool update=false)
const QStyle * proxy() const
Definition: qstyle.cpp:2546
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition: qicon.cpp:693
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
Definition: qstyleoption.h:701
#define CBS_INACTIVE
#define TMT_SIZINGMARGINS
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
#define TST_NONE
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
Definition: qstyleoption.h:693
#define MINBS_INACTIVE
void setBackground(const QBrush &bg)
Sets the background brush of the painter to the given brush.
Definition: qpainter.cpp:4258
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420
const QBrush & text() const
Returns the text foreground brush of the current color group.
Definition: qpalette.h:129
int size() const
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
Definition: qpainter.cpp:3311

◆ drawControl()

void QWindowsXPStyle::drawControl ( ControlElement  element,
const QStyleOption option,
QPainter p,
const QWidget wwidget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 1927 of file qwindowsxpstyle.cpp.

Referenced by QWindowsVistaStyle::drawControl().

1929 {
1930  QWindowsXPStylePrivate *d = const_cast<QWindowsXPStylePrivate*>(d_func());
1932  QWindowsStyle::drawControl(element, option, p, widget);
1933  return;
1934  }
1935 
1936  QRect rect(option->rect);
1937  State flags = option->state;
1938 
1939  int rotate = 0;
1940  bool hMirrored = false;
1941  bool vMirrored = false;
1942 
1943  QString name;
1944  int partId = 0;
1945  int stateId = 0;
1946  switch (element) {
1947  case CE_SizeGrip:
1948  {
1949  name = QLatin1String("STATUS");
1950  partId = SP_GRIPPER;
1951  SIZE sz;
1952  XPThemeData theme(0, p, name, partId, 0);
1953  pGetThemePartSize(theme.handle(), 0, partId, 0, 0, TS_TRUE, &sz);
1954  --sz.cy;
1955  if (const QStyleOptionSizeGrip *sg = qstyleoption_cast<const QStyleOptionSizeGrip *>(option)) {
1956  switch (sg->corner) {
1957  case Qt::BottomRightCorner:
1958  rect = QRect(rect.right() - sz.cx, rect.bottom() - sz.cy, sz.cx, sz.cy);
1959  break;
1960  case Qt::BottomLeftCorner:
1961  rect = QRect(rect.left() + 1, rect.bottom() - sz.cy, sz.cx, sz.cy);
1962  hMirrored = true;
1963  break;
1964  case Qt::TopRightCorner:
1965  rect = QRect(rect.right() - sz.cx, rect.top() + 1, sz.cx, sz.cy);
1966  vMirrored = true;
1967  break;
1968  case Qt::TopLeftCorner:
1969  rect = QRect(rect.left() + 1, rect.top() + 1, sz.cx, sz.cy);
1970  hMirrored = vMirrored = true;
1971  }
1972  }
1973  }
1974  break;
1975 
1976  case CE_HeaderSection:
1977  name = QLatin1String("HEADER");
1978  partId = HP_HEADERITEM;
1979  if (flags & State_Sunken)
1980  stateId = HIS_PRESSED;
1981  else if (flags & State_MouseOver)
1982  stateId = HIS_HOT;
1983  else
1984  stateId = HIS_NORMAL;
1985  break;
1986 
1987  case CE_Splitter:
1988  p->eraseRect(option->rect);
1989  return;
1990 
1991  case CE_PushButtonBevel:
1992  if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option))
1993  {
1994  name = QLatin1String("BUTTON");
1995  partId = BP_PUSHBUTTON;
1996  bool justFlat = ((btn->features & QStyleOptionButton::Flat) && !(flags & (State_On|State_Sunken)))
1997  || ((btn->features & QStyleOptionButton::CommandLinkButton)
1998  && !(flags & State_MouseOver)
1999  && !(btn->features & QStyleOptionButton::DefaultButton));
2000  if (!(flags & State_Enabled) && !(btn->features & QStyleOptionButton::Flat))
2001  stateId = PBS_DISABLED;
2002  else if (justFlat)
2003  ;
2004  else if (flags & (State_Sunken | State_On))
2005  stateId = PBS_PRESSED;
2006  else if (flags & State_MouseOver)
2007  stateId = PBS_HOT;
2008  else if (btn->features & QStyleOptionButton::DefaultButton)
2009  stateId = PBS_DEFAULTED;
2010  else
2011  stateId = PBS_NORMAL;
2012 
2013  if (!justFlat) {
2014  XPThemeData theme(widget, p, name, partId, stateId, rect);
2015  d->drawBackground(theme);
2016  }
2017 
2018  if (btn->features & QStyleOptionButton::HasMenu) {
2019  int mbiw = 0, mbih = 0;
2020  XPThemeData theme(widget, 0, QLatin1String("TOOLBAR"), TP_SPLITBUTTONDROPDOWN);
2021  if (theme.isValid()) {
2022  SIZE size;
2023  pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
2024  mbiw = size.cx;
2025  mbih = size.cy;
2026  }
2027 
2028  QRect ir = btn->rect;
2029  QStyleOptionButton newBtn = *btn;
2030  newBtn.rect = QRect(ir.right() - mbiw - 1, 1 + (ir.height()/2) - (mbih/2), mbiw, mbih);
2032  }
2033  return;
2034  }
2035  break;
2036  case CE_TabBarTab:
2037  if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option))
2038  {
2039  stateId = tab->state & State_Enabled ? TIS_NORMAL : TIS_DISABLED;
2040  }
2041  break;
2042 
2043  case CE_TabBarTabShape:
2044  if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option))
2045  {
2046  name = QLatin1String("TAB");
2047  bool isDisabled = !(tab->state & State_Enabled);
2048  bool hasFocus = tab->state & State_HasFocus;
2049  bool isHot = tab->state & State_MouseOver;
2050  bool selected = tab->state & State_Selected;
2051  bool lastTab = tab->position == QStyleOptionTab::End;
2052  bool firstTab = tab->position == QStyleOptionTab::Beginning;
2053  bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
2054  bool leftAligned = proxy()->styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignLeft;
2055  bool centerAligned = proxy()->styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignCenter;
2056  int borderThickness = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
2057  int tabOverlap = proxy()->pixelMetric(PM_TabBarTabOverlap, option, widget);
2058 
2059  if (isDisabled)
2060  stateId = TIS_DISABLED;
2061  else if (selected)
2062  stateId = TIS_SELECTED;
2063  else if (hasFocus)
2064  stateId = TIS_FOCUSED;
2065  else if (isHot)
2066  stateId = TIS_HOT;
2067  else
2068  stateId = TIS_NORMAL;
2069 
2070  // Selecting proper part depending on position
2071  if (firstTab || onlyOne) {
2072  if (leftAligned) {
2073  partId = TABP_TABITEMLEFTEDGE;
2074  } else if (centerAligned) {
2075  partId = TABP_TABITEM;
2076  } else { // rightAligned
2077  partId = TABP_TABITEMRIGHTEDGE;
2078  }
2079  } else {
2080  partId = TABP_TABITEM;
2081  }
2082 
2083  if (tab->direction == Qt::RightToLeft
2084  && (tab->shape == QTabBar::RoundedNorth
2085  || tab->shape == QTabBar::RoundedSouth)) {
2086  bool temp = firstTab;
2087  firstTab = lastTab;
2088  lastTab = temp;
2089  }
2090  bool begin = firstTab || onlyOne;
2091  bool end = lastTab || onlyOne;
2092  switch (tab->shape) {
2093  case QTabBar::RoundedNorth:
2094  if (selected)
2095  rect.adjust(begin ? 0 : -tabOverlap, 0, end ? 0 : tabOverlap, borderThickness);
2096  else
2097  rect.adjust(begin? tabOverlap : 0, tabOverlap, end ? -tabOverlap : 0, 0);
2098  break;
2099  case QTabBar::RoundedSouth:
2100  //vMirrored = true;
2101  rotate = 180; // Not 100% correct, but works
2102  if (selected)
2103  rect.adjust(begin ? 0 : -tabOverlap , -borderThickness, end ? 0 : tabOverlap, 0);
2104  else
2105  rect.adjust(begin ? tabOverlap : 0, 0, end ? -tabOverlap : 0 , -tabOverlap);
2106  break;
2107  case QTabBar::RoundedEast:
2108  rotate = 90;
2109  if (selected) {
2110  rect.adjust(-borderThickness, begin ? 0 : -tabOverlap, 0, end ? 0 : tabOverlap);
2111  }else{
2112  rect.adjust(0, begin ? tabOverlap : 0, -tabOverlap, end ? -tabOverlap : 0);
2113  }
2114  break;
2115  case QTabBar::RoundedWest:
2116  hMirrored = true;
2117  rotate = 90;
2118  if (selected) {
2119  rect.adjust(0, begin ? 0 : -tabOverlap, borderThickness, end ? 0 : tabOverlap);
2120  }else{
2121  rect.adjust(tabOverlap, begin ? tabOverlap : 0, 0, end ? -tabOverlap : 0);
2122  }
2123  break;
2124  default:
2125  name = QLatin1String(""); // Do our own painting for triangular
2126  break;
2127  }
2128 
2129  if (!selected) {
2130  switch (tab->shape) {
2131  case QTabBar::RoundedNorth:
2132  rect.adjust(0,0, 0,-1);
2133  break;
2134  case QTabBar::RoundedSouth:
2135  rect.adjust(0,1, 0,0);
2136  break;
2137  case QTabBar::RoundedEast:
2138  rect.adjust( 1,0, 0,0);
2139  break;
2140  case QTabBar::RoundedWest:
2141  rect.adjust(0,0, -1,0);
2142  break;
2143  default:
2144  break;
2145  }
2146  }
2147  }
2148  break;
2149 
2150  case CE_ProgressBarGroove:
2151  {
2153  if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option))
2154  orient = pb2->orientation;
2155  partId = (orient == Qt::Horizontal) ? PP_BAR : PP_BARVERT;
2156  name = QLatin1String("PROGRESS");
2157  stateId = 1;
2158  }
2159  break;
2160 
2161  case CE_MenuEmptyArea:
2162  case CE_MenuItem:
2163  if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option))
2164  {
2165  int tab = menuitem->tabWidth;
2166  bool dis = !(menuitem->state & State_Enabled);
2167  bool act = menuitem->state & State_Selected;
2168  bool checkable = menuitem->menuHasCheckableItems;
2169  bool checked = checkable ? menuitem->checked : false;
2170 
2171  // windows always has a check column, regardless whether we have an icon or not
2172  int checkcol = qMax(menuitem->maxIconWidth, 12);
2173 
2174  int x, y, w, h;
2175  rect.getRect(&x, &y, &w, &h);
2176 
2177  QBrush fill = menuitem->palette.brush(act ? QPalette::Highlight : QPalette::Button);
2178  p->fillRect(rect, fill);
2179 
2180  if (element == CE_MenuEmptyArea)
2181  break;
2182 
2183  // draw separator -------------------------------------------------
2184  if (menuitem->menuItemType == QStyleOptionMenuItem::Separator) {
2185  int yoff = y-1 + h / 2;
2186  p->setPen(menuitem->palette.dark().color());
2187  p->drawLine(x, yoff, x+w, yoff);
2188  ++yoff;
2189  p->setPen(menuitem->palette.light().color());
2190  p->drawLine(x, yoff, x+w, yoff);
2191  return;
2192  }
2193 
2194  int xpos = x;
2195 
2196  // draw icon ------------------------------------------------------
2197  if (!menuitem->icon.isNull()) {
2198  QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
2199  if (act && !dis)
2200  mode = QIcon::Active;
2201  QPixmap pixmap = checked ?
2202  menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On) :
2203  menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode);
2204  int pixw = pixmap.width();
2205  int pixh = pixmap.height();
2206  QRect iconRect(0, 0, pixw, pixh);
2207  iconRect.moveCenter(QRect(xpos, y, checkcol, h).center());
2208  QRect vIconRect = visualRect(option->direction, option->rect, iconRect);
2209  p->setPen(menuitem->palette.text().color());
2210  p->setBrush(Qt::NoBrush);
2211  if (checked)
2212  p->drawRect(vIconRect.adjusted(-1, -1, 0, 0));
2213  p->drawPixmap(vIconRect.topLeft(), pixmap);
2214 
2215  // draw checkmark -------------------------------------------------
2216  } else if (checked) {
2217  QStyleOptionMenuItem newMi = *menuitem;
2218  newMi.state = State_None;
2219  if (!dis)
2220  newMi.state |= State_Enabled;
2221  if (act)
2222  newMi.state |= State_On;
2223 
2224  QRect checkMarkRect = QRect(menuitem->rect.x() + windowsItemFrame,
2225  menuitem->rect.y() + windowsItemFrame,
2226  checkcol - 2 * windowsItemFrame,
2227  menuitem->rect.height() - 2*windowsItemFrame);
2228  newMi.rect = visualRect(option->direction, option->rect, checkMarkRect);
2230  }
2231 
2232  QColor textColor = dis ? menuitem->palette.text().color() :
2233  act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color();
2234  p->setPen(textColor);
2235 
2236  // draw text ------------------------------------------------------
2237  int xm = windowsItemFrame + checkcol + windowsItemHMargin;
2238  xpos = menuitem->rect.x() + xm;
2239  QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
2240  QRect vTextRect = visualRect(option->direction, option->rect, textRect);
2241  QString s = menuitem->text;
2242  if (!s.isEmpty()) {
2243  p->save();
2244  int t = s.indexOf(QLatin1Char('\t'));
2246  if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
2247  text_flags |= Qt::TextHideMnemonic;
2248  // draw tab text ----------------
2249  if (t >= 0) {
2250  QRect vShortcutRect = visualRect(option->direction, option->rect, QRect(textRect.topRight(), menuitem->rect.bottomRight()));
2251  if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
2252  p->setPen(menuitem->palette.light().color());
2253  p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1));
2254  p->setPen(textColor);
2255  }
2256  p->drawText(vShortcutRect, text_flags, s.mid(t + 1));
2257  s = s.left(t);
2258  }
2259  QFont font = menuitem->font;
2260  if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
2261  font.setBold(true);
2262  p->setFont(font);
2263  if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
2264  p->setPen(menuitem->palette.light().color());
2265  p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t));
2266  p->setPen(textColor);
2267  }
2268  p->drawText(vTextRect, text_flags, s);
2269  p->restore();
2270  }
2271 
2272  // draw sub menu arrow --------------------------------------------
2273  if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {
2274  int dim = (h - 2) / 2;
2275  PrimitiveElement arrow;
2277  xpos = x + w - windowsArrowHMargin - windowsItemFrame - dim;
2278  QRect vSubMenuRect = visualRect(option->direction, option->rect, QRect(xpos, y + h / 2 - dim / 2, dim, dim));
2279  QStyleOptionMenuItem newMI = *menuitem;
2280  newMI.rect = vSubMenuRect;
2281  newMI.state = dis ? State_None : State_Enabled;
2282  if (act)
2284  proxy()->drawPrimitive(arrow, &newMI, p, widget);
2285  }
2286  }
2287  return;
2288 
2289  case CE_MenuBarItem:
2290  if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option))
2291  {
2292  if (mbi->menuItemType == QStyleOptionMenuItem::DefaultItem)
2293  break;
2294 
2295  bool act = mbi->state & State_Selected;
2296  bool dis = !(mbi->state & State_Enabled);
2297 
2298  QBrush fill = mbi->palette.brush(act ? QPalette::Highlight : QPalette::Button);
2299  QPalette::ColorRole textRole = dis ? QPalette::Text:
2301  QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal);
2302 
2304  if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
2305  alignment |= Qt::TextHideMnemonic;
2306 
2307  p->fillRect(rect, fill);
2308  if (!pix.isNull())
2309  drawItemPixmap(p, mbi->rect, alignment, pix);
2310  else
2311  drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole);
2312  }
2313  return;
2314 #ifndef QT_NO_DOCKWIDGET
2315  case CE_DockWidgetTitle:
2316  if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option))
2317  {
2318  int buttonMargin = 4;
2320  int fw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget);
2321  bool isFloating = widget && widget->isWindow();
2322  bool isActive = dwOpt->state & State_Active;
2323 
2324  const QStyleOptionDockWidgetV2 *v2
2326  bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
2327 
2328  if (verticalTitleBar) {
2329  QSize s = rect.size();
2330  s.transpose();
2331  rect.setSize(s);
2332 
2333  p->translate(rect.left() - 1, rect.top() + rect.width());
2334  p->rotate(-90);
2335  p->translate(-rect.left() + 1, -rect.top());
2336  }
2337  QRect r = rect.adjusted(0, 2, -1, -3);
2338  QRect titleRect = r;
2339 
2340  if (dwOpt->closable) {
2342  titleRect.adjust(0, 0, -sz.width() - mw - buttonMargin, 0);
2343  }
2344 
2345  if (dwOpt->floatable) {
2347  titleRect.adjust(0, 0, -sz.width() - mw - buttonMargin, 0);
2348  }
2349 
2350  if (isFloating) {
2351  titleRect.adjust(0, -fw, 0, 0);
2353  titleRect.adjust(titleRect.height() + mw, 0, 0, 0);
2354  } else {
2355  titleRect.adjust(mw, 0, 0, 0);
2356  if (!dwOpt->floatable && !dwOpt->closable)
2357  titleRect.adjust(0, 0, -mw, 0);
2358  }
2359 
2360  if (!verticalTitleBar)
2361  titleRect = visualRect(dwOpt->direction, r, titleRect);
2362 
2363  if (!isFloating) {
2364  QPen oldPen = p->pen();
2365  QString titleText = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, titleRect.width());
2366  p->setPen(dwOpt->palette.color(QPalette::Dark));
2367  p->drawRect(r);
2368 
2369  if (!titleText.isEmpty()) {
2370  drawItemText(p, titleRect,
2372  dwOpt->state & State_Enabled, titleText,
2374  }
2375 
2376  p->setPen(oldPen);
2377  } else {
2378  name = QLatin1String("WINDOW");
2379  if (isActive)
2380  stateId = CS_ACTIVE;
2381  else
2382  stateId = CS_INACTIVE;
2383 
2384  int titleHeight = rect.height() - 2;
2385  rect = rect.adjusted(-fw, -fw, fw, 0);
2386 
2387  XPThemeData theme(widget, p, name, 0, stateId);
2388  if (!theme.isValid())
2389  break;
2390 
2391  // Draw small type title bar
2392  theme.rect = rect;
2393  theme.partId = WP_SMALLCAPTION;
2394  d->drawBackground(theme);
2395 
2396  // Figure out maximal button space on title bar
2397 
2398  QIcon ico = widget->windowIcon();
2399  bool hasIcon = (ico.cacheKey() != QApplication::windowIcon().cacheKey());
2400  if (hasIcon) {
2401  QPixmap pxIco = ico.pixmap(titleHeight);
2402  if (!verticalTitleBar && dwOpt->direction == Qt::RightToLeft)
2403  p->drawPixmap(rect.width() - titleHeight - pxIco.width(), rect.bottom() - titleHeight - 2, pxIco);
2404  else
2405  p->drawPixmap(fw, rect.bottom() - titleHeight - 2, pxIco);
2406  }
2407  if (!dwOpt->title.isEmpty()) {
2408  QPen oldPen = p->pen();
2409  QFont oldFont = p->font();
2410  QFont titleFont = oldFont;
2411  titleFont.setBold(true);
2412  p->setFont(titleFont);
2413  QString titleText
2414  = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, titleRect.width());
2415 
2416  int result = TST_NONE;
2417  pGetThemeEnumValue(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result);
2418  if (result != TST_NONE) {
2419  COLORREF textShadowRef;
2420  pGetThemeColor(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef);
2421  QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef));
2422  p->setPen(textShadow);
2423  drawItemText(p, titleRect.adjusted(1, 1, 1, 1),
2424  Qt::AlignLeft | Qt::AlignBottom, dwOpt->palette,
2425  dwOpt->state & State_Enabled, titleText);
2426  }
2427 
2428  COLORREF captionText = GetSysColor(isActive ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT);
2429  QColor textColor = qRgb(GetRValue(captionText), GetGValue(captionText), GetBValue(captionText));
2430  p->setPen(textColor);
2431  drawItemText(p, titleRect,
2432  Qt::AlignLeft | Qt::AlignBottom, dwOpt->palette,
2433  dwOpt->state & State_Enabled, titleText);
2434  p->setFont(oldFont);
2435  p->setPen(oldPen);
2436  }
2437 
2438  }
2439 
2440  return;
2441  }
2442  break;
2443 #endif // QT_NO_DOCKWIDGET
2444 #ifndef QT_NO_RUBBERBAND
2445  case CE_RubberBand:
2446  if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) {
2448  p->save();
2449  p->setPen(highlight.darker(120));
2450  QColor dimHighlight(qMin(highlight.red()/2 + 110, 255),
2451  qMin(highlight.green()/2 + 110, 255),
2452  qMin(highlight.blue()/2 + 110, 255),
2453  (widget && widget->isTopLevel())? 255 : 127);
2454  p->setBrush(dimHighlight);
2455  p->drawRect(option->rect.adjusted(0, 0, -1, -1));
2456  p->restore();
2457  return;
2458  }
2459 #endif // QT_NO_RUBBERBAND
2460  case CE_HeaderEmptyArea:
2461  if (option->state & State_Horizontal)
2462  {
2463  name = QLatin1String("HEADER");
2464  stateId = HIS_NORMAL;
2465  }
2466  else {
2468  return;
2469  }
2470  break;
2471  default:
2472  break;
2473  }
2474 
2475  XPThemeData theme(widget, p, name, partId, stateId, rect);
2476  if (!theme.isValid()) {
2477  QWindowsStyle::drawControl(element, option, p, widget);
2478  return;
2479  }
2480 
2481  theme.rotate = rotate;
2482  theme.mirrorHorizontally = hMirrored;
2483  theme.mirrorVertically = vMirrored;
2484  d->drawBackground(theme);
2485 }
static PtrGetThemeEnumValue pGetThemeEnumValue
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
The QStyleOptionDockWidget class is used to describe the parameters for drawing a dock widget...
Definition: qstyleoption.h:504
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
QPointer< QWidget > widget
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
Definition: qpalette.h:93
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
The QStyleOptionMenuItem class is used to describe the parameter necessary for drawing a menu item...
Definition: qstyleoption.h:435
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
void rotate(qreal a)
Rotates the coordinate system the given angle clockwise.
Definition: qpainter.cpp:3287
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
#define TMT_TEXTSHADOWCOLOR
static const int windowsArrowHMargin
void restore()
Restores the current painter state (pops a saved state off the stack).
Definition: qpainter.cpp:1620
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
Definition: qstyle.cpp:532
void drawBackground(XPThemeData &themeData)
Main theme drawing function.
void drawLine(const QLineF &line)
Draws a line defined by line.
Definition: qpainter.h:573
static PtrGetThemeColor pGetThemeColor
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QString class provides a Unicode character string.
Definition: qstring.h:83
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Definition: qpalette.h:107
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
The QStyleOptionSizeGrip class is used to describe the parameter for drawing a size grip...
Definition: qstyleoption.h:853
static const int windowsItemVMargin
#define SIZE(large, small, mini)
QIcon windowIcon
the widget&#39;s icon
Definition: qwidget.h:199
void save()
Saves the current painter state (pushes the state onto a stack).
Definition: qpainter.cpp:1590
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags=0) const
If the string text is wider than width, returns an elided version of the string (i.
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
Definition: qcolor.h:301
The QStyleOptionProgressBarV2 class is used to describe the parameters necessary for drawing a progre...
Definition: qstyleoption.h:417
int width() const
Returns the width.
Definition: qsize.h:126
static QIcon windowIcon()
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
Definition: qpainter.cpp:6231
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
Definition: qstyle.cpp:2327
const QPen & pen() const
Returns the painter&#39;s current pen.
Definition: qpainter.cpp:4152
QFontMetrics fontMetrics() const
Returns the font metrics for the painter if the painter is active.
Definition: qpainter.cpp:2077
void setBold(bool)
If enable is true sets the font&#39;s weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
Definition: qfont.h:352
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const QFont & font() const
Returns the currently set font used for drawing text.
Definition: qpainter.cpp:4312
const char * name
Mode
This enum type describes the mode for which a pixmap is intended to be used.
Definition: qicon.h:63
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
int styleHint(StyleHint hint, const QStyleOption *option=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
void transpose()
Swaps the width and height values.
Definition: qsize.cpp:196
unsigned int uint
Definition: qglobal.h:996
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
static PtrGetThemePartSize pGetThemePartSize
The State element defines configurations of objects and properties.
static const int windowsRightBorder
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Draws the given pixmap in the specified rectangle, according to the specified alignment, using the provided painter.
Definition: qstyle.cpp:570
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
Definition: qstyle.cpp:2087
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
PrimitiveElement
This enum describes the various primitive elements.
Definition: qstyle.h:145
qint64 cacheKey() const
Returns a number that identifies the contents of this QIcon object.
Definition: qicon.cpp:679
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
Definition: qpalette.h:141
int pixelMetric(PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
T qstyleoption_cast(const QStyleOption *opt)
Definition: qstyleoption.h:885
QSize actualSize(const QSize &size, Mode mode=Normal, State state=Off) const
Returns the actual size of the icon for the requested size, mode, and state.
Definition: qicon.cpp:730
void eraseRect(const QRectF &)
Erases the area inside the given rectangle.
Definition: qpainter.cpp:7332
#define TMT_TEXTSHADOWTYPE
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
Definition: qrgb.h:69
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Definition: qpalette.h:201
void setBrush(const QBrush &brush)
Sets the painter&#39;s brush to the given brush.
Definition: qpainter.cpp:4171
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
bool isTopLevel() const
Use isWindow() instead.
Definition: qwidget.h:942
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static bool useXP(bool update=false)
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
Definition: qpainter.h:650
const QStyle * proxy() const
Definition: qstyle.cpp:2546
static const int windowsItemHMargin
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
Definition: qstyleoption.h:304
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition: qicon.cpp:693
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void setFont(const QFont &f)
Sets the painter&#39;s font to the given font.
Definition: qpainter.cpp:4288
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
static const KeyPair *const end
Orientation
Definition: qnamespace.h:174
static const int windowsItemFrame
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
#define TST_NONE
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
Definition: qpainter.cpp:3311
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60

◆ drawPrimitive()

void QWindowsXPStyle::drawPrimitive ( PrimitiveElement  pe,
const QStyleOption option,
QPainter p,
const QWidget widget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 1336 of file qwindowsxpstyle.cpp.

Referenced by QWindowsVistaStyle::drawPrimitive().

1338 {
1339  QWindowsXPStylePrivate *d = const_cast<QWindowsXPStylePrivate*>(d_func());
1340 
1342  QWindowsStyle::drawPrimitive(pe, option, p, widget);
1343  return;
1344  }
1345 
1346  QString name;
1347  int partId = 0;
1348  int stateId = 0;
1349  QRect rect = option->rect;
1350  State flags = option->state;
1351  bool hMirrored = false;
1352  bool vMirrored = false;
1353  bool noBorder = false;
1354  bool noContent = false;
1355  int rotate = 0;
1356 
1357  switch (pe) {
1358  case PE_FrameTabBarBase:
1359  if (const QStyleOptionTabBarBase *tbb
1360  = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
1361  p->save();
1362  switch (tbb->shape) {
1363  case QTabBar::RoundedNorth:
1364  p->setPen(QPen(tbb->palette.dark(), 0));
1365  p->drawLine(tbb->rect.topLeft(), tbb->rect.topRight());
1366  break;
1367  case QTabBar::RoundedWest:
1368  p->setPen(QPen(tbb->palette.dark(), 0));
1369  p->drawLine(tbb->rect.left(), tbb->rect.top(), tbb->rect.left(), tbb->rect.bottom());
1370  break;
1371  case QTabBar::RoundedSouth:
1372  p->setPen(QPen(tbb->palette.dark(), 0));
1373  p->drawLine(tbb->rect.left(), tbb->rect.top(),
1374  tbb->rect.right(), tbb->rect.top());
1375  break;
1376  case QTabBar::RoundedEast:
1377  p->setPen(QPen(tbb->palette.dark(), 0));
1378  p->drawLine(tbb->rect.topLeft(), tbb->rect.bottomLeft());
1379  break;
1384  p->restore();
1385  QWindowsStyle::drawPrimitive(pe, option, p, widget);
1386  return;
1387  }
1388  p->restore();
1389  }
1390  return;
1391  case PE_PanelButtonBevel:
1392  name = QLatin1String("BUTTON");
1393  partId = BP_PUSHBUTTON;
1394  if (!(flags & State_Enabled))
1395  stateId = PBS_DISABLED;
1396  else if ((flags & State_Sunken) || (flags & State_On))
1397  stateId = PBS_PRESSED;
1398  else if (flags & State_MouseOver)
1399  stateId = PBS_HOT;
1400  //else if (flags & State_ButtonDefault)
1401  // stateId = PBS_DEFAULTED;
1402  else
1403  stateId = PBS_NORMAL;
1404  break;
1405 
1406  case PE_PanelButtonTool:
1407  if (widget && widget->inherits("QDockWidgetTitleButton")) {
1408  if (const QWidget *dw = widget->parentWidget())
1409  if (dw->isWindow())
1410  return;
1411  }
1412  name = QLatin1String("TOOLBAR");
1413  partId = TP_BUTTON;
1414  if (!(flags & State_Enabled))
1415  stateId = TS_DISABLED;
1416  else if (flags & State_Sunken)
1417  stateId = TS_PRESSED;
1418  else if (flags & State_MouseOver)
1419  stateId = flags & State_On ? TS_HOTCHECKED : TS_HOT;
1420  else if (flags & State_On)
1421  stateId = TS_CHECKED;
1422  else if (!(flags & State_AutoRaise))
1423  stateId = TS_HOT;
1424  else
1425  stateId = TS_NORMAL;
1426  break;
1427 
1429  name = QLatin1String("TOOLBAR");
1430  partId = TP_SPLITBUTTONDROPDOWN;
1431  if (!(flags & State_Enabled))
1432  stateId = TS_DISABLED;
1433  else if (flags & State_Sunken)
1434  stateId = TS_PRESSED;
1435  else if (flags & State_MouseOver)
1436  stateId = flags & State_On ? TS_HOTCHECKED : TS_HOT;
1437  else if (flags & State_On)
1438  stateId = TS_CHECKED;
1439  else if (!(flags & State_AutoRaise))
1440  stateId = TS_HOT;
1441  else
1442  stateId = TS_NORMAL;
1443  if (option->direction == Qt::RightToLeft)
1444  hMirrored = true;
1445  break;
1446 
1447  case PE_IndicatorCheckBox:
1448  name = QLatin1String("BUTTON");
1449  partId = BP_CHECKBOX;
1450  if (!(flags & State_Enabled))
1451  stateId = CBS_UNCHECKEDDISABLED;
1452  else if (flags & State_Sunken)
1453  stateId = CBS_UNCHECKEDPRESSED;
1454  else if (flags & State_MouseOver)
1455  stateId = CBS_UNCHECKEDHOT;
1456  else
1457  stateId = CBS_UNCHECKEDNORMAL;
1458 
1459  if (flags & State_On)
1460  stateId += CBS_CHECKEDNORMAL-1;
1461  else if (flags & State_NoChange)
1462  stateId += CBS_MIXEDNORMAL-1;
1463 
1464  break;
1465 
1467  name = QLatin1String("BUTTON");
1468  partId = BP_RADIOBUTTON;
1469  if (!(flags & State_Enabled))
1470  stateId = RBS_UNCHECKEDDISABLED;
1471  else if (flags & State_Sunken)
1472  stateId = RBS_UNCHECKEDPRESSED;
1473  else if (flags & State_MouseOver)
1474  stateId = RBS_UNCHECKEDHOT;
1475  else
1476  stateId = RBS_UNCHECKEDNORMAL;
1477 
1478  if (flags & State_On)
1479  stateId += RBS_CHECKEDNORMAL-1;
1480  break;
1481 
1483  return;
1484 
1485 case PE_Frame:
1486  {
1487  if (flags & State_Raised)
1488  return;
1489  name = QLatin1String("LISTVIEW");
1490  partId = LVP_LISTGROUP;
1491  XPThemeData theme(0, 0, name, partId, 0);
1492 
1493  if (!(flags & State_Enabled))
1494  stateId = ETS_DISABLED;
1495  else
1496  stateId = ETS_NORMAL;
1497  int fillType;
1498  if (pGetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &fillType) == S_OK) {
1499  if (fillType == BT_BORDERFILL) {
1500  COLORREF bcRef;
1501  pGetThemeColor(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &bcRef);
1502  QColor bordercolor(qRgb(GetRValue(bcRef), GetGValue(bcRef), GetBValue(bcRef)));
1503  QPen oldPen = p->pen();
1504  // int borderSize = 1;
1505  // pGetThemeInt(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &borderSize);
1506 
1507  // Inner white border
1508  p->setPen(QPen(option->palette.base().color(), 1));
1509  p->drawRect(option->rect.adjusted(1, 1, -2, -2));
1510  // Outer dark border
1511  p->setPen(QPen(bordercolor, 1));
1512  p->drawRect(option->rect.adjusted(0, 0, -1, -1));
1513  p->setPen(oldPen);
1514  return;
1515  } else if (fillType == BT_NONE) {
1516  return;
1517  } else {
1518  break;
1519  }
1520  }
1521  }
1522  case PE_FrameLineEdit: {
1523  // we try to check if this lineedit is a delegate on a QAbstractItemView-derived class.
1525  QPen oldPen = p->pen();
1526  // Inner white border
1527  p->setPen(QPen(option->palette.base().color(), 1));
1528  p->drawRect(option->rect.adjusted(1, 1, -2, -2));
1529  // Outer dark border
1530  p->setPen(QPen(option->palette.shadow().color(), 1));
1531  p->drawRect(option->rect.adjusted(0, 0, -1, -1));
1532  p->setPen(oldPen);
1533  return;
1534  } else if (qstyleoption_cast<const QStyleOptionFrame *>(option)) {
1535  name = QLatin1String("EDIT");
1536  partId = EP_EDITTEXT;
1537  noContent = true;
1538  if (!(flags & State_Enabled))
1539  stateId = ETS_DISABLED;
1540  else
1541  stateId = ETS_NORMAL;
1542  }
1543  break;
1544  }
1545 
1546  case PE_PanelLineEdit:
1547  if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
1548  name = QLatin1String("EDIT");
1549  partId = EP_EDITTEXT;
1550  noBorder = true;
1551  QBrush bg;
1552  bool usePalette = false;
1553  bool isEnabled = flags & State_Enabled;
1554  uint resolve_mask = panel->palette.resolve();
1555 
1556 #ifndef QT_NO_SPINBOX
1557  //Since spin box includes a line edit we need to resolve the palette on the spin box instead
1558  if (widget) {
1559  if (QAbstractSpinBox *spinbox = qobject_cast<QAbstractSpinBox*>(widget->parentWidget()))
1560  resolve_mask = spinbox->palette().resolve();
1561  }
1562 #endif // QT_NO_SPINBOX
1563  if (resolve_mask & (1 << QPalette::Base)) {
1564  // Base color is set for this widget, so use it
1565  bg = panel->palette.brush(QPalette::Base);
1566  usePalette = true;
1567  }
1568 
1569  stateId = isEnabled ? ETS_NORMAL : ETS_DISABLED;
1570 
1571  if (usePalette) {
1572  p->fillRect(panel->rect, bg);
1573  } else {
1574  XPThemeData theme(0, p, name, partId, stateId, rect);
1575  if (!theme.isValid()) {
1576  QWindowsStyle::drawPrimitive(pe, option, p, widget);
1577  return;
1578  }
1579  int bgType;
1580  pGetThemeEnumValue( theme.handle(),
1581  partId,
1582  stateId,
1583  TMT_BGTYPE,
1584  &bgType);
1585  if( bgType == BT_IMAGEFILE ) {
1586  theme.mirrorHorizontally = hMirrored;
1587  theme.mirrorVertically = vMirrored;
1588  theme.noBorder = noBorder;
1589  theme.noContent = noContent;
1590  theme.rotate = rotate;
1591  d->drawBackground(theme);
1592  } else {
1593  QBrush fillColor = option->palette.brush(QPalette::Base);
1594 
1595  if (!isEnabled) {
1596  PROPERTYORIGIN origin = PO_NOTFOUND;
1597  pGetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin);
1598  // Use only if the fill property comes from our part
1599  if ((origin == PO_PART || origin == PO_STATE)) {
1600  COLORREF bgRef;
1601  pGetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef);
1602  fillColor = QBrush(qRgb(GetRValue(bgRef), GetGValue(bgRef), GetBValue(bgRef)));
1603  }
1604  }
1605  p->fillRect(option->rect, fillColor);
1606  }
1607  }
1608 
1609  if (panel->lineWidth > 0)
1610  proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget);
1611  return;
1612  }
1613  break;
1614 
1615  case PE_FrameTabWidget:
1616  if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option))
1617  {
1618  name = QLatin1String("TAB");
1619  partId = TABP_PANE;
1620 
1621  if (widget) {
1622  bool useGradient = true;
1623  const int maxlength = 256;
1624  wchar_t themeFileName[maxlength];
1625  wchar_t themeColor[maxlength];
1626  // Due to a a scaling issue with the XP Silver theme, tab gradients are not used with it
1627  if (pGetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) {
1628  wchar_t *offset = 0;
1629  if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) {
1630  offset++;
1631  if (!lstrcmp(offset, L"Luna.msstyles") && !lstrcmp(offset, L"Metallic")) {
1632  useGradient = false;
1633  }
1634  }
1635  }
1636  // This should work, but currently there's an error in the ::drawBackgroundDirectly()
1637  // code, when using the HDC directly..
1638  if (useGradient) {
1639  QStyleOptionTabWidgetFrameV2 frameOpt = *tab;
1640  frameOpt.rect = widget->rect();
1641  QRect contentsRect = subElementRect(SE_TabWidgetTabContents, &frameOpt, widget);
1642  QRegion reg = option->rect;
1643  reg -= contentsRect;
1644  p->setClipRegion(reg);
1645  XPThemeData theme(widget, p, name, partId, stateId, rect);
1646  theme.mirrorHorizontally = hMirrored;
1647  theme.mirrorVertically = vMirrored;
1648  d->drawBackground(theme);
1649  p->setClipRect(contentsRect);
1650  partId = TABP_BODY;
1651  }
1652  }
1653  switch (tab->shape) {
1654  case QTabBar::RoundedNorth:
1656  break;
1657  case QTabBar::RoundedSouth:
1659  vMirrored = true;
1660  break;
1661  case QTabBar::RoundedEast:
1663  rotate = 90;
1664  break;
1665  case QTabBar::RoundedWest:
1667  rotate = 90;
1668  hMirrored = true;
1669  break;
1670  default:
1671  break;
1672  }
1673  }
1674  break;
1675 
1676  case PE_FrameMenu:
1677  p->save();
1678  p->setPen(option->palette.dark().color());
1679  p->drawRect(rect.adjusted(0, 0, -1, -1));
1680  p->restore();
1681  return;
1682 
1683  case PE_PanelMenuBar:
1684  break;
1685 
1686  case PE_FrameDockWidget:
1687  if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(option))
1688  {
1689  name = QLatin1String("WINDOW");
1690  if (flags & State_Active)
1691  stateId = FS_ACTIVE;
1692  else
1693  stateId = FS_INACTIVE;
1694 
1695  int fwidth = proxy()->pixelMetric(PM_DockWidgetFrameWidth, frm, widget);
1696 
1697  XPThemeData theme(widget, p, name, 0, stateId);
1698  if (!theme.isValid())
1699  break;
1700  theme.rect = QRect(frm->rect.x(), frm->rect.y(), frm->rect.x()+fwidth, frm->rect.height()-fwidth); theme.partId = WP_SMALLFRAMELEFT;
1701  d->drawBackground(theme);
1702  theme.rect = QRect(frm->rect.width()-fwidth, frm->rect.y(), fwidth, frm->rect.height()-fwidth);
1703  theme.partId = WP_SMALLFRAMERIGHT;
1704  d->drawBackground(theme);
1705  theme.rect = QRect(frm->rect.x(), frm->rect.bottom()-fwidth+1, frm->rect.width(), fwidth);
1706  theme.partId = WP_SMALLFRAMEBOTTOM;
1707  d->drawBackground(theme);
1708  return;
1709  }
1710  break;
1711 
1713  {
1714 #if 0 // XP theme engine doesn't know about this :(
1715  name = QLatin1String("HEADER");
1716  partId = HP_HEADERSORTARROW;
1717  if (flags & State_Down)
1718  stateId = HSAS_SORTEDDOWN;
1719  else
1720  stateId = HSAS_SORTEDUP;
1721 #else
1722  if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
1723  p->save();
1724  p->setPen(option->palette.dark().color());
1725  p->translate(0, option->rect.height()/2 - 4);
1726  if (header->sortIndicator & QStyleOptionHeader::SortUp) { // invert logic to follow Windows style guide
1727  p->drawLine(option->rect.x(), option->rect.y(), option->rect.x()+8, option->rect.y());
1728  p->drawLine(option->rect.x()+1, option->rect.y()+1, option->rect.x()+7, option->rect.y()+1);
1729  p->drawLine(option->rect.x()+2, option->rect.y()+2, option->rect.x()+6, option->rect.y()+2);
1730  p->drawLine(option->rect.x()+3, option->rect.y()+3, option->rect.x()+5, option->rect.y()+3);
1731  p->drawPoint(option->rect.x()+4, option->rect.y()+4);
1732  } else if(header->sortIndicator & QStyleOptionHeader::SortDown) {
1733  p->drawLine(option->rect.x(), option->rect.y()+4, option->rect.x()+8, option->rect.y()+4);
1734  p->drawLine(option->rect.x()+1, option->rect.y()+3, option->rect.x()+7, option->rect.y()+3);
1735  p->drawLine(option->rect.x()+2, option->rect.y()+2, option->rect.x()+6, option->rect.y()+2);
1736  p->drawLine(option->rect.x()+3, option->rect.y()+1, option->rect.x()+5, option->rect.y()+1);
1737  p->drawPoint(option->rect.x()+4, option->rect.y());
1738  }
1739  p->restore();
1740  return;
1741  }
1742 #endif
1743  }
1744  break;
1745 
1746  case PE_FrameStatusBarItem:
1747  name = QLatin1String("STATUS");
1748  partId = SP_PANE;
1749  break;
1750 
1751  case PE_FrameGroupBox:
1752  name = QLatin1String("BUTTON");
1753  partId = BP_GROUPBOX;
1754  if (!(flags & State_Enabled))
1755  stateId = GBS_DISABLED;
1756  else
1757  stateId = GBS_NORMAL;
1758  if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
1759  const QStyleOptionFrameV2 *frame2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(option);
1760  if (frame2->features & QStyleOptionFrameV2::Flat) {
1761  // Windows XP does not have a theme part for a flat GroupBox, paint it with the windows style
1762  QRect fr = frame->rect;
1763  QPoint p1(fr.x(), fr.y() + 1);
1764  QPoint p2(fr.x() + fr.width(), p1.y() + 1);
1765  rect = QRect(p1, p2);
1766  name = QLatin1String("");
1767  }
1768  }
1769  break;
1770 
1772  {
1774  bool inverted = false;
1775  if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
1776  orient = pb2->orientation;
1777  if (pb2->invertedAppearance)
1778  inverted = true;
1779  }
1780  if (orient == Qt::Horizontal) {
1781  partId = PP_CHUNK;
1782  rect = QRect(option->rect.x(), option->rect.y(), option->rect.width(), option->rect.height() );
1783  if (inverted && option->direction == Qt::LeftToRight)
1784  hMirrored = true;
1785  } else {
1786  partId = PP_CHUNKVERT;
1787  rect = QRect(option->rect.x(), option->rect.y(), option->rect.width(), option->rect.height());
1788  }
1789  name = QLatin1String("PROGRESS");
1790  stateId = 1;
1791  }
1792  break;
1793 
1795  name = QLatin1String("TOOLBAR");
1796  if (flags & State_Horizontal)
1797  partId = TP_SEPARATOR;
1798  else
1799  partId = TP_SEPARATORVERT;
1800  break;
1801 
1802  case PE_FrameWindow:
1803  if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(option))
1804  {
1805  name = QLatin1String("WINDOW");
1806  if (flags & State_Active)
1807  stateId = FS_ACTIVE;
1808  else
1809  stateId = FS_INACTIVE;
1810 
1811  int fwidth = frm->lineWidth + frm->midLineWidth;
1812 
1813  XPThemeData theme(0, p, name, 0, stateId);
1814  if (!theme.isValid())
1815  break;
1816 
1817  theme.rect = QRect(option->rect.x(), option->rect.y()+fwidth, option->rect.x()+fwidth, option->rect.height()-fwidth);
1818  theme.partId = WP_FRAMELEFT;
1819  d->drawBackground(theme);
1820  theme.rect = QRect(option->rect.width()-fwidth, option->rect.y()+fwidth, fwidth, option->rect.height()-fwidth);
1821  theme.partId = WP_FRAMERIGHT;
1822  d->drawBackground(theme);
1823  theme.rect = QRect(option->rect.x(), option->rect.height()-fwidth, option->rect.width(), fwidth);
1824  theme.partId = WP_FRAMEBOTTOM;
1825  d->drawBackground(theme);
1826  theme.rect = QRect(option->rect.x(), option->rect.y(), option->rect.width(), option->rect.y()+fwidth);
1827  theme.partId = WP_CAPTION;
1828  d->drawBackground(theme);
1829  return;
1830  }
1831  break;
1832 
1833  case PE_IndicatorBranch:
1834  {
1835  static const int decoration_size = 9;
1836  int mid_h = option->rect.x() + option->rect.width() / 2;
1837  int mid_v = option->rect.y() + option->rect.height() / 2;
1838  int bef_h = mid_h;
1839  int bef_v = mid_v;
1840  int aft_h = mid_h;
1841  int aft_v = mid_v;
1842  QBrush brush(option->palette.dark().color(), Qt::Dense4Pattern);
1843  if (option->state & State_Item) {
1844  if (option->direction == Qt::RightToLeft)
1845  p->fillRect(option->rect.left(), mid_v, bef_h - option->rect.left(), 1, brush);
1846  else
1847  p->fillRect(aft_h, mid_v, option->rect.right() - aft_h + 1, 1, brush);
1848  }
1849  if (option->state & State_Sibling)
1850  p->fillRect(mid_h, aft_v, 1, option->rect.bottom() - aft_v + 1, brush);
1851  if (option->state & (State_Open | State_Children | State_Item | State_Sibling))
1852  p->fillRect(mid_h, option->rect.y(), 1, bef_v - option->rect.y(), brush);
1853  if (option->state & State_Children) {
1854  int delta = decoration_size / 2;
1855  bef_h -= delta;
1856  bef_v -= delta;
1857  aft_h += delta;
1858  aft_v += delta;
1859  XPThemeData theme(0, p, QLatin1String("TREEVIEW"));
1860  theme.rect = QRect(bef_h, bef_v, decoration_size, decoration_size);
1861  theme.partId = TVP_GLYPH;
1862  theme.stateId = flags & QStyle::State_Open ? GLPS_OPENED : GLPS_CLOSED;
1863  d->drawBackground(theme);
1864  }
1865  }
1866  return;
1867 
1869  if (option->rect.height() < 3) {
1870  // XP style requires a few pixels for the separator
1871  // to be visible.
1872  QWindowsStyle::drawPrimitive(pe, option, p, widget);
1873  return;
1874  }
1875  name = QLatin1String("TOOLBAR");
1876  partId = TP_SEPARATOR;
1877 
1878  if (option->state & State_Horizontal)
1879  partId = TP_SEPARATOR;
1880  else
1881  partId = TP_SEPARATORVERT;
1882 
1883  break;
1884 
1886 
1887  name = QLatin1String("REBAR");
1888  partId = RP_GRIPPER;
1889  if (option->state & State_Horizontal) {
1890  partId = RP_GRIPPER;
1891  rect.adjust(0, 0, -2, 0);
1892  }
1893  else {
1894  partId = RP_GRIPPERVERT;
1895  rect.adjust(0, 0, 0, -2);
1896  }
1897  break;
1898 
1900  QStyleOptionButton button;
1901  button.QStyleOption::operator=(*option);
1902  button.state &= ~State_MouseOver;
1903  proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, p, widget);
1904  return;
1905  }
1906 
1907  default:
1908  break;
1909  }
1910 
1911  XPThemeData theme(0, p, name, partId, stateId, rect);
1912  if (!theme.isValid()) {
1913  QWindowsStyle::drawPrimitive(pe, option, p, widget);
1914  return;
1915  }
1916  theme.mirrorHorizontally = hMirrored;
1917  theme.mirrorVertically = vMirrored;
1918  theme.noBorder = noBorder;
1919  theme.noContent = noContent;
1920  theme.rotate = rotate;
1921  d->drawBackground(theme);
1922 }
static PtrGetThemeEnumValue pGetThemeEnumValue
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QRect subElementRect(SubElement r, const QStyleOption *option, const QWidget *widget=0) const
Reimplemented Function
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
const QBrush & base() const
Returns the base brush of the current color group.
Definition: qpalette.h:130
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
const QBrush & dark() const
Returns the dark brush of the current color group.
Definition: qpalette.h:127
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
The QStyleOptionHeader class is used to describe the parameters for drawing a header.
Definition: qstyleoption.h:251
#define BT_NONE
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation...
Definition: qpainter.cpp:2801
void restore()
Restores the current painter state (pops a saved state off the stack).
Definition: qpainter.cpp:1620
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void drawBackground(XPThemeData &themeData)
Main theme drawing function.
void drawLine(const QLineF &line)
Draws a line defined by line.
Definition: qpainter.h:573
static PtrGetThemeColor pGetThemeColor
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define BT_IMAGEFILE
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
void drawPoint(const QPointF &pt)
Draws a single point at the given position using the current pen&#39;s color.
Definition: qpainter.h:676
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
static PtrGetCurrentThemeName pGetCurrentThemeName
void save()
Saves the current painter state (pushes the state onto a stack).
Definition: qpainter.cpp:1590
#define TMT_BORDERCOLOR
The QStyleOptionProgressBarV2 class is used to describe the parameters necessary for drawing a progre...
Definition: qstyleoption.h:417
const QPen & pen() const
Returns the painter&#39;s current pen.
Definition: qpainter.cpp:4152
#define TMT_BGTYPE
const char * name
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
Definition: qstyleoption.h:118
unsigned int uint
Definition: qglobal.h:996
The QStyleOptionTabWidgetFrame class is used to describe the parameters for drawing the frame around ...
Definition: qstyleoption.h:175
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QStyleOptionTabBarBase class is used to describe the base of a tab bar, i.e.
Definition: qstyleoption.h:218
static bool isItemViewDelegateLineEdit(const QWidget *widget)
The QAbstractSpinBox class provides a spinbox and a line edit to display values.
The State element defines configurations of objects and properties.
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition: qobject.h:275
FrameFeatures features
a bitwise OR of the features that describe this frame.
Definition: qstyleoption.h:143
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Definition: qpalette.cpp:874
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
const QBrush & shadow() const
Returns the shadow brush of the current color group.
Definition: qpalette.h:139
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
Definition: qpainter.cpp:2917
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
#define BT_BORDERFILL
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
T qstyleoption_cast(const QStyleOption *opt)
Definition: qstyleoption.h:885
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
Definition: qrgb.h:69
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static bool useXP(bool update=false)
The QStyleOptionFrameV2 class is used to describe the parameters necessary for drawing a frame in Qt ...
Definition: qstyleoption.h:134
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
Definition: qpainter.h:650
const QStyle * proxy() const
Definition: qstyle.cpp:2546
Orientation
Definition: qnamespace.h:174
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279
static PtrGetThemePropertyOrigin pGetThemePropertyOrigin
#define TMT_FILLCOLOR
The QStyleOptionTabWidgetFrameV2 class is used to describe the parameters for drawing the frame aroun...
Definition: qstyleoption.h:196
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
Definition: qpainter.cpp:3311

◆ pixelMetric()

int QWindowsXPStyle::pixelMetric ( PixelMetric  pm,
const QStyleOption option = 0,
const QWidget widget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 3282 of file qwindowsxpstyle.cpp.

Referenced by drawComplexControl(), drawControl(), QWindowsVistaStyle::pixelMetric(), and sizeFromContents().

3283 {
3285  return QWindowsStyle::pixelMetric(pm, option, widget);
3286 
3287  int res = 0;
3288  switch (pm) {
3289  case PM_MenuBarPanelWidth:
3290  res = 0;
3291  break;
3292 
3293  case PM_DefaultFrameWidth:
3294  if (qobject_cast<const QListView*>(widget))
3295  res = 2;
3296  else
3297  res = 1;
3298  break;
3299  case PM_MenuPanelWidth:
3300  case PM_SpinBoxFrameWidth:
3301  res = 1;
3302  break;
3303 
3304  case PM_TabBarTabOverlap:
3305  case PM_MenuHMargin:
3306  case PM_MenuVMargin:
3307  res = 2;
3308  break;
3309 
3310  case PM_TabBarBaseOverlap:
3311  if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
3312  switch (tab->shape) {
3313  case QTabBar::RoundedNorth:
3315  res = 1;
3316  break;
3317  case QTabBar::RoundedSouth:
3319  res = 2;
3320  break;
3321  case QTabBar::RoundedEast:
3323  res = 3;
3324  break;
3325  case QTabBar::RoundedWest:
3327  res = 1;
3328  break;
3329  }
3330  }
3331  break;
3332 
3333  case PM_SplitterWidth:
3334  res = qMax(int(QStyleHelper::dpiScaled(5.)), QApplication::globalStrut().width());
3335  break;
3336 
3337  case PM_IndicatorWidth:
3338  case PM_IndicatorHeight:
3339  {
3340  XPThemeData theme(widget, 0, QLatin1String("BUTTON"), BP_CHECKBOX, CBS_UNCHECKEDNORMAL);
3341  if (theme.isValid()) {
3342  SIZE size;
3343  pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
3344  res = (pm == PM_IndicatorWidth) ? size.cx : size.cy;
3345  }
3346  }
3347  break;
3348 
3351  {
3352  XPThemeData theme(widget, 0, QLatin1String("BUTTON"), BP_RADIOBUTTON, RBS_UNCHECKEDNORMAL);
3353  if (theme.isValid()) {
3354  SIZE size;
3355  pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
3356  res = (pm == PM_ExclusiveIndicatorWidth) ? size.cx : size.cy;
3357  }
3358  }
3359  break;
3360 
3362  {
3364  if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option))
3365  orient = pb2->orientation;
3366  XPThemeData theme(widget, 0, QLatin1String("PROGRESS"), (orient == Qt::Horizontal) ? PP_CHUNK : PP_CHUNKVERT);
3367  if (theme.isValid()) {
3368  SIZE size;
3369  pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
3370  res = (orient == Qt::Horizontal) ? size.cx : size.cy;
3371  }
3372  }
3373  break;
3374 
3375  case PM_SliderThickness:
3376  {
3377  XPThemeData theme(widget, 0, QLatin1String("TRACKBAR"), TKP_THUMB);
3378  if (theme.isValid()) {
3379  SIZE size;
3380  pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
3381  res = size.cy;
3382  }
3383  }
3384  break;
3385 
3386  case PM_TitleBarHeight:
3387  {
3388 #ifdef QT3_SUPPORT
3389  if (widget && widget->inherits("Q3DockWindowTitleBar")) {
3390  res = GetSystemMetrics(SM_CYSMCAPTION) + GetSystemMetrics(SM_CXSIZEFRAME);
3391  } else
3392 #endif
3393  if (widget && (widget->windowType() == Qt::Tool))
3394  res = GetSystemMetrics(SM_CYSMCAPTION) + GetSystemMetrics(SM_CXSIZEFRAME);
3395  else
3396  res = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CXSIZEFRAME);
3397  }
3398  break;
3399 
3401  {
3402  XPThemeData theme(widget, 0, QLatin1String("WINDOW"), WP_FRAMELEFT, FS_ACTIVE);
3403  if (theme.isValid()) {
3404  SIZE size;
3405  pGetThemePartSize(theme.handle(), 0, WP_FRAMELEFT, FS_ACTIVE, 0, TS_TRUE, &size);
3406  res = size.cx-1;
3407  }
3408  }
3409  break;
3410 
3412  res = 160;
3413  break;
3414 
3415 #ifndef QT_NO_TOOLBAR
3417  res = int(QStyleHelper::dpiScaled(8.));
3418  break;
3419 
3420 #endif // QT_NO_TOOLBAR
3422  {
3423  XPThemeData theme(widget, 0, QLatin1String("WINDOW"), WP_SMALLFRAMERIGHT, FS_ACTIVE);
3424  if (theme.isValid()) {
3425  SIZE size;
3426  pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
3427  res = size.cx;
3428  }
3429  }
3430  break;
3432  res = int(QStyleHelper::dpiScaled(4.));
3433  break;
3435  res = int(QStyleHelper::dpiScaled(4.));
3436  break;
3437 
3440  if (qstyleoption_cast<const QStyleOptionToolButton *>(option))
3441  res = 1;
3442  else
3443  res = 0;
3444  break;
3445 
3447  res = 0;
3448  break;
3449 
3450  default:
3451  res = QWindowsStyle::pixelMetric(pm, option, widget);
3452  }
3453 
3454  return res;
3455 }
static QSize globalStrut()
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define SIZE(large, small, mini)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
The QStyleOptionProgressBarV2 class is used to describe the parameters necessary for drawing a progre...
Definition: qstyleoption.h:417
int pixelMetric(PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
static PtrGetThemePartSize pGetThemePartSize
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition: qobject.h:275
qreal dpiScaled(qreal value)
static bool useXP(bool update=false)
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
Definition: qstyleoption.h:304
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
Orientation
Definition: qnamespace.h:174

◆ polish() [1/3]

void QWindowsXPStyle::polish ( QApplication app)
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 1131 of file qwindowsxpstyle.cpp.

Referenced by QWindowsVistaStyle::polish().

1132 {
1133  QWindowsStyle::polish(app);
1135  return;
1136 }
void polish(QApplication *)
Reimplemented Function
static bool useXP(bool update=false)

◆ polish() [2/3]

void QWindowsXPStyle::polish ( QWidget widget)
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 1139 of file qwindowsxpstyle.cpp.

1140 {
1141  QWindowsStyle::polish(widget);
1143  return;
1144 
1145  if (qobject_cast<QAbstractButton*>(widget)
1146  || qobject_cast<QToolButton*>(widget)
1147  || qobject_cast<QTabBar*>(widget)
1148 #ifndef QT_NO_COMBOBOX
1149  || qobject_cast<QComboBox*>(widget)
1150 #endif // QT_NO_COMBOBOX
1151  || qobject_cast<QScrollBar*>(widget)
1152  || qobject_cast<QSlider*>(widget)
1153  || qobject_cast<QHeaderView*>(widget)
1154 #ifndef QT_NO_SPINBOX
1155  || qobject_cast<QAbstractSpinBox*>(widget)
1156  || qobject_cast<QSpinBox*>(widget)
1157 #endif // QT_NO_SPINBOX
1158  || widget->inherits("QWorkspaceChild")
1159  || widget->inherits("Q3TitleBar"))
1160  widget->setAttribute(Qt::WA_Hover);
1161 
1162 #ifndef QT_NO_RUBBERBAND
1163  if (qobject_cast<QRubberBand*>(widget)) {
1164  widget->setWindowOpacity(0.6);
1165  }
1166 #endif
1167  if (qobject_cast<QStackedWidget*>(widget) &&
1168  qobject_cast<QTabWidget*>(widget->parent()))
1170 
1172  if (!d->hasInitColors) {
1173  // Get text color for group box labels
1174  COLORREF cref;
1175  XPThemeData theme(0, 0, QLatin1String("BUTTON"), 0, 0);
1176  pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref);
1177  d->groupBoxTextColor = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref));
1178  pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref);
1179  d->groupBoxTextColorDisabled = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref));
1180  // Where does this color come from?
1181  //pGetThemeColor(theme.handle(), TKP_TICS, TSS_NORMAL, TMT_COLOR, &cref);
1182  d->sliderTickColor = qRgb(165, 162, 148);
1183  d->hasInitColors = true;
1184  }
1185 }
double d
Definition: qnumeric_p.h:62
void polish(QApplication *)
Reimplemented Function
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
#define TMT_TEXTCOLOR
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static PtrGetThemeColor pGetThemeColor
#define Q_D(Class)
Definition: qglobal.h:2482
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition: qobject.h:275
The QWindowsXPStyle class provides a Microsoft Windows XP-like look and feel.
#define QT_NO_SPINBOX
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
Definition: qrgb.h:69
static bool useXP(bool update=false)
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
#define QT_NO_COMBOBOX
void setWindowOpacity(qreal level)
Definition: qwidget.cpp:11497

◆ polish() [3/3]

void QWindowsXPStyle::polish ( QPalette pal)
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 1188 of file qwindowsxpstyle.cpp.

1189 {
1190  QWindowsStyle::polish(pal);
1191  pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(110));
1192 }
void polish(QApplication *)
Reimplemented Function
const QBrush & base() const
Returns the base brush of the current color group.
Definition: qpalette.h:130
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
Definition: qcolor.h:301
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette...
Definition: qpalette.h:206

◆ sizeFromContents()

QSize QWindowsXPStyle::sizeFromContents ( ContentsType  ct,
const QStyleOption option,
const QSize contentsSize,
const QWidget widget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 3709 of file qwindowsxpstyle.cpp.

Referenced by QWindowsVistaStyle::sizeFromContents().

3711 {
3713  return QWindowsStyle::sizeFromContents(ct, option, contentsSize, widget);
3714 
3715  QSize sz(contentsSize);
3716  switch (ct) {
3717  case CT_LineEdit:
3718  case CT_ComboBox:
3719  {
3720  XPThemeData buttontheme(widget, 0, QLatin1String("Button"));
3721  HTHEME theme = buttontheme.handle();
3722  MARGINS borderSize;
3723  if (theme) {
3724  int result = pGetThemeMargins(theme,
3725  NULL,
3726  BP_PUSHBUTTON,
3727  PBS_NORMAL,
3729  NULL,
3730  &borderSize);
3731  if (result == S_OK) {
3732  sz += QSize(borderSize.cxLeftWidth + borderSize.cxRightWidth - 2,
3733  borderSize.cyBottomHeight + borderSize.cyTopHeight - 2);
3734  }
3735  const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
3736  sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget)
3737  + textMargins, 23), 0); //arrow button
3738  }
3739  }
3740  break;
3741  case CT_SpinBox:
3742  {
3743  //Spinbox adds frame twice
3744  sz = QWindowsStyle::sizeFromContents(ct, option, contentsSize, widget);
3745  int border = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
3746  sz -= QSize(2*border, 2*border);
3747  }
3748  break;
3749  case CT_TabWidget:
3750  sz += QSize(6, 6);
3751  break;
3752  case CT_Menu:
3753  sz += QSize(1, 0);
3754  break;
3755 #ifndef QT_NO_MENUBAR
3756  case CT_MenuBarItem:
3757  if (!sz.isEmpty())
3758  sz += QSize(windowsItemHMargin * 5 + 1, 6);
3759  break;
3760 #endif
3761  case CT_MenuItem:
3762  if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option))
3763  {
3764  if (menuitem->menuItemType != QStyleOptionMenuItem::Separator) {
3765  sz = QWindowsStyle::sizeFromContents(ct, option, sz, widget);
3766  sz.setHeight(sz.height() - 2);
3767  return sz;
3768  }
3769  }
3770  sz = QWindowsStyle::sizeFromContents(ct, option, sz, widget);
3771  break;
3772 
3773  case CT_MdiControls:
3774  if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) {
3775  int width = 0;
3776  if (styleOpt->subControls & SC_MdiMinButton)
3777  width += 17 + 1;
3778  if (styleOpt->subControls & SC_MdiNormalButton)
3779  width += 17 + 1;
3780  if (styleOpt->subControls & SC_MdiCloseButton)
3781  width += 17 + 1;
3782  sz = QSize(width, 19);
3783  } else {
3784  sz = QSize(54, 19);
3785  }
3786  break;
3787 
3788  default:
3789  sz = QWindowsStyle::sizeFromContents(ct, option, sz, widget);
3790  break;
3791  }
3792 
3793  return sz;
3794 }
The QStyleOptionMenuItem class is used to describe the parameter necessary for drawing a menu item...
Definition: qstyleoption.h:435
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
static PtrGetThemeMargins pGetThemeMargins
int pixelMetric(PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=0) const
Reimplemented Function
static bool useXP(bool update=false)
const QStyle * proxy() const
Definition: qstyle.cpp:2546
static const int windowsItemHMargin
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QStyleOptionComplex class is used to hold parameters that are common to all complex controls...
Definition: qstyleoption.h:687
#define TMT_CONTENTMARGINS

◆ standardIconImplementation

QIcon QWindowsXPStyle::standardIconImplementation ( StandardPixmap  standardIcon,
const QStyleOption option,
const QWidget widget = 0 
) const
protectedslot
Warning
This function is not part of the public interface.

Definition at line 3915 of file qwindowsxpstyle.cpp.

Referenced by QWindowsVistaStyle::standardIconImplementation().

3918 {
3921  }
3922 
3923  QWindowsXPStylePrivate *d = const_cast<QWindowsXPStylePrivate*>(d_func());
3924  switch(standardIcon) {
3925  case SP_TitleBarMaxButton:
3926  if (qstyleoption_cast<const QStyleOptionDockWidget *>(option))
3927  {
3928  if (d->dockFloat.isNull()) {
3929  XPThemeData themeSize(0, 0, QLatin1String("WINDOW"), WP_SMALLCLOSEBUTTON, CBS_NORMAL);
3930  XPThemeData theme(0, 0, QLatin1String("WINDOW"), WP_MAXBUTTON, MAXBS_NORMAL);
3931  if (theme.isValid()) {
3932  SIZE size;
3933  pGetThemePartSize(themeSize.handle(), 0, themeSize.partId, themeSize.stateId, 0, TS_TRUE, &size);
3934  QPixmap pm = QPixmap(size.cx, size.cy);
3935  pm.fill(Qt::transparent);
3936  QPainter p(&pm);
3937  theme.painter = &p;
3938  theme.rect = QRect(0, 0, size.cx, size.cy);
3939  d->drawBackground(theme);
3940  d->dockFloat.addPixmap(pm, QIcon::Normal, QIcon::Off); // Normal
3941  pm.fill(Qt::transparent);
3942  theme.stateId = MAXBS_PUSHED;
3943  d->drawBackground(theme);
3944  d->dockFloat.addPixmap(pm, QIcon::Normal, QIcon::On); // Pressed
3945  pm.fill(Qt::transparent);
3946  theme.stateId = MAXBS_HOT;
3947  d->drawBackground(theme);
3948  d->dockFloat.addPixmap(pm, QIcon::Active, QIcon::Off); // Hover
3949  pm.fill(Qt::transparent);
3950  theme.stateId = MAXBS_INACTIVE;
3951  d->drawBackground(theme);
3952  d->dockFloat.addPixmap(pm, QIcon::Disabled, QIcon::Off); // Disabled
3953  }
3954  }
3955  if (widget && widget->isWindow())
3956  return d->dockFloat;
3957 
3958  }
3959  break;
3961  if (qstyleoption_cast<const QStyleOptionDockWidget *>(option))
3962  {
3963  if (d->dockClose.isNull()) {
3964  XPThemeData theme(0, 0, QLatin1String("WINDOW"), WP_SMALLCLOSEBUTTON, CBS_NORMAL);
3965  if (theme.isValid()) {
3966  SIZE size;
3967  pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
3968  QPixmap pm = QPixmap(size.cx, size.cy);
3969  pm.fill(Qt::transparent);
3970  QPainter p(&pm);
3971  theme.painter = &p;
3972  theme.partId = WP_CLOSEBUTTON; // ####
3973  theme.rect = QRect(0, 0, size.cx, size.cy);
3974  d->drawBackground(theme);
3975  d->dockClose.addPixmap(pm, QIcon::Normal, QIcon::Off); // Normal
3976  pm.fill(Qt::transparent);
3977  theme.stateId = CBS_PUSHED;
3978  d->drawBackground(theme);
3979  d->dockClose.addPixmap(pm, QIcon::Normal, QIcon::On); // Pressed
3980  pm.fill(Qt::transparent);
3981  theme.stateId = CBS_HOT;
3982  d->drawBackground(theme);
3983  d->dockClose.addPixmap(pm, QIcon::Active, QIcon::Off); // Hover
3984  pm.fill(Qt::transparent);
3985  theme.stateId = CBS_INACTIVE;
3986  d->drawBackground(theme);
3987  d->dockClose.addPixmap(pm, QIcon::Disabled, QIcon::Off); // Disabled
3988  }
3989  }
3990  if (widget && widget->isWindow())
3991  return d->dockClose;
3992  }
3993  break;
3995  if (qstyleoption_cast<const QStyleOptionDockWidget *>(option))
3996  {
3997  if (d->dockFloat.isNull()) {
3998  XPThemeData themeSize(0, 0, QLatin1String("WINDOW"), WP_SMALLCLOSEBUTTON, CBS_NORMAL);
3999  XPThemeData theme(0, 0, QLatin1String("WINDOW"), WP_RESTOREBUTTON, RBS_NORMAL);
4000  if (theme.isValid()) {
4001  SIZE size;
4002  pGetThemePartSize(themeSize.handle(), 0, themeSize.partId, themeSize.stateId, 0, TS_TRUE, &size);
4003  QPixmap pm = QPixmap(size.cx, size.cy);
4004  pm.fill(Qt::transparent);
4005  QPainter p(&pm);
4006  theme.painter = &p;
4007  theme.rect = QRect(0, 0, size.cx, size.cy);
4008  d->drawBackground(theme);
4009  d->dockFloat.addPixmap(pm, QIcon::Normal, QIcon::Off); // Normal
4010  pm.fill(Qt::transparent);
4011  theme.stateId = RBS_PUSHED;
4012  d->drawBackground(theme);
4013  d->dockFloat.addPixmap(pm, QIcon::Normal, QIcon::On); // Pressed
4014  pm.fill(Qt::transparent);
4015  theme.stateId = RBS_HOT;
4016  d->drawBackground(theme);
4017  d->dockFloat.addPixmap(pm, QIcon::Active, QIcon::Off); // Hover
4018  pm.fill(Qt::transparent);
4019  theme.stateId = RBS_INACTIVE;
4020  d->drawBackground(theme);
4021  d->dockFloat.addPixmap(pm, QIcon::Disabled, QIcon::Off); // Disabled
4022  }
4023  }
4024  if (widget && widget->isWindow())
4025  return d->dockFloat;
4026 
4027  }
4028  break;
4029  default:
4030  break;
4031  }
4032 
4034 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
double d
Definition: qnumeric_p.h:62
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget=0) const
void addPixmap(const QPixmap &pixmap, Mode mode=Normal, State state=Off)
Adds pixmap to the icon, as a specialization for mode and state.
Definition: qicon.cpp:814
#define RBS_INACTIVE
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void drawBackground(XPThemeData &themeData)
Main theme drawing function.
#define SIZE(large, small, mini)
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
Definition: qstyle.cpp:2327
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Definition: qicon.cpp:769
static PtrGetThemePartSize pGetThemePartSize
#define MAXBS_INACTIVE
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static bool useXP(bool update=false)
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
#define CBS_INACTIVE

◆ standardPalette()

QPalette QWindowsXPStyle::standardPalette ( ) const
virtual

Reimplemented Function

Reimplemented from QStyle.

Definition at line 3874 of file qwindowsxpstyle.cpp.

Referenced by QWindowsVistaStyle::standardPalette().

3875 {
3878  else
3880 }
virtual QPalette standardPalette() const
Returns the style&#39;s standard palette.
Definition: qstyle.cpp:2283
static QPalette * sys_pal
static bool useXP(bool update=false)

◆ standardPixmap()

QPixmap QWindowsXPStyle::standardPixmap ( StandardPixmap  standardIcon,
const QStyleOption option,
const QWidget widget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 3885 of file qwindowsxpstyle.cpp.

Referenced by QWindowsVistaStyle::standardPixmap().

3887 {
3889  return QWindowsStyle::standardPixmap(standardPixmap, option, widget);
3890 
3891  switch(standardPixmap) {
3892  case SP_TitleBarMaxButton:
3894  if (qstyleoption_cast<const QStyleOptionDockWidget *>(option))
3895  {
3896  if (widget && widget->isWindow()) {
3897  XPThemeData theme(widget, 0, QLatin1String("WINDOW"), WP_SMALLCLOSEBUTTON, CBS_NORMAL);
3898  if (theme.isValid()) {
3899  SIZE sz;
3900  pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &sz);
3901  return QIcon(QWindowsStyle::standardPixmap(standardPixmap, option, widget)).pixmap(QSize(sz.cx, sz.cy));
3902  }
3903  }
3904  }
3905  break;
3906  default:
3907  break;
3908  }
3909  return QWindowsStyle::standardPixmap(standardPixmap, option, widget);
3910 }
QPixmap standardPixmap(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget=0) const
Reimplemented Function
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define SIZE(large, small, mini)
static PtrGetThemePartSize pGetThemePartSize
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
static bool useXP(bool update=false)
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition: qicon.cpp:693
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60

◆ styleHint()

int QWindowsXPStyle::styleHint ( StyleHint  hint,
const QStyleOption option = 0,
const QWidget widget = 0,
QStyleHintReturn returnData = 0 
) const
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 3798 of file qwindowsxpstyle.cpp.

Referenced by drawControl(), and QWindowsVistaStyle::styleHint().

3800 {
3801  QWindowsXPStylePrivate *d = const_cast<QWindowsXPStylePrivate*>(d_func());
3803  return QWindowsStyle::styleHint(hint, option, widget, returnData);
3804 
3805  int res = 0;
3806  switch (hint) {
3807 
3808  case SH_EtchDisabledText:
3809  res = (qobject_cast<const QLabel*>(widget) != 0);
3810  break;
3811 
3813  res = 0;
3814  break;
3815 
3816  case SH_TitleBar_AutoRaise:
3817  case SH_TitleBar_NoBorder:
3818  res = 1;
3819  break;
3820 
3822  if (!widget || (widget && widget->isEnabled()))
3823  res = d->groupBoxTextColor;
3824  else
3825  res = d->groupBoxTextColorDisabled;
3826  break;
3827 
3829  res = 0xC0C0C0;
3830  break;
3831 
3832  case SH_WindowFrame_Mask:
3833  {
3834  res = 1;
3836  const QStyleOptionTitleBar *titlebar = qstyleoption_cast<const QStyleOptionTitleBar *>(option);
3837  if (mask && titlebar) {
3838  // Note certain themes will not return the whole window frame but only the titlebar part when
3839  // queried This function needs to return the entire window mask, hence we will only fetch the mask for the
3840  // titlebar itself and add the remaining part of the window rect at the bottom.
3841  int tbHeight = proxy()->pixelMetric(PM_TitleBarHeight, option, widget);
3842  QRect titleBarRect = option->rect;
3843  titleBarRect.setHeight(tbHeight);
3844  XPThemeData themeData;
3845  if (titlebar->titleBarState & Qt::WindowMinimized) {
3846  themeData = XPThemeData(widget, 0, QLatin1String("WINDOW"), WP_MINCAPTION, CS_ACTIVE, titleBarRect);
3847  } else
3848  themeData = XPThemeData(widget, 0, QLatin1String("WINDOW"), WP_CAPTION, CS_ACTIVE, titleBarRect);
3849  mask->region = d->region(themeData) +
3850  QRect(0, tbHeight, option->rect.width(), option->rect.height() - tbHeight);
3851  }
3852  }
3853  break;
3854 #ifndef QT_NO_RUBBERBAND
3855  case SH_RubberBand_Mask:
3856  if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) {
3857  res = 0;
3858  break;
3859  }
3860 #endif // QT_NO_RUBBERBAND
3861 
3863  res = 1;
3864  break;
3865 
3866  default:
3867  res =QWindowsStyle::styleHint(hint, option, widget, returnData);
3868  }
3869 
3870  return res;
3871 }
double d
Definition: qnumeric_p.h:62
void setHeight(int h)
Sets the height of the rectangle to the given height.
Definition: qrect.h:445
QPointer< QWidget > widget
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
T * qobject_cast(QObject *object)
Definition: qobject.h:375
bool isEnabled() const
Definition: qwidget.h:948
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
The QStyleHintReturnMask class provides style hints that return a QRegion.
Definition: qstyleoption.h:923
QRegion region(XPThemeData &themeData)
T qstyleoption_cast(const QStyleOption *opt)
Definition: qstyleoption.h:885
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static bool useXP(bool update=false)
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
const QStyle * proxy() const
Definition: qstyle.cpp:2546
QRegion region
the region for style hints that return a QRegion
Definition: qstyleoption.h:930
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ subControlRect()

QRect QWindowsXPStyle::subControlRect ( ComplexControl  cc,
const QStyleOptionComplex option,
SubControl  sc,
const QWidget widget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 3511 of file qwindowsxpstyle.cpp.

Referenced by drawComplexControl(), and QWindowsVistaStyle::subControlRect().

3513 {
3515  return QWindowsStyle::subControlRect(cc, option, subControl, widget);
3516 
3517  QRect rect;
3518 
3519  switch (cc) {
3520  case CC_TitleBar:
3521  if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
3522  if (!buttonVisible(subControl, tb))
3523  return rect;
3524  const bool isToolTitle = false;
3525  const int height = tb->rect.height();
3526  const int width = tb->rect.width();
3527  int buttonHeight = GetSystemMetrics(SM_CYSIZE) - 4;
3528  int buttonWidth = GetSystemMetrics(SM_CXSIZE) - 4;
3529  const int delta = buttonWidth + 2;
3530  int controlTop = option->rect.bottom() - buttonHeight - 2;
3531  const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
3532  const bool sysmenuHint = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0;
3533  const bool minimizeHint = (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) != 0;
3534  const bool maximizeHint = (tb->titleBarFlags & Qt::WindowMaximizeButtonHint) != 0;
3535  const bool contextHint = (tb->titleBarFlags & Qt::WindowContextHelpButtonHint) != 0;
3536  const bool shadeHint = (tb->titleBarFlags & Qt::WindowShadeButtonHint) != 0;
3537  bool isMinimized = tb->titleBarState & Qt::WindowMinimized;
3538  bool isMaximized = tb->titleBarState & Qt::WindowMaximized;
3539  int offset = 0;
3540 
3541  switch (subControl) {
3542  case SC_TitleBarLabel:
3543  rect = QRect(frameWidth, 0, width - (buttonWidth + frameWidth + 10), height);
3544  if (isToolTitle) {
3545  if (sysmenuHint) {
3546  rect.adjust(0, 0, -buttonWidth - 3, 0);
3547  }
3548  if (minimizeHint || maximizeHint)
3549  rect.adjust(0, 0, -buttonWidth - 2, 0);
3550  } else {
3551  if (sysmenuHint) {
3552  const int leftOffset = height - 8;
3553  rect.adjust(leftOffset, 0, 0, 0);
3554  }
3555  if (minimizeHint)
3556  rect.adjust(0, 0, -buttonWidth - 2, 0);
3557  if (maximizeHint)
3558  rect.adjust(0, 0, -buttonWidth - 2, 0);
3559  if (contextHint)
3560  rect.adjust(0, 0, -buttonWidth - 2, 0);
3561  if (shadeHint)
3562  rect.adjust(0, 0, -buttonWidth - 2, 0);
3563  }
3564  break;
3565 
3567  if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
3568  offset += delta;
3569  //fall through
3570  case SC_TitleBarMinButton:
3571  if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
3572  offset += delta;
3573  else if (subControl == SC_TitleBarMinButton)
3574  break;
3575  //fall through
3577  if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
3578  offset += delta;
3579  else if (isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
3580  offset += delta;
3581  else if (subControl == SC_TitleBarNormalButton)
3582  break;
3583  //fall through
3584  case SC_TitleBarMaxButton:
3585  if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
3586  offset += delta;
3587  else if (subControl == SC_TitleBarMaxButton)
3588  break;
3589  //fall through
3591  if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
3592  offset += delta;
3593  else if (subControl == SC_TitleBarShadeButton)
3594  break;
3595  //fall through
3597  if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
3598  offset += delta;
3599  else if (subControl == SC_TitleBarUnshadeButton)
3600  break;
3601  //fall through
3603  if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
3604  offset += delta;
3605  else if (subControl == SC_TitleBarCloseButton)
3606  break;
3607 
3608  rect.setRect(width - offset - controlTop + 1, controlTop,
3609  buttonWidth, buttonHeight);
3610  break;
3611 
3612  case SC_TitleBarSysMenu:
3613  {
3614  const int controlTop = 6;
3615  const int controlHeight = height - controlTop - 3;
3616  const int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
3617  QSize iconSize = tb->icon.actualSize(QSize(iconExtent, iconExtent));
3618  if (tb->icon.isNull())
3619  iconSize = QSize(controlHeight, controlHeight);
3620  int hPad = (controlHeight - iconSize.height())/2;
3621  int vPad = (controlHeight - iconSize.width())/2;
3622  rect = QRect(frameWidth + hPad, controlTop + vPad, iconSize.width(), iconSize.height());
3623  }
3624  break;
3625  default:
3626  break;
3627  }
3628  }
3629  break;
3630 
3631  case CC_ComboBox:
3632  if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
3633  int x = cmb->rect.x(), y = cmb->rect.y(), wi = cmb->rect.width(), he = cmb->rect.height();
3634  int xpos = x;
3635  xpos += wi - 1 - 16;
3636 
3637  switch (subControl) {
3638  case SC_ComboBoxFrame:
3639  rect = cmb->rect;
3640  break;
3641 
3642  case SC_ComboBoxArrow:
3643  rect = QRect(xpos, y+1, 16, he-2);
3644  break;
3645 
3646  case SC_ComboBoxEditField:
3647  rect = QRect(x+2, y+2, wi-3-16, he-4);
3648  break;
3649 
3651  rect = cmb->rect;
3652  break;
3653 
3654  default:
3655  break;
3656  }
3657  }
3658  break;
3659 #ifndef QT_NO_WORKSPACE
3660  case CC_MdiControls:
3661  {
3662  int numSubControls = 0;
3663  if (option->subControls & SC_MdiCloseButton)
3664  ++numSubControls;
3665  if (option->subControls & SC_MdiMinButton)
3666  ++numSubControls;
3667  if (option->subControls & SC_MdiNormalButton)
3668  ++numSubControls;
3669  if (numSubControls == 0)
3670  break;
3671 
3672  int buttonWidth = option->rect.width()/ numSubControls;
3673  int offset = 0;
3674  switch (subControl) {
3675  case SC_MdiCloseButton:
3676  // Only one sub control, no offset needed.
3677  if (numSubControls == 1)
3678  break;
3679  offset += buttonWidth;
3680  //FALL THROUGH
3681  case SC_MdiNormalButton:
3682  // No offset needed if
3683  // 1) There's only one sub control
3684  // 2) We have a close button and a normal button (offset already added in SC_MdiClose)
3685  if (numSubControls == 1 || (numSubControls == 2 && !(option->subControls & SC_MdiMinButton)))
3686  break;
3687  if (option->subControls & SC_MdiNormalButton)
3688  offset += buttonWidth;
3689  break;
3690  default:
3691  break;
3692  }
3693  rect = QRect(offset, 0, buttonWidth, option->rect.height());
3694  break;
3695  }
3696 #endif // QT_NO_WORKSPACE
3697 
3698  default:
3699  rect = visualRect(option->direction, option->rect,
3700  QWindowsStyle::subControlRect(cc, option, subControl, widget));
3701  break;
3702  }
3703  return visualRect(option->direction, option->rect, rect);
3704 }
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
Definition: qstyleoption.h:816
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
static bool buttonVisible(const QStyle::SubControl sc, const QStyleOptionTitleBar *tb)
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
int width() const
Returns the width.
Definition: qsize.h:126
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
Definition: qstyle.cpp:2087
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle&#39;s top-left corner to ({x}, {y}), and its size to the given widt...
Definition: qrect.h:400
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
int height() const
Returns the height.
Definition: qsize.h:129
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static bool useXP(bool update=false)
const QStyle * proxy() const
Definition: qstyle.cpp:2546
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
Definition: qstyleoption.h:693
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=0) const
Reimplemented Function

◆ subElementRect()

QRect QWindowsXPStyle::subElementRect ( SubElement  r,
const QStyleOption option,
const QWidget widget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 1237 of file qwindowsxpstyle.cpp.

Referenced by drawComplexControl(), drawPrimitive(), and QWindowsVistaStyle::subElementRect().

1238 {
1240  return QWindowsStyle::subElementRect(sr, option, widget);
1241  }
1242 
1243  QRect rect(option->rect);
1244  switch(sr) {
1247  rect = QWindowsStyle::subElementRect(sr, option, widget);
1248  return rect.translated(0, 1);
1249  break;
1251  if (qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option))
1252  {
1253  rect = QWindowsStyle::subElementRect(sr, option, widget);
1254  if (sr == SE_TabWidgetTabContents) {
1255  if (const QTabWidget *tabWidget = qobject_cast<const QTabWidget *>(widget)) {
1256  if (tabWidget->documentMode())
1257  break;
1258  }
1259 
1260  rect.adjust(0, 0, -2, -2);
1261  }
1262  }
1263  break;
1264  case SE_TabWidgetTabBar: {
1265  rect = QWindowsStyle::subElementRect(sr, option, widget);
1266  const QStyleOptionTabWidgetFrame *twfOption =
1268  if (twfOption && twfOption->direction == Qt::RightToLeft
1269  && (twfOption->shape == QTabBar::RoundedNorth
1270  || twfOption->shape == QTabBar::RoundedSouth))
1271  {
1272  QStyleOptionTab otherOption;
1273  otherOption.shape = (twfOption->shape == QTabBar::RoundedNorth
1275  int overlap = proxy()->pixelMetric(PM_TabBarBaseOverlap, &otherOption, widget);
1276  int borderThickness = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
1277  rect.adjust(-overlap + borderThickness, 0, -overlap + borderThickness, 0);
1278  }
1279  break;}
1280 
1281  case SE_PushButtonContents:
1282  if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1283  MARGINS borderSize;
1284  if (widget) {
1285  XPThemeData buttontheme(widget, 0, QLatin1String("Button"));
1286  HTHEME theme = buttontheme.handle();
1287  if (theme) {
1288  int stateId;
1289  if (!(option->state & State_Enabled))
1290  stateId = PBS_DISABLED;
1291  else if (option->state & State_Sunken)
1292  stateId = PBS_PRESSED;
1293  else if (option->state & State_MouseOver)
1294  stateId = PBS_HOT;
1295  else if (btn->features & QStyleOptionButton::DefaultButton)
1296  stateId = PBS_DEFAULTED;
1297  else
1298  stateId = PBS_NORMAL;
1299 
1300  int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
1301  rect = option->rect.adjusted(border, border, -border, -border);
1302 
1303  int result = pGetThemeMargins(theme,
1304  NULL,
1305  BP_PUSHBUTTON,
1306  stateId,
1308  NULL,
1309  &borderSize);
1310 
1311  if (result == S_OK) {
1312  rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight,
1313  -borderSize.cxRightWidth, -borderSize.cyBottomHeight);
1314  rect = visualRect(option->direction, option->rect, rect);
1315  }
1316  }
1317  }
1318  }
1319  break;
1321  rect = QCommonStyle::subElementRect(SE_ProgressBarGroove, option, widget);
1322  if (option->state & QStyle::State_Horizontal)
1323  rect.adjust(4, 3, -4, -3);
1324  else
1325  rect.adjust(3, 2, -3, -2);
1326  break;
1327  default:
1328  rect = QWindowsStyle::subElementRect(sr, option, widget);
1329  }
1330  return rect;
1331 }
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QTabBar::Shape shape
the tab shape used to draw the tab; by default QTabBar::RoundedNorth
Definition: qstyleoption.h:316
The QStyleOptionTabWidgetFrame class is used to describe the parameters for drawing the frame around ...
Definition: qstyleoption.h:175
static PtrGetThemeMargins pGetThemeMargins
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
Definition: qstyle.cpp:2087
T qstyleoption_cast(const QStyleOption *opt)
Definition: qstyleoption.h:885
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static bool useXP(bool update=false)
const QStyle * proxy() const
Definition: qstyle.cpp:2546
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
Definition: qstyleoption.h:304
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
The QTabWidget class provides a stack of tabbed widgets.
Definition: qtabwidget.h:60
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
QTabBar::Shape shape
the tab shape used to draw the tabs
Definition: qstyleoption.h:183
#define TMT_CONTENTMARGINS

◆ unpolish() [1/2]

void QWindowsXPStyle::unpolish ( QApplication app)
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 1125 of file qwindowsxpstyle.cpp.

Referenced by QWindowsVistaStyle::unpolish().

1126 {
1128 }
void unpolish(QApplication *)
Reimplemented Function

◆ unpolish() [2/2]

void QWindowsXPStyle::unpolish ( QWidget widget)
virtual

Reimplemented Function

Reimplemented from QWindowsStyle.

Definition at line 1195 of file qwindowsxpstyle.cpp.

1196 {
1197 #ifndef QT_NO_RUBBERBAND
1198  if (qobject_cast<QRubberBand*>(widget)) {
1199  widget->setWindowOpacity(1.0);
1200  }
1201 #endif
1203  // Unpolish of widgets is the first thing that
1204  // happens when a theme changes, or the theme
1205  // engine is turned off. So we detect it here.
1206  bool oldState = QWindowsXPStylePrivate::useXP();
1207  bool newState = QWindowsXPStylePrivate::useXP(true);
1208  if ((oldState != newState) && newState) {
1209  d->cleanup(true);
1210  d->init(true);
1211  } else {
1212  // Cleanup handle map, if just changing style,
1213  // or turning it on. In both cases the values
1214  // already in the map might be old (other style).
1215  d->cleanupHandleMap();
1216  }
1217  if (qobject_cast<QAbstractButton*>(widget)
1218  || qobject_cast<QToolButton*>(widget)
1219  || qobject_cast<QTabBar*>(widget)
1220 #ifndef QT_NO_COMBOBOX
1221  || qobject_cast<QComboBox*>(widget)
1222 #endif // QT_NO_COMBOBOX
1223  || qobject_cast<QScrollBar*>(widget)
1224  || qobject_cast<QSlider*>(widget)
1225  || qobject_cast<QHeaderView*>(widget)
1226 #ifndef QT_NO_SPINBOX
1227  || qobject_cast<QAbstractSpinBox*>(widget)
1228  || qobject_cast<QSpinBox*>(widget)
1229 #endif // QT_NO_SPINBOX
1230  || widget->inherits("QWorkspaceChild")
1231  || widget->inherits("Q3TitleBar"))
1232  widget->setAttribute(Qt::WA_Hover, false);
1233  QWindowsStyle::unpolish(widget);
1234 }
double d
Definition: qnumeric_p.h:62
void unpolish(QApplication *)
Reimplemented Function
#define Q_D(Class)
Definition: qglobal.h:2482
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition: qobject.h:275
The QWindowsXPStyle class provides a Microsoft Windows XP-like look and feel.
#define QT_NO_SPINBOX
static bool useXP(bool update=false)
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
#define QT_NO_COMBOBOX
void setWindowOpacity(qreal level)
Definition: qwidget.cpp:11497

Friends and Related Functions

◆ QStyleFactory

friend class QStyleFactory
friend

Definition at line 97 of file qwindowsxpstyle.h.

Properties

◆ reserved

void* QWindowsXPStyle::reserved
private

Definition at line 98 of file qwindowsxpstyle.h.


The documentation for this class was generated from the following files: