Qt 4.8
Public Functions | List of all members
QWindowsCEStyle Class Reference

#include <qwindowscestyle.h>

Inheritance diagram for QWindowsCEStyle:
QWindowsStyle QCommonStyle QStyle QObject

Public Functions

void drawComplexControl (ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
 Reimplemented Function More...
 
void drawControl (ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
 Reimplemented Function 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...
 
void drawPrimitive (PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const
 Reimplemented Function More...
 
SubControl hitTestComplexControl (ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget=0) const
 Reimplemented Function More...
 
int pixelMetric (PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
 Reimplemented Function More...
 
void polish (QWidget *widget)
 Reimplemented Function More...
 
void polish (QPalette &palette)
 Reimplemented Function More...
 
void polish (QApplication *app)
 Reimplemented Function More...
 
 QWindowsCEStyle ()
 
QSize sizeFromContents (ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
 Reimplemented Function More...
 
QPalette standardPalette () const
 Returns the style's standard palette. More...
 
QPixmap standardPixmap (StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
 Reimplemented Function More...
 
int styleHint (StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
 Reimplemented Function More...
 
QRect subControlRect (ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const
 Reimplemented Function More...
 
QRect subElementRect (SubElement element, const QStyleOption *option, const QWidget *widget) const
 Reimplemented Function More...
 
- Public Functions inherited from QWindowsStyle
void drawComplexControl (ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=0) const
 Reimplemented Function More...
 
void drawControl (ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
 Reimplemented Function More...
 
void drawPrimitive (PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=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...
 
 QWindowsStyle ()
 Constructs a QWindowsStyle object. More...
 
QSize sizeFromContents (ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=0) const
 Reimplemented Function More...
 
QPixmap standardPixmap (StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
 Reimplemented Function More...
 
int styleHint (StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
 Reimplemented Function More...
 
QRect subElementRect (SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
 Reimplemented Function More...
 
void unpolish (QApplication *)
 Reimplemented Function More...
 
void unpolish (QWidget *)
 Reimplemented Function 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...
 
 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 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...
 

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 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...
 
- 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

Definition at line 55 of file qwindowscestyle.h.

Constructors and Destructors

◆ QWindowsCEStyle()

QWindowsCEStyle::QWindowsCEStyle ( )

Definition at line 77 of file qwindowscestyle.cpp.

77  : QWindowsStyle() {
78  qApp->setEffectEnabled(Qt::UI_FadeMenu, false);
79  qApp->setEffectEnabled(Qt::UI_AnimateMenu, false);
80 }
#define qApp
QWindowsStyle()
Constructs a QWindowsStyle object.

Functions

◆ drawComplexControl()

void QWindowsCEStyle::drawComplexControl ( ComplexControl  cc,
const QStyleOptionComplex opt,
QPainter p,
const QWidget w 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 1182 of file qwindowscestyle.cpp.

1183  {
1184  switch (control) {
1185  #ifndef QT_NO_SLIDER
1186  case CC_Slider:
1187  if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
1188  int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
1189  int len = pixelMetric(PM_SliderLength, slider, widget);
1190  int ticks = slider->tickPosition;
1191  QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
1192  QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
1193 
1194  if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
1195  int mid = thickness / 2;
1196  if (ticks & QSlider::TicksAbove)
1197  mid += len / 8;
1198  if (ticks & QSlider::TicksBelow)
1199  mid -= len / 8;
1200 
1201  painter->setPen(slider->palette.shadow().color());
1202  if (slider->orientation == Qt::Horizontal) {
1203  QWindowsCEStylePrivate::drawWinCEPanel(painter, groove.x(), groove.y() + mid - 2,
1204  groove.width(), 4, option->palette, true);
1205  painter->drawLine(groove.x() + 1, groove.y() + mid - 1,
1206  groove.x() + groove.width() - 3, groove.y() + mid - 1);
1207  } else {
1208  QWindowsCEStylePrivate::drawWinCEPanel(painter, groove.x() + mid - 2, groove.y(),
1209  4, groove.height(), option->palette, true);
1210  painter->drawLine(groove.x() + mid - 1, groove.y() + 1,
1211  groove.x() + mid - 1, groove.y() + groove.height() - 3);
1212  }
1213  }
1214  if (slider->subControls & SC_SliderTickmarks) {
1215  QStyleOptionSlider tmpSlider = *slider;
1216  tmpSlider.subControls = SC_SliderTickmarks;
1217  QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget);
1218  }
1219 
1220  if (slider->subControls & SC_SliderHandle) {
1221  // 4444440
1222  // 4333310
1223  // 4322210
1224  // 4322210
1225  // 4322210
1226  // 4322210
1227  // *43210*
1228  // **440**
1229  // ***0***
1230  const QColor c0 = slider->palette.shadow().color();
1231  const QColor c1 = slider->palette.dark().color();
1232  // const QColor c2 = g.button();
1233  const QColor c3 = slider->palette.midlight().color();
1234  const QColor c4 = slider->palette.dark().color();
1235  QBrush handleBrush;
1236 
1237  if (slider->state & State_Enabled) {
1238  handleBrush = slider->palette.color(QPalette::Button);
1239  } else {
1240  handleBrush = QBrush(slider->palette.color(QPalette::Button),
1242  }
1243 
1244  int x = handle.x(), y = handle.y(),
1245  wi = handle.width(), he = handle.height();
1246 
1247  int x1 = x;
1248  int x2 = x + wi - 1;
1249  int y1 = y;
1250  int y2 = y + he - 1;
1251 
1252  Qt::Orientation orient = slider->orientation;
1253  bool tickAbove = slider->tickPosition == QSlider::TicksAbove;
1254  bool tickBelow = slider->tickPosition == QSlider::TicksBelow;
1255 
1256  if (slider->state & State_HasFocus) {
1257  QStyleOptionFocusRect fropt;
1258  fropt.QStyleOption::operator=(*slider);
1259  fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
1260  drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
1261  }
1262  if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
1263  Qt::BGMode oldMode = painter->backgroundMode();
1264  painter->setBackgroundMode(Qt::OpaqueMode);
1265  QWindowsCEStylePrivate::drawWinCEButton(painter, QRect(x, y, wi, he), slider->palette, false,
1266  &handleBrush);
1267  painter->setBackgroundMode(oldMode);
1268  QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
1269  if (slider->state & State_Sunken)
1270  painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill);
1271  return;
1272  }
1273  QSliderDirection dir;
1274  if (orient == Qt::Horizontal)
1275  if (tickAbove)
1276  dir = SlUp;
1277  else
1278  dir = SlDown;
1279  else
1280  if (tickAbove)
1281  dir = SlLeft;
1282  else
1283  dir = SlRight;
1284  QPolygon a;
1285  int d = 0;
1286  switch (dir) {
1287  case SlUp:
1288  x2++;
1289  y1 = y1 + wi / 2;
1290  d = (wi + 1) / 2 - 1;
1291  a.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d, y1 - d);
1292  break;
1293  case SlDown:
1294  x2++;
1295  y2 = y2 - wi / 2;
1296  d = (wi + 1) / 2 - 1;
1297  a.setPoints(5, x1, y1, x1, y2, x1 + d, y2+d, x2, y2, x2, y1);
1298  break;
1299  case SlLeft:
1300  d = (he + 1) / 2 - 1;
1301  x1 = x1 + he / 2;
1302  a.setPoints(5, x1, y1, x1 - d, y1 + d, x1, y2, x2, y2, x2, y1);
1303  y1--;
1304  break;
1305  case SlRight:
1306  d = (he + 1) / 2 - 1;
1307  x2 = x2 - he / 2;
1308  a.setPoints(5, x1, y1, x1, y2, x2, y2, x2 + d, y1 + d, x2, y1);
1309  y1--;
1310  break;
1311  }
1312  QBrush oldBrush = painter->brush();
1313  painter->setPen(Qt::NoPen);
1314  painter->setBrush(handleBrush);
1315  Qt::BGMode oldMode = painter->backgroundMode();
1316  painter->setBackgroundMode(Qt::OpaqueMode);
1317  painter->drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
1318  painter->drawPolygon(a);
1319  QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
1320  if (slider->state & State_Sunken)
1321  painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill);
1322  painter->setBrush(oldBrush);
1323  painter->setBackgroundMode(oldMode);
1324 
1325  if (dir != SlUp) {
1326  painter->setPen(c4);
1327  painter->drawLine(x1, y1, x2, y1);
1328  painter->setPen(c3);
1329  painter->drawLine(x1, y1 + 1, x2, y1 + 1);
1330  }
1331  if (dir != SlLeft) {
1332  painter->setPen(c3);
1333  painter->drawLine(x1 + 1, y1 + 1, x1 + 1, y2);
1334  painter->setPen(c4);
1335  painter->drawLine(x1, y1, x1, y2);
1336  }
1337  if (dir != SlRight) {
1338  painter->setPen(c0);
1339  painter->drawLine(x2, y1, x2, y2);
1340  painter->setPen(c1);
1341  painter->drawLine(x2 - 1, y1 + 1, x2 - 1, y2 - 1);
1342  }
1343  if (dir != SlDown) {
1344  painter->setPen(c0);
1345  painter->drawLine(x1, y2, x2, y2);
1346  painter->setPen(c1);
1347  painter->drawLine(x1+1, y2 - 1, x2 - 1, y2 - 1);
1348  }
1349 
1350  switch (dir) {
1351  case SlUp:
1352  if (slider->state & State_Sunken)
1353  painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4,y1), fill);
1354  painter->setPen(c4);
1355  painter->drawLine(x1, y1, x1 + d, y1 - d);
1356  painter->setPen(c0);
1357  d = wi - d - 1;
1358  painter->drawLine(x2, y1, x2 - d, y1 - d);
1359  d--;
1360  painter->setPen(c3);
1361  painter->drawLine(x1 + 1, y1, x1 + 1 + d-1, y1 - d + 1);
1362  painter->setPen(c1);
1363  painter->drawLine(x2 - 1, y1, x2-1 - d, y1 - d);
1364  break;
1365  case SlDown:
1366  if (slider->state & State_Sunken)
1367  painter->fillRect(QRectF(x1 + 3, y2 - d, x2 - x1 - 4,y2 - 8), fill);
1368  painter->setPen(c4);
1369  painter->drawLine(x1, y2, x1 + d, y2 + d);
1370  painter->setPen(c0);
1371  d = wi - d - 1;
1372  painter->drawLine(x2, y2, x2 - d, y2 + d);
1373  d--;
1374  painter->setPen(c3);
1375  painter->drawLine(x1 + 1, y2, x1 + 1 + d - 1, y2 + d - 1);
1376  painter->setPen(c1);
1377  painter->drawLine(x2 - 1, y2, x2 - 1 - d, y2 + d);
1378  break;
1379  case SlLeft:
1380  if (slider->state & State_Sunken)
1381  painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1,y2 - y1 - 3), fill);
1382  painter->setPen(c4);
1383  painter->drawLine(x1, y1, x1 - d, y1 + d);
1384  painter->setPen(c0);
1385  d = he - d - 1;
1386  painter->drawLine(x1, y2, x1 - d, y2 - d);
1387  d--;
1388  painter->setPen(c3);
1389  painter->drawLine(x1, y1 + 1, x1 - d + 1, y1 + 1 + d - 1);
1390  painter->setPen(c1);
1391  painter->drawLine(x1, y2 - 1, x1 - d, y2 - 1 - d);
1392  break;
1393  case SlRight:
1394  if (slider->state & State_Sunken)
1395  painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3), fill);
1396  painter->setPen(c4);
1397  painter->drawLine(x2, y1, x2 + d, y1 + d);
1398  painter->setPen(c0);
1399  d = he - d - 1;
1400  painter->drawLine(x2, y2, x2 + d, y2 - d);
1401  d--;
1402  painter->setPen(c3);
1403  painter->drawLine(x2, y1 + 1, x2 + d - 1, y1 + 1 + d - 1);
1404  painter->setPen(c1);
1405  painter->drawLine(x2, y2 - 1, x2 + d, y2 - 1 - d);
1406  break;
1407  }
1408  }
1409  }
1410  break;
1411 #endif // QT_NO_SLIDER
1412  case CC_ToolButton:
1413  if (const QStyleOptionToolButton *toolbutton
1414  = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
1415  QRect button, menuarea;
1416 
1417 #ifndef QT_NO_TOOLBAR
1418  bool flat = !(widget ? qobject_cast<QToolBar*>(widget->parentWidget()) : 0);
1419 #else
1420  bool flat = true;
1421 #endif
1422 
1423  button = subControlRect(control, toolbutton, SC_ToolButton, widget);
1424  menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
1425 
1426  if (flat && (toolbutton->subControls & SC_ToolButtonMenu)) {
1427  menuarea.setLeft(menuarea.left() - 4);
1428  button.setRight(button.right() - 4);
1429  }
1430 
1431  State bflags = toolbutton->state;
1432 
1433  if (bflags & State_AutoRaise)
1434  if (!(bflags & State_MouseOver)) {
1435  bflags &= ~State_Raised;
1436  }
1437  State mflags = bflags;
1438 
1439  if (toolbutton->activeSubControls & SC_ToolButton)
1440  bflags |= State_Sunken;
1441  if (toolbutton->activeSubControls & SC_ToolButtonMenu)
1442  mflags |= State_Sunken;
1443 
1444  QStyleOption tool(0);
1445  tool.palette = toolbutton->palette;
1446  if (toolbutton->subControls & SC_ToolButton) {
1447  tool.rect = button;
1448  tool.state = bflags;
1449  drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
1450  }
1451 
1452  if (toolbutton->subControls & SC_ToolButtonMenu) {
1453  tool.rect = menuarea;
1454  tool.state = mflags;
1455  tool.state = bflags;
1457 
1458  if (!flat) {
1459 
1460  //connect buttons
1461  painter->save();
1462  painter->setPen(tool.palette.button().color());
1463  painter->drawLine(tool.rect.x() - 2, tool.rect.y(), tool.rect.x() - 2, tool.rect.y() + tool.rect.height());
1464  painter->drawLine(tool.rect.x() - 1, tool.rect.y(), tool.rect.x() - 1, tool.rect.y() + tool.rect.height());
1465  painter->drawLine(tool.rect.x(), tool.rect.y(), tool.rect.x(), tool.rect.y() + tool.rect.height());
1466  painter->drawLine(tool.rect.x() + 1, tool.rect.y(), tool.rect.x() + 1, tool.rect.y() + tool.rect.height());
1467 
1468  if (tool.state & State_Sunken)
1469  {
1470  painter->setPen(tool.palette.midlight().color());
1471  painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 2,
1472  tool.rect.x() + 1, tool.rect.y() + tool.rect.height() -2 );
1473  painter->setPen(tool.palette.shadow().color());
1474  painter->drawLine(tool.rect.x() - 2, tool.rect.y() + 1,tool.rect.x() + 1, tool.rect.y() + 1);
1475  painter->drawLine(tool.rect.x() - 2, tool.rect.y(), tool.rect.x() + 1, tool.rect.y());
1476  painter->setPen(tool.palette.light().color());
1477  painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 1,
1478  tool.rect.x() + 1, tool.rect.y() + tool.rect.height() - 1);
1479  }
1480  else
1481  {
1482  painter->setPen(tool.palette.dark().color());
1483  painter->drawLine(tool.rect.x() - 2, tool.rect.y(),tool.rect.x() + 1, tool.rect.y());
1484  painter->drawLine(tool.rect.x() - 2, tool.rect.y()+tool.rect.height() - 2,tool.rect.x() + 1,
1485  tool.rect.y() + tool.rect.height() - 2);
1486  painter->setPen(tool.palette.midlight().color());
1487  painter->drawLine(tool.rect.x() - 2, tool.rect.y() + 1,tool.rect.x() + 1, tool.rect.y() + 1);
1488  painter->setPen(tool.palette.shadow().color());
1489  painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 1,
1490  tool.rect.x() + 1, tool.rect.y() + tool.rect.height() - 1);
1491  }
1492  painter->restore();
1493  }
1494 
1495 
1496  if (!flat) {
1497  tool.rect.adjust(-3,0,-3,0);
1498  painter->save();
1499  painter->setPen(tool.palette.button().color());
1500  if (tool.state & State_Sunken)
1501  painter->drawLine(tool.rect.x() + 2, tool.rect.y() + 10,
1502  tool.rect.x() + tool.rect.width(), tool.rect.y() + 10);
1503  else
1504  painter->drawLine(tool.rect.x() + 1, tool.rect.y() + 9, tool.rect.x() +
1505  tool.rect.width() - 1, tool.rect.y() + 9);
1506  painter->restore();
1507  } else {
1508  tool.rect.adjust(-1,0,-1,0);
1509  }
1510 
1511  drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
1512  }
1513 
1514  if (toolbutton->state & State_HasFocus) {
1516  fr.QStyleOption::operator=(*toolbutton);
1517  fr.rect.adjust(3, 3, -3, -3);
1518  if (toolbutton->features & QStyleOptionToolButton::Menu)
1520  toolbutton, widget), 0);
1521  drawPrimitive(PE_FrameFocusRect, &fr, painter, widget);
1522  }
1523  QStyleOptionToolButton label = *toolbutton;
1524  int fw = pixelMetric(PM_DefaultFrameWidth, option, widget);
1525  label.rect = button.adjusted(fw, fw, -fw, -fw);
1526  drawControl(CE_ToolButtonLabel, &label, painter, widget);
1527  }
1528  break;
1529 
1530 #ifndef QT_NO_GROUPBOX
1531  case CC_GroupBox:
1532  if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
1533  // Draw frame
1534  painter->save();
1535  QFont f = painter->font();
1536  f.setBold(true);
1537  painter->setFont(f);
1538  QStyleOptionGroupBox groupBoxFont = *groupBox;
1539  groupBoxFont.fontMetrics = QFontMetrics(f);
1540  QRect textRect = subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget);
1541  QRect checkBoxRect = subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget);
1542  if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
1543  QStyleOptionFrameV2 frame;
1544  frame.QStyleOption::operator=(*groupBox);
1545  frame.features = groupBox->features;
1546  frame.lineWidth = groupBox->lineWidth;
1547  frame.midLineWidth = groupBox->midLineWidth;
1549  painter->save();
1550 
1551  QRegion region(groupBox->rect);
1552  if (!groupBox->text.isEmpty()) {
1553  bool ltr = groupBox->direction == Qt::LeftToRight;
1554  QRect finalRect = checkBoxRect.united(textRect);
1555  if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox)
1556  finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0);
1557  region -= finalRect;
1558  }
1559  painter->setClipRegion(region);
1560  drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
1561  painter->restore();
1562  }
1563 
1564  // Draw title
1565  if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
1566  QColor textColor = groupBox->textColor;
1567  if (textColor.isValid())
1568  painter->setPen(textColor);
1569  int alignment = int(groupBox->textAlignment);
1571  alignment |= Qt::TextHideMnemonic;
1572 
1573  drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
1574  groupBox->palette, groupBox->state & State_Enabled, groupBox->text,
1576 
1577  if (groupBox->state & State_HasFocus) {
1578  QStyleOptionFocusRect fropt;
1579  fropt.QStyleOption::operator=(*groupBox);
1580  fropt.rect = textRect;
1581  drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
1582  }
1583  }
1584  // Draw checkbox
1585  if (groupBox->subControls & SC_GroupBoxCheckBox) {
1586  QStyleOptionButton box;
1587  box.QStyleOption::operator=(*groupBox);
1588  box.rect = checkBoxRect;
1589  drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
1590  }
1591  painter->restore();
1592  }
1593  break;
1594 #endif //QT_NO_GROUPBOX
1595 #ifndef QT_NO_COMBOBOX
1596  case CC_ComboBox:
1597  if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
1598  QBrush editBrush = cmb->palette.brush(QPalette::Base);
1599  if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame)
1600  QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, true, &editBrush);
1601  else
1602  painter->fillRect(option->rect, editBrush);
1603 
1604  if (cmb->subControls & SC_ComboBoxArrow) {
1605  State flags = State_None;
1606 
1608  if (cmb->activeSubControls == SC_ComboBoxArrow) {
1609  painter->setPen(cmb->palette.dark().color());
1610  painter->setBrush(cmb->palette.brush(QPalette::Button));
1611  painter->drawRect(ar.adjusted(0, 0, -1, -1));
1612  QWindowsCEStylePrivate::drawWinCEButton(painter, ar.adjusted(0, 0, -1, -1), option->palette, true,
1613  &cmb->palette.brush(QPalette::Button));
1614  } else {
1615  // Make qDrawWinButton use the right colors for drawing the shade of the button
1616 
1617  QWindowsCEStylePrivate::drawWinCEButton(painter, ar, option->palette, false,
1618  &cmb->palette.brush(QPalette::Button));
1619  }
1620 
1621  ar.adjust(2, 2, -2, -2);
1622  if (option->state & State_Enabled)
1623  flags |= State_Enabled;
1624 
1625  if (cmb->activeSubControls == SC_ComboBoxArrow)
1626  flags |= State_Sunken;
1627  QStyleOption arrowOpt(0);
1628  arrowOpt.rect = ar;
1629  arrowOpt.palette = cmb->palette;
1630  arrowOpt.state = flags;
1631  drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
1632  }
1633  if (cmb->subControls & SC_ComboBoxEditField) {
1635  if (cmb->state & State_HasFocus && !cmb->editable)
1636  painter->fillRect(re.x(), re.y(), re.width(), re.height(),
1637  cmb->palette.brush(QPalette::Highlight));
1638  if (cmb->state & State_HasFocus) {
1639  painter->setPen(cmb->palette.highlightedText().color());
1640  painter->setBackground(cmb->palette.highlight());
1641  } else {
1642  painter->setPen(cmb->palette.text().color());
1643  painter->setBackground(cmb->palette.background());
1644  }
1645  if (cmb->state & State_HasFocus && !cmb->editable) {
1646  QStyleOptionFocusRect focus;
1647  focus.QStyleOption::operator=(*cmb);
1649  focus.state |= State_FocusAtBorder;
1650  focus.backgroundColor = cmb->palette.highlight().color();
1651  drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
1652  }
1653  }
1654  }
1655  break;
1656 #endif // QT_NO_COMBOBOX
1657 #ifndef QT_NO_SPINBOX
1658  case CC_SpinBox:
1659  if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
1660  QStyleOptionSpinBox copy = *sb;
1661  PrimitiveElement pe;
1662 
1663  if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
1665  QWindowsCEStylePrivate::drawWinCEPanel(painter, r, option->palette, true);
1666  }
1667  QPalette shadePal(option->palette);
1668  shadePal.setColor(QPalette::Button, option->palette.light().color());
1669  shadePal.setColor(QPalette::Light, option->palette.button().color());
1670 
1672 
1673  if (sb->subControls & SC_SpinBoxUp) {
1674  copy.subControls = SC_SpinBoxUp;
1675  QPalette pal2 = sb->palette;
1676  if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
1678  copy.state &= ~State_Enabled;
1679  }
1680  copy.palette = pal2;
1681  if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken)) {
1682  copy.state |= State_On;
1683  copy.state |= State_Sunken;
1684  } else {
1685  copy.state |= State_Raised;
1686  copy.state &= ~State_Sunken;
1687  }
1688  if (reverse)
1689  pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
1691  else
1692  pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
1693  : PE_IndicatorSpinUp);
1695  QWindowsCEStylePrivate::drawWinCEButton(painter, copy.rect, option->palette, copy.state & (State_Sunken | State_On),
1696  &copy.palette.brush(QPalette::Button));
1697  copy.rect.adjust(3, 0, -4, 0);
1698  drawPrimitive(pe, &copy, painter, widget);
1699  }
1700  if (sb->subControls & SC_SpinBoxDown) {
1701  copy.subControls = SC_SpinBoxDown;
1702  copy.state = sb->state;
1703  QPalette pal2 = sb->palette;
1704  if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
1706  copy.state &= ~State_Enabled;
1707  }
1708  copy.palette = pal2;
1709 
1710  if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken)) {
1711  copy.state |= State_On;
1712  copy.state |= State_Sunken;
1713  } else {
1714  copy.state |= State_Raised;
1715  copy.state &= ~State_Sunken;
1716  }
1717  if (reverse)
1718  pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
1719  : PE_IndicatorSpinUp);
1720  else
1721  pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
1724  QWindowsCEStylePrivate::drawWinCEButton(painter, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
1725  &copy.palette.brush(QPalette::Button));
1726 
1727  copy.rect.adjust(3, 0, -4, 0);
1728  if (pe == PE_IndicatorArrowUp || pe == PE_IndicatorArrowDown) {
1729  copy.rect = copy.rect.adjusted(1, 1, -1, -1);
1730  drawPrimitive(pe, &copy, painter, widget);
1731  }
1732  else {
1733  drawPrimitive(pe, &copy, painter, widget);
1734  }
1735  if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
1737  painter->save();
1738  painter->setPen(option->palette.light().color());
1739  painter->drawLine(r.x() + 1 + r.width(), r.y() - 2, r.x() + 1 + r.width(), r.y() + r.height() + 1);
1740  painter->setPen(option->palette.midlight().color());
1741  painter->drawLine(r.x() + r.width(), r.y() - 1, r.x() + r.width(), r.y() + r.height());
1742  painter->restore();
1743  }
1744  }
1745  }
1746  break;
1747 #endif // QT_NO_SPINBOX
1748 
1749  default:
1750  QWindowsStyle::drawComplexControl(control, option, painter, widget);
1751  break;
1752  }
1753 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
static Qt::LayoutDirection layoutDirection()
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
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
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
QPointer< QWidget > widget
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
QRect united(const QRect &other) const
Returns the bounding rectangle of this rectangle and the given rectangle.
Definition: qrect.h:491
static C reverse(const C &l)
static void drawWinCEPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=0)
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
Reimplemented Function
QSliderDirection
long ASN1_INTEGER_get ASN1_INTEGER * a
The QPolygon class provides a vector of points using integer precision.
Definition: qpolygon.h:60
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
Definition: qstyleoption.h:91
T * qobject_cast(QObject *object)
Definition: qobject.h:375
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
The QStyleOptionToolButton class is used to describe the parameters for drawing a tool button...
Definition: qstyleoption.h:768
QColor backgroundColor
the background color on which the focus rectangle is being drawn
Definition: qstyleoption.h:109
void setCurrentColorGroup(ColorGroup cg)
Set the palette&#39;s current color group to cg.
Definition: qpalette.h:105
int lineWidth
the line width for drawing the frame
Definition: qstyleoption.h:124
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.
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const
Reimplemented Function
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
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
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
The QToolBar class provides a movable panel that contains a set of controls.
Definition: qtoolbar.h:62
The QStyleOptionSpinBox class is used to describe the parameters necessary for drawing a spin box...
Definition: qstyleoption.h:729
QColor dark(int f=200) const
Use darker(factor) instead.
Definition: qcolor.cpp:2447
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
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
Definition: qrect.h:264
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
The State element defines configurations of objects and properties.
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
FrameFeatures features
a bitwise OR of the features that describe this frame.
Definition: qstyleoption.h:143
static void drawWinCEButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=0)
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
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const
Reimplemented Function
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
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
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
Definition: qrect.h:258
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int midLineWidth
the mid-line width for drawing the frame
Definition: qstyleoption.h:125
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QStyleOptionGroupBox class describes the parameters for drawing a group box.
Definition: qstyleoption.h:834
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QStyleOptionFrameV2 class is used to describe the parameters necessary for drawing a frame in Qt ...
Definition: qstyleoption.h:134
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
Definition: qstyleoption.h:701
void setPoints(int nPoints, const int *points)
Resizes the polygon to nPoints and populates it with the given points.
Definition: qpolygon.cpp:350
bool isValid() const
Returns true if the color is valid; otherwise returns false.
Definition: qcolor.h:295
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
Orientation
Definition: qnamespace.h:174
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279
BGMode
Definition: qnamespace.h:588
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
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ drawControl()

void QWindowsCEStyle::drawControl ( ControlElement  element,
const QStyleOption opt,
QPainter p,
const QWidget w 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 555 of file qwindowscestyle.cpp.

Referenced by drawComplexControl().

556  {
557  switch (element) {
558  #ifndef QT_NO_MENU
559  case CE_MenuTearoff: {
560  if(option->state & State_Selected) {
561  if(pixelMetric(PM_MenuPanelWidth, option, widget) > 1)
562  qDrawShadePanel(painter, option->rect.x(), option->rect.y(), option->rect.width(),
563  option->rect.height(), option->palette, false, 2,
564  &option->palette.brush(QPalette::Button));
565  else
566  qDrawShadePanel(painter, option->rect.x() + 1, option->rect.y() + 1, option->rect.width() - 2,
567  option->rect.height() - 2, option->palette, true, 1, &option->palette.brush(QPalette::Button));
568  } else {
569  painter->fillRect(option->rect, option->palette.brush(QPalette::Button));
570  }
571  painter->setPen(QPen(option->palette.dark().color(), 1, Qt::DashLine));
572  painter->drawLine(option->rect.x()+2, option->rect.y()+option->rect.height()/2-1, option->rect.x()+option->rect.width()-4,
573  option->rect.y()+option->rect.height()/2-1);
574  painter->setPen(QPen(option->palette.light().color(), 1, Qt::DashLine));
575  painter->drawLine(option->rect.x()+2, option->rect.y()+option->rect.height()/2, option->rect.x()+option->rect.width()-4,
576  option->rect.y()+option->rect.height()/2);
577  break; }
578 
579 
580  case CE_MenuBarItem:
581  if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
582  bool active = mbi->state & State_Selected;
583  bool hasFocus = mbi->state & State_HasFocus;
584  bool down = mbi->state & State_Sunken;
585  QStyleOptionMenuItem newMbi = *mbi;
586  if (active || hasFocus) {
587  QBrush b = mbi->palette.brush(QPalette::Highlight);
588  if (active && down) {
589  painter->fillRect(mbi->rect.adjusted(0, 1, 0, -1), b);
590  }
591  }
595  alignment |= Qt::TextHideMnemonic;
596 
597  painter->save();
598  QFont f = painter->font();
599  f.setBold(true);
600  painter->setFont(f);
601  QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize),
602  (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
603  if (!pix.isNull())
604  drawItemPixmap(painter,mbi->rect, alignment, pix);
605  else
606  if (active && down)
607  drawItemText(painter, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled,
608  mbi->text, QPalette::Light);
609  else
610  drawItemText(painter, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled,
611  mbi->text, QPalette::ButtonText);
612  painter->restore();
613  }
614  break;
615 
616  case CE_MenuBarEmptyArea:
617  painter->save();
618  painter->setPen(option->palette.shadow().color());
620  painter->eraseRect(option->rect);
621  QRect r = option->rect;
622  painter->drawLine(r.x() + 1, r.y() + 1, r.x()+ 1, r.y()+ r.height() - 2);
623  painter->drawLine(r.x() - 2 + r.width(), r.y() + 1, r.x() - 2 + r.width(), r.y() + r.height() - 2);
624  painter->drawLine(r.x() + 1, r.y() +1, r.x() - 1 + r.width(), r.y() + 1);
625  painter->drawLine(r.x() + 1, r.y() + r.height()-2 , r.x() - 2 + r.width(), r.y() + r.height() - 2);
626  }
627  painter->restore();
628  break;
629 
630  case CE_MenuItem:
631  if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
632  int x, y, w, h;
633  menuitem->rect.getRect(&x, &y, &w, &h);
634  int tab = menuitem->tabWidth;
635  bool dis = !(menuitem->state & State_Enabled);
636  bool checked = menuitem->checkType != QStyleOptionMenuItem::NotCheckable
637  ? menuitem->checked : false;
638  bool act = menuitem->state & State_Selected;
639 
640  // windows always has a check column, regardless whether we have an icon or not
641  int checkcol = qMax(menuitem->maxIconWidth, windowsCheckMarkWidth);
642  QBrush fill = menuitem->palette.brush(act ? QPalette::Highlight : QPalette::Button);
643  painter->fillRect(menuitem->rect.adjusted(1, 1, 0, 0), fill);
644 
645  if (menuitem->menuItemType == QStyleOptionMenuItem::Separator) {
646  int yoff = y-1 + h / 2;
647  painter->setPen(menuitem->palette.shadow().color());
648  painter->drawLine(x + 4, yoff + 1, x + w - 8, yoff + 1);
649  return;
650  }
651 
652  QRect vCheckRect = visualRect(option->direction, menuitem->rect, QRect(menuitem->rect.x(),
653  menuitem->rect.y(), checkcol, menuitem->rect.height()));
654  if (checked) {
655  if (act && !dis) {
656  qDrawPlainRect(painter, vCheckRect,
657  menuitem->palette.button().color(), 1,
658  &menuitem->palette.brush(QPalette::Button));
659  } else {
660  QBrush fill(menuitem->palette.button().color(), Qt::Dense4Pattern);
661  qDrawPlainRect(painter, vCheckRect,menuitem->palette.button().color(), 1, &fill);
662  }
663  } else if (!act) {
664  painter->fillRect(vCheckRect, menuitem->palette.brush(QPalette::Button));
665  }
666  // On Windows Style, if we have a checkable item and an icon we
667  // draw the icon recessed to indicate an item is checked. If we
668  // have no icon, we draw a checkmark instead.
669  if (!menuitem->icon.isNull()) {
671  if (act && !dis)
672  mode = QIcon::Active;
673  QPixmap pixmap;
674  if (checked)
675  pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On);
676  else
677  pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode);
678  int pixw = pixmap.width();
679  int pixh = pixmap.height();
680  if (act && !dis && !checked)
681  qDrawPlainRect(painter, vCheckRect, menuitem->palette.button().color(), 1,
682  &menuitem->palette.brush(QPalette::Button));
683  QRect pmr(0, 0, pixw, pixh);
684  pmr.moveCenter(vCheckRect.center());
685  painter->setPen(menuitem->palette.text().color());
686  painter->drawPixmap(pmr.topLeft(), pixmap);
687  } else if (checked) {
688  QStyleOptionMenuItem newMi = *menuitem;
689  newMi.state = State_None;
690  if (!dis)
691  newMi.state |= State_Enabled;
692  if (act)
693  newMi.state |= State_On;
694  newMi.rect = visualRect(option->direction, menuitem->rect, QRect(menuitem->rect.x()
695  + windowsItemFrame, menuitem->rect.y() + windowsItemFrame,
696  checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame));
698  }
699  painter->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color());
700 
701  QColor discol;
702  if (dis) {
703  discol = menuitem->palette.text().color();
704  painter->setPen(discol);
705  }
706  int xm = windowsItemFrame + checkcol + windowsItemHMargin;
707  int xpos = menuitem->rect.x() + xm;
708  QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
709  QRect vTextRect = visualRect(option->direction, menuitem->rect, textRect);
710  QString s = menuitem->text;
711  if (!s.isEmpty()) { // draw text
712  painter->save();
713  int t = s.indexOf(QLatin1Char('\t'));
715  if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
716  text_flags |= Qt::TextHideMnemonic;
717  text_flags |= Qt::AlignLeft;
718  if (t >= 0) {
719  QRect vShortcutRect = visualRect(option->direction, menuitem->rect,
720  QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
721  if (dis && !act)
722  painter->setPen(discol);
723  painter->drawText(vShortcutRect, text_flags, s.mid(t + 1));
724  s = s.left(t);
725  }
726  QFont font = menuitem->font;
727  if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
728  font.setBold(true);
729  painter->setFont(font);
730  if (dis && !act)
731  painter->setPen(discol);
732  painter->drawText(vTextRect, text_flags, s.left(t));
733  painter->restore();
734  }
735  if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
736  int dim = (h - 2 * windowsItemFrame) / 2;
737  PrimitiveElement arrow;
738  arrow = (option->direction == Qt::RightToLeft) ? PE_IndicatorSpinDown : PE_IndicatorSpinUp;
739  xpos = x + w - windowsArrowHMargin - windowsItemFrame - dim;
740  QRect vSubMenuRect = visualRect(option->direction, menuitem->rect, QRect(xpos, y + h / 2 - dim / 2, dim, dim));
741  QStyleOptionMenuItem newMI = *menuitem;
742  newMI.rect = vSubMenuRect;
743  newMI.state = dis ? State_None : State_Enabled;
744  if (act)
746  newMI.palette.highlightedText().color());
747  drawPrimitive(arrow, &newMI, painter, widget);
748  }
749  }
750  break;
751 #endif // QT_NO_MENU
752  case CE_MenuVMargin:
753  painter->fillRect(option->rect, Qt::white);
754  break;
755  case CE_MenuEmptyArea:
756  QWindowsStyle::drawControl(element,option, painter, widget);
757  break;
758 
759 #ifndef QT_NO_TABBAR
760  case CE_TabBarTab:
761  if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
762  drawControl(CE_TabBarTabShape, tab, painter, widget);
763  drawControl(CE_TabBarTabLabel, tab, painter, widget);
764  }
765  break;
766  case CE_TabBarTabShape:
767  if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
768  bool rtlHorTabs = (tab->direction == Qt::RightToLeft
769  && (tab->shape == QTabBar::RoundedNorth
770  || tab->shape == QTabBar::RoundedSouth));
771  bool selected = tab->state & State_Selected;
772  bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
773  || (rtlHorTabs
774  && tab->position == QStyleOptionTab::Beginning));
775  bool firstTab = ((!rtlHorTabs
776  && tab->position == QStyleOptionTab::Beginning)
777  || (rtlHorTabs
778  && tab->position == QStyleOptionTab::End));
779  bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
780  bool previousSelected =
781  ((!rtlHorTabs
782  && tab->selectedPosition == QStyleOptionTab::PreviousIsSelected)
783  || (rtlHorTabs
784  && tab->selectedPosition == QStyleOptionTab::NextIsSelected));
785  bool nextSelected =
786  ((!rtlHorTabs
787  && tab->selectedPosition == QStyleOptionTab::NextIsSelected)
788  || (rtlHorTabs
789  && tab->selectedPosition
791  int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget);
792  bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft)
793  || (rtlHorTabs
794  && tabBarAlignment == Qt::AlignRight);
795 
796  bool rightAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignRight)
797  || (rtlHorTabs
798  && tabBarAlignment == Qt::AlignLeft);
799  QColor light = tab->palette.light().color();
800  QColor midlight = tab->palette.midlight().color();
801  QColor dark = tab->palette.dark().color();
802  QColor shadow = tab->palette.shadow().color();
803  QColor background = tab->palette.background().color();
804  int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget);
805  if (selected)
806  borderThinkness /= 2;
807  QRect r2(option->rect);
808  int x1 = r2.left();
809  int x2 = r2.right();
810  int y1 = r2.top();
811  int y2 = r2.bottom();
812  switch (tab->shape) {
813  default:
814  QCommonStyle::drawControl(element, tab, painter, widget);
815  break;
816  case QTabBar::RoundedNorth: {
817  if (!selected) {
818  y1 += 2;
819  x1 += firstTab ? borderThinkness : 0;
820  x2 -= lastTab ? borderThinkness : 0;
821  }
822 
823  painter->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 2), tab->palette.background());
824 
825  // Delete border
826  if (selected) {
827  painter->setPen(background);
828  painter->drawLine(x1, y2 - 1, x2, y2 - 1);
829  painter->drawLine(x1, y2 + 1, x2, y2 + 1);
830  painter->drawLine(x1, y2, x2, y2);
831  }
832  // Left
833  if (firstTab || selected || onlyOne || !previousSelected) {
834  painter->setPen(dark);
835  painter->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
836  painter->drawPoint(x1 + 1, y1 + 1);
837  painter->setPen(midlight);
838  painter->drawLine(x1 + 1, y1 + 2, x1 + 1, y2 -
839  ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
840 
841  }
842  // Top
843  {
844  int beg = x1 + (previousSelected ? 0 : 2);
845  int end = x2 - (nextSelected ? 0 : 2);
846  painter->setPen(dark);
847  painter->drawLine(beg, y1, end, y1);
848 
849  painter->setPen(midlight);
850  painter->drawLine(beg, y1 + 1, end, y1 + 1);
851 
852  }
853  // Right
854  if (lastTab || selected || onlyOne || !nextSelected) {
855  painter->setPen(shadow);
856  painter->drawLine(x2, y1 + 2, x2, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
857  painter->drawPoint(x2 - 1, y1 + 1);
858  painter->setPen(dark);
859  painter->drawLine(x2 - 1, y1 + 2, x2 - 1, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
860  }
861  break; }
862  case QTabBar::RoundedSouth: {
863  if (!selected) {
864  y2 -= 2;
865  x1 += firstTab ? borderThinkness : 0;
866  x2 -= lastTab ? borderThinkness : 0;
867  }
868 
869  painter->fillRect(QRect(x1 + 1, y1 + 2, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background());
870 
871  // Delete border
872  if (selected) {
873  painter->setPen(background);
874  painter->drawLine(x1, y1 + 1, x2 - 1, y1 + 1);
875  painter->drawLine(x1, y1 - 1, x2 - 1, y1 - 1);
876  painter->drawLine(x1, y1, x2 - 1, y1);
877  }
878  // Left
879  if (firstTab || selected || onlyOne || !previousSelected) {
880  painter->setPen(dark);
881  painter->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
882  painter->drawPoint(x1 + 1, y2 - 1);
883  painter->setPen(midlight);
884  painter->drawLine(x1 + 1, y2 - 2, x1 + 1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
885  }
886  // Bottom
887  {
888  int beg = x1 + (previousSelected ? 0 : 2);
889  int end = x2 - (nextSelected ? 0 : 2);
890  painter->setPen(shadow);
891  painter->drawLine(beg, y2, end, y2);
892  painter->setPen(dark);
893  painter->drawLine(beg, y2 - 1, end, y2 - 1);
894  }
895  // Right
896  if (lastTab || selected || onlyOne || !nextSelected) {
897  painter->setPen(shadow);
898  painter->drawLine(x2, y2 - 2, x2, y1 + ((onlyOne || lastTab) && selected &&
899  rightAligned ? 0 : borderThinkness));
900  painter->drawPoint(x2 - 1, y2 - 1);
901  painter->setPen(dark);
902  painter->drawLine(x2 - 1, y2 - 2, x2 - 1, y1 + ((onlyOne || lastTab) && selected &&
903  rightAligned ? 0 : borderThinkness));
904  }
905  break; }
906  case QTabBar::RoundedWest: {
907  if (!selected) {
908  x1 += 2;
909  y1 += firstTab ? borderThinkness : 0;
910  y2 -= lastTab ? borderThinkness : 0;
911  }
912 
913  painter->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 2, (y2 - y1) - 1), tab->palette.background());
914 
915  // Delete border
916  if (selected) {
917  painter->setPen(background);
918  painter->drawLine(x2 - 1, y1, x2 - 1, y2);
919  painter->drawLine(x2, y1, x2, y2);
920  }
921  // Top
922  if (firstTab || selected || onlyOne || !previousSelected) {
923  painter->setPen(dark);
924  painter->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected &&
925  leftAligned ? 0 : borderThinkness), y1);
926  painter->drawPoint(x1 + 1, y1 + 1);
927  painter->setPen(midlight);
928  painter->drawLine(x1 + 2, y1 + 1, x2 - ((onlyOne || firstTab) && selected &&
929  leftAligned ? 0 : borderThinkness), y1 + 1);
930  }
931  // Left
932  {
933  int beg = y1 + (previousSelected ? 0 : 2);
934  int end = y2 - (nextSelected ? 0 : 2);
935  painter->setPen(dark);
936  painter->drawLine(x1, beg, x1, end);
937  painter->setPen(midlight);
938  painter->drawLine(x1 + 1, beg, x1 + 1, end);
939  }
940  // Bottom
941  if (lastTab || selected || onlyOne || !nextSelected) {
942  painter->setPen(shadow);
943  painter->drawLine(x1 + 3, y2, x2 - ((onlyOne || lastTab) && selected &&
944  rightAligned ? 0 : borderThinkness), y2);
945  painter->drawPoint(x1 + 2, y2 - 1);
946  painter->setPen(dark);
947  painter->drawLine(x1 + 3, y2 - 1, x2 - ((onlyOne || lastTab) && selected &&
948  rightAligned ? 0 : borderThinkness), y2 - 1);
949  painter->drawPoint(x1 + 1, y2 - 1);
950  painter->drawPoint(x1 + 2, y2);
951  }
952  break; }
953  case QTabBar::RoundedEast: {
954  if (!selected) {
955  x2 -= 2;
956  y1 += firstTab ? borderThinkness : 0;
957  y2 -= lastTab ? borderThinkness : 0;
958  }
959 
960  painter->fillRect(QRect(x1 + 2, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background());
961 
962  // Delete border
963  if (selected) {
964  painter->setPen(background);
965  painter->drawLine(x1 + 1, y1, x1 + 1, y2 - 1);
966  painter->drawLine(x1, y1, x1, y2 - 1);
967  }
968  // Top
969  if (firstTab || selected || onlyOne || !previousSelected) {
970  painter->setPen(dark);
971  painter->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected &&
972  leftAligned ? 0 : borderThinkness), y1);
973  painter->drawPoint(x2 - 1, y1 + 1);
974  painter->setPen(midlight);
975  painter->drawLine(x2 - 3, y1 + 1, x1 + ((onlyOne || firstTab) &&
976  selected && leftAligned ? 0 : borderThinkness), y1 + 1);
977  painter->drawPoint(x2 - 1, y1);
978 
979  }
980  // Right
981  {
982  int beg = y1 + (previousSelected ? 0 : 2);
983  int end = y2 - (nextSelected ? 0 : 2);
984  painter->setPen(shadow);
985  painter->drawLine(x2, beg, x2, end);
986  painter->setPen(dark);
987  painter->drawLine(x2 - 1, beg, x2 - 1, end);
988  }
989  // Bottom
990  if (lastTab || selected || onlyOne || !nextSelected) {
991  painter->setPen(shadow);
992  painter->drawLine(x2 - 2, y2, x1 + ((onlyOne || lastTab) &&
993  selected && rightAligned ? 0 : borderThinkness), y2);
994  painter->drawPoint(x2 - 1, y2 - 1);
995  painter->setPen(dark);
996  painter->drawLine(x2 - 2, y2 - 1, x1 + ((onlyOne || lastTab) &&
997  selected && rightAligned ? 0 : borderThinkness), y2 - 1);
998  }
999  break; }
1000  }
1001  }
1002  break;
1003 #endif // QT_NO_TABBAR
1004 
1005  case CE_ToolBar: {
1006  QRect rect = option->rect;
1007  painter->setPen(QPen(option->palette.dark().color()));
1008  painter->drawLine(rect.topRight().x()-1,
1009  rect.topRight().y(),
1010  rect.bottomRight().x()-1,
1011  rect.bottomRight().y());
1012  painter->drawLine(rect.bottomLeft().x(),
1013  rect.bottomLeft().y(),
1014  rect.bottomRight().x(),
1015  rect.bottomRight().y());
1016  painter->setPen(QPen(option->palette.light().color()));
1017  painter->drawLine(rect.topRight().x(),
1018  rect.topRight().y(),
1019  rect.bottomRight().x(),
1020  rect.bottomRight().y());
1021  painter->drawLine(rect.topLeft().x(),
1022  rect.topLeft().y(),
1023  rect.topRight().x(),
1024  rect.topRight().y());
1025 
1026  break; }
1027 #ifndef QT_NO_SCROLLBAR
1028  case CE_ScrollBarSubLine:
1029  case CE_ScrollBarAddLine: {
1030  if (option->state & State_Sunken) {
1031  QStyleOption buttonOpt = *option;
1032 
1033  drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget);
1034  } else {
1035  QStyleOption buttonOpt = *option;
1036  if (!(buttonOpt.state & State_Sunken))
1037  buttonOpt.state |= State_Raised;
1038  drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget);
1039  }
1040  PrimitiveElement arrow;
1041  if (option->state & State_Horizontal) {
1042  if (element == CE_ScrollBarAddLine)
1043  arrow = option->direction == Qt::LeftToRight ? PE_IndicatorArrowRight : PE_IndicatorArrowLeft;
1044  else
1045  arrow = option->direction == Qt::LeftToRight ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
1046  } else {
1047  if (element == CE_ScrollBarAddLine)
1048  arrow = PE_IndicatorArrowDown;
1049  else
1050  arrow = PE_IndicatorArrowUp;
1051  }
1052  drawPrimitive(arrow, option, painter, widget);
1053  break; }
1054  case CE_ScrollBarAddPage:
1055  case CE_ScrollBarSubPage: {
1056  QBrush br;
1057  QBrush bg = painter->background();
1058  Qt::BGMode bg_mode = painter->backgroundMode();
1059  painter->setPen(Qt::NoPen);
1060  painter->setBackgroundMode(Qt::OpaqueMode);
1061 
1062  if (option->state & State_Sunken) {
1063  br = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern);
1064  painter->setBackground(option->palette.dark().color());
1065  painter->setBrush(br);
1066  } else {
1067  QPixmap pm = option->palette.brush(QPalette::Light).texture();
1068  if (option->state & State_Enabled)
1069  br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.button().color(), Qt::Dense4Pattern);
1070  else
1071  br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.light().color(), Qt::Dense4Pattern);
1072  painter->setBackground(option->palette.base().color());
1073  painter->setBrush(br);
1074  }
1075  painter->drawRect(option->rect);
1076  painter->setBackground(bg);
1077  painter->setBackgroundMode(bg_mode);
1078  break; }
1079  case CE_ScrollBarSlider:
1080  if (!(option->state & State_Enabled)) {
1081  QStyleOptionButton buttonOpt;
1082  buttonOpt.QStyleOption::operator=(*option);
1083  buttonOpt.state = State_Enabled | State_Raised;
1084  drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget);
1085  QPixmap pm = option->palette.brush(QPalette::Light).texture();
1086  QBrush br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.light().color(), Qt::Dense4Pattern);
1087  painter->setPen(Qt::NoPen);
1088  painter->setBrush(br);
1089  painter->setBackgroundMode(Qt::OpaqueMode);
1090  painter->drawRect(option->rect.adjusted(2, 2, -2, -2));
1091  } else {
1092  QStyleOptionButton buttonOpt;
1093  buttonOpt.QStyleOption::operator=(*option);
1094  buttonOpt.state = State_Enabled | State_Raised;
1095  drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget);
1096  }
1097  break;
1098 #endif // QT_NO_SCROLLBAR
1099  case CE_HeaderSection: {
1100  QBrush fill;
1101  if (option->state & State_On)
1102  fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
1103  else
1104  fill = option->palette.brush(QPalette::Button);
1105 
1106  if (option->state & (State_Raised | State_Sunken)) {
1107  QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette,
1108  option->state & State_Sunken, &fill);
1109  } else {
1110  painter->fillRect(option->rect, fill);
1111  }
1112  break; }
1113 
1114  case CE_DockWidgetTitle:
1115  QWindowsStyle::drawControl(element,option, painter, widget);
1116  break;
1117 
1118  case CE_PushButtonLabel:
1119  if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1120  painter->save();
1121  QFont f = painter->font();
1122  f.setBold(true);
1123  painter->setFont(f);
1124  QRect ir = btn->rect;
1127  tf |= Qt::TextHideMnemonic;
1128 
1129  if (btn->state & (State_On | State_Sunken))
1132  if (!btn->icon.isNull()) {
1133  QIcon::Mode mode = btn->state & State_Enabled ? QIcon::Normal
1134  : QIcon::Disabled;
1135  if (mode == QIcon::Normal && btn->state & State_HasFocus)
1136  mode = QIcon::Active;
1137  QIcon::State state = QIcon::Off;
1138  if (btn->state & State_On)
1139  state = QIcon::On;
1140  QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state);
1141  int pixw = pixmap.width();
1142  int pixh = pixmap.height();
1143  //Center the icon if there is no text
1144 
1145  QPoint point;
1146  if (btn->text.isEmpty()) {
1147  point = QPoint(ir.x() + ir.width() / 2 - pixw / 2,
1148  ir.y() + ir.height() / 2 - pixh / 2);
1149  } else {
1150  point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2);
1151  }
1152  if (btn->direction == Qt::RightToLeft)
1153  point.rx() += pixw;
1154 
1155  if ((btn->state & (State_On | State_Sunken)) && btn->direction == Qt::RightToLeft)
1156  point.rx() -= pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2;
1157 
1158  painter->drawPixmap(visualPos(btn->direction, btn->rect, point), pixmap);
1159 
1160  if (btn->direction == Qt::RightToLeft)
1161  ir.translate(-4, 0);
1162  else
1163  ir.translate(pixw + 4, 0);
1164  ir.setWidth(ir.width() - (pixw + 4));
1165  // left-align text if there is
1166  if (!btn->text.isEmpty())
1167  tf |= Qt::AlignLeft;
1168  } else {
1169  tf |= Qt::AlignHCenter;
1170  }
1171  drawItemText(painter, ir, tf, btn->palette, (btn->state & State_Enabled),
1172  btn->text, QPalette::ButtonText);
1173  painter->restore();
1174  }
1175  break;
1176  default:
1177  QWindowsStyle::drawControl(element, option, painter, widget);
1178  break;
1179  }
1180 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
static const int windowsItemFrame
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
void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, int lineWidth, const QBrush *fill)
Definition: qdrawutil.cpp:511
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...
Definition: qstyle.cpp:2109
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
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
State
This enum describes the state for which a pixmap is intended to be used.
Definition: qicon.h:64
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
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
static const int windowsRightBorder
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
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.
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
QPoint bottomRight() const
Returns the position of the rectangle&#39;s bottom-right corner.
Definition: qrect.h:291
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
static const int windowsArrowHMargin
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
Mode
This enum type describes the mode for which a pixmap is intended to be used.
Definition: qicon.h:63
QColor dark(int f=200) const
Use darker(factor) instead.
Definition: qcolor.cpp:2447
int & rx()
Returns a reference to the x coordinate of this point.
Definition: qpoint.h:140
static const int windowsItemVMargin
unsigned int uint
Definition: qglobal.h:996
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, const QBrush *fill)
Definition: qdrawutil.cpp:303
static const int windowsCheckMarkWidth
static void drawWinCEButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=0)
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const
Reimplemented Function
QPoint topRight() const
Returns the position of the rectangle&#39;s top-right corner.
Definition: qrect.h:294
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
QPoint center() const
Returns the center point of the rectangle.
Definition: qrect.h:300
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
QPoint bottomLeft() const
Returns the position of the rectangle&#39;s bottom-left corner.
Definition: qrect.h:297
PrimitiveElement
This enum describes the various primitive elements.
Definition: qstyle.h:145
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
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
static const int windowsItemHMargin
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
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 setWidth(int w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:442
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Definition: qnamespace.h:54
void getRect(int *x, int *y, int *w, int *h) const
Extracts the position of the rectangle&#39;s top-left corner to *x and *y, and its dimensions to *width a...
Definition: qrect.h:392
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
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
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
Definition: qrect.h:312
static const KeyPair *const end
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279
BGMode
Definition: qnamespace.h:588
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
QColor light(int f=150) const
Use lighter(factor) instead.
Definition: qcolor.cpp:2391
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ drawItemText()

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

Draws the given text in the specified rectangle using the provided painter and palette.

The text is drawn using the painter's pen, and aligned and wrapped according to the specified alignment. If an explicit textRole is specified, the text is drawn using the palette's color for the given role. The enabled parameter indicates whether or not the item is enabled; when reimplementing this function, the enabled parameter should influence how the item is drawn.

See also
Qt::Alignment, drawItemPixmap()

Reimplemented from QStyle.

Definition at line 1755 of file qwindowscestyle.cpp.

Referenced by drawComplexControl(), and drawControl().

1756  {
1757  if (text.isEmpty())
1758  return;
1759  QPen savedPen;
1760  if (textRole != QPalette::NoRole) {
1761  savedPen = painter->pen();
1762  painter->setPen(pal.color(textRole));
1763  }
1764  if (!enabled) {
1765  QPen pen = painter->pen();
1766  painter->setPen(pal.light().color());
1767  //painter->drawText(rect.adjusted(1, 1, 1, 1), alignment, text);
1768  painter->setPen(pen);
1769  }
1770  painter->drawText(rect, alignment, text);
1771  if (textRole != QPalette::NoRole)
1772  painter->setPen(savedPen);
1773 }
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
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
const QPen & pen() const
Returns the painter&#39;s current pen.
Definition: qpainter.cpp:4152
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
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
#define enabled

◆ drawPrimitive()

void QWindowsCEStyle::drawPrimitive ( PrimitiveElement  pe,
const QStyleOption opt,
QPainter p,
const QWidget w = 0 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 82 of file qwindowscestyle.cpp.

Referenced by drawComplexControl(), and drawControl().

83  {
84 
85  bool doRestore = false;
86  QRect rect = option->rect;
87 
88  switch (element) {
89  case PE_PanelButtonTool: {
90  if (
91 #ifndef QT_NO_TOOLBAR
92  (widget && qobject_cast<QToolBar*>(widget->parentWidget())) ||
93 #endif
94 #ifndef QT_NO_DOCKWIDGET
95  (widget && widget->inherits("QDockWidgetTitleButton")) ||
96 #endif
97  (option->state & (State_Sunken | State_On)))
98  QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect.adjusted(0, 0, 0, 0),
99  option->palette, option->state & (State_Sunken | State_On),
100  &option->palette.button());
101  if (option->state & (State_On)){
102  QBrush fill = QBrush(option->palette.midlight().color(), Qt::Dense4Pattern);
103  painter->fillRect(option->rect.adjusted(windowsItemFrame , windowsItemFrame ,
104  -windowsItemFrame , -windowsItemFrame ), fill);
105  }
106  break; }
108  QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette,
109  option->state & (State_Sunken | State_On),
110  &option->palette.brush(QPalette::Button));
111  break;
112 #ifndef QT_NO_TABBAR
113  case PE_IndicatorTabTear:
114  if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
115  bool rtl = tab->direction == Qt::RightToLeft;
116  QRect rect = tab->rect;
117  QPainterPath path;
118  rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3));
119  rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2));
120  path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top()));
121  int count = 3;
122  for(int jags = 1; jags <= count; ++jags, rtl = !rtl)
123  path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count));
124 
125  painter->setPen(QPen(tab->palette.light(), qreal(.8)));
126  painter->setBrush(tab->palette.background());
127  painter->setRenderHint(QPainter::Antialiasing);
128  painter->drawPath(path);
129  }
130  break;
131 #endif //QT_NO_TABBAR
132 #ifndef QT_NO_TOOLBAR
134  //nothing to draw on WindowsCE
135  break;
137  painter->save();
138  painter->translate(option->rect.x(), option->rect.y());
139  if (option->state & State_Horizontal) {
140  int x = option->rect.width() / 2 - 4;
142  x -= 2;
143  if (option->rect.height() > 4) {
144  QWindowsCEStylePrivate::drawWinCEButton(painter,x - 1, 0, 7, option->rect.height(),
145  option->palette, false, 0);
146  QWindowsCEStylePrivate::drawWinCEPanel(painter, x, 1, 3, option->rect.height() - 1,
147  option->palette, false, 0);
148  QWindowsCEStylePrivate::drawWinCEPanel(painter, x + 3, 1, 3, option->rect.height() - 1,
149  option->palette, false, 0);
150  painter->setPen(option->palette.button().color());
151  painter->drawLine(x + 4, 2, x + 4,option->rect.height() - 2);
152  }
153  } else {
154  if (option->rect.width() > 4) {
155  int y = option->rect.height() / 2 - 4;
156  QWindowsCEStylePrivate::drawWinCEPanel(painter, 2, y, option->rect.width() - 2, 3,
157  option->palette, false, 0);
158  QWindowsCEStylePrivate::drawWinCEPanel(painter, 2, y + 3, option->rect.width() - 2, 3,
159  option->palette, false, 0);
160  }
161  }
162  painter->restore();
163  break;
164 
165 #endif // QT_NO_TOOLBAR
166  case PE_FrameButtonTool: {
167 #ifndef QT_NO_DOCKWIDGET
168  if (widget && widget->inherits("QDockWidgetTitleButton")) {
169  if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent()))
170  if (dw->isFloating()){
171  QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect.adjusted(1, 1, 0, 0),
172  option->palette, option->state & (State_Sunken | State_On),
173  &option->palette.button());
174  return;
175  }
176  }
177 #endif // QT_NO_DOCKWIDGET
178  QBrush fill;
179  bool stippled;
180  bool panel = (element == PE_PanelButtonTool);
181  if ((!(option->state & State_Sunken ))
182  && (!(option->state & State_Enabled)
183  || ((option->state & State_Enabled ) && !(option->state & State_MouseOver)))
184  && (option->state & State_On)) {
185  fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
186  stippled = true;
187  } else {
188  fill = option->palette.brush(QPalette::Button);
189  stippled = false;
190  }
191  if (option->state & (State_Raised | State_Sunken | State_On)) {
192  if (option->state & State_AutoRaise) {
193  if(option->state & (State_Enabled | State_Sunken | State_On)){
194  if (panel)
195  QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette,
196  option->state & (State_Sunken | State_On), &fill);
197  else
198  qDrawShadeRect(painter, option->rect, option->palette,
199  option->state & (State_Sunken | State_On), 1);
200  }
201  if (stippled) {
202  painter->setPen(option->palette.button().color());
203  painter->drawRect(option->rect.adjusted(1, 1, -2, -2));
204  }
205  } else {
206  QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette,
207  option->state & (State_Sunken | State_On), panel ? &fill : 0);
208  }
209  } else {
210  painter->fillRect(option->rect, fill);
211  }
212  break; }
213 
214  case PE_PanelButtonBevel: {
215  QBrush fill;
216  bool panel = element != PE_FrameButtonBevel;
217  painter->setBrushOrigin(option->rect.topLeft());
218  if (!(option->state & State_Sunken) && (option->state & State_On))
219  fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
220  else
221  fill = option->palette.brush(QPalette::Button);
222 
223  if (option->state & (State_Raised | State_On | State_Sunken)) {
224  QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette,
225  option->state & (State_Sunken | State_On),
226  panel ? &fill : 0); ;
227  } else {
228  if (panel)
229  painter->fillRect(option->rect, fill);
230  else
231  painter->drawRect(option->rect);
232  }
233  break; }
234 
235  case PE_FrameGroupBox:
236  if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
237  QRect fr = frame->rect;
238  painter->setPen(frame->palette.shadow().color());
239  painter->drawRect(fr.x(), fr.y(), fr.x() + fr.width() - 1,
240  fr.y() + fr.height() - windowsCEFrameGroupBoxOffset);
241  }
242  break;
243 
244  case PE_IndicatorCheckBox: {
245  QBrush fill;
246  if (option->state & State_NoChange)
247  fill = QBrush(option->palette.base().color(), Qt::Dense4Pattern);
248  else if (option->state & State_Sunken)
249  fill = option->palette.button();
250  else if (option->state & State_Enabled)
251  fill = option->palette.base();
252  else
253  fill = option->palette.background();
254  painter->save();
255  doRestore = true;
256  painter->fillRect(option->rect,fill);
257  painter->setPen(option->palette.dark().color());
258  painter->drawRect(option->rect);
259  painter->setPen(option->palette.shadow().color());
260  painter->drawLine(option->rect.x() + 1,option->rect.y() + 1,
261  option->rect.x() + option->rect.width() - 1, option->rect.y() + 1);
262  painter->drawLine(option->rect.x() + 1,option->rect.y() + 1,
263  option->rect.x() + 1, option->rect.y() + option->rect.height() - 1);
264  //fall through...
265  }
268  if (!doRestore) {
269  painter->save();
270  doRestore = true;
271  }
272  int arrowSize= 2;
273  if (element == PE_Q3CheckListIndicator || element == PE_IndicatorViewItemCheck) {
274  QLinearGradient linearGradient(QPoint(option->rect.x(),option->rect.y()), QPoint(option->rect.x()+option->rect.width(),
275  option->rect.y()+option->rect.height()));
276  linearGradient.setColorAt(0, windowsCECheckBoxGradientColorBegin);
277  linearGradient.setColorAt(1, windowsCECheckBoxGradientColorEnd);
278  painter->setBrush(linearGradient);
279  painter->setPen(Qt::NoPen);
280  if (option->state & State_NoChange)
281  painter->setBrush(option->palette.brush(QPalette::Button));
282  painter->setPen(option->palette.link().color());
283  painter->drawRect(option->rect.x(), option->rect.y(), windowsCEitemViewCheckBoxSize, windowsCEitemViewCheckBoxSize);
284  painter->setPen(option->palette.brightText().color());
285  arrowSize= 3;
286  }
287  if (!(option->state & State_Off)) {
288  QLineF lines[9];
289  int i, xx, yy;
290  xx = option->rect.x() + 4;
291  yy = option->rect.y() + 6;
292  for (i = 0; i < 4; ++i) {
293  lines[i] = QLineF(xx, yy, xx, yy + arrowSize);
294  ++xx;
295  ++yy;
296  }
297  yy -= 2;
298  for (i = 4; i < 9; ++i) {
299  lines[i] = QLineF(xx, yy, xx, yy + arrowSize);
300  ++xx;
301  --yy;
302  }
303  painter->drawLines(lines, 9);
304  }
305  if (doRestore)
306  painter->restore();
307 
308  break; }
310  QRect ir = option->rect;
311  painter->save();
312  painter->setPen(Qt::NoPen);
313  painter->setBrush(option->palette.light());
314  painter->drawEllipse(option->rect);
315  painter->setPen(option->palette.shadow().color());
316  painter->setBrush(option->palette.shadow().color());
317  painter->drawArc(option->rect, 0, 360 * 16);
318  painter->drawArc(option->rect.x() + 1, option->rect.y() + 1, option->rect.width() - 2,
319  option->rect.height() - 2, 40 * 16, 180 * 16);
320  painter->setPen(option->palette.light().color());
321  painter->drawPoint(option->rect.x() + 11, option->rect.y() + 3);
322  painter->drawPoint(option->rect.x() + 3,option->rect.y() + 3);
323  painter->setPen(option->palette.shadow().color());
324  painter->drawPoint(option->rect.x() +3,option->rect.y() + 12);
325  if (option->state & (State_Sunken | State_On)) {
326  painter->setPen(Qt::NoPen);
327  painter->setBrush(option->palette.text());
328  painter->drawEllipse(option->rect.x() +3,option->rect.y()+ 2,9,10);
329  }
330  painter->restore();
331  break; }
332  case PE_PanelMenuBar:
333  painter->save();
334  painter->setPen(option->palette.shadow().color());
335  painter->drawRect(option->rect);
336  painter->restore();
337  break;
339  if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
340  QBrush fill;
341  State flags = option->state;
342  QPalette pal = option->palette;
343  QRect r = option->rect;
344  if (! (flags & State_Sunken) && (flags & State_On))
345  fill = QBrush(pal.light().color(), Qt::Dense4Pattern);
346  else
347  fill = pal.brush(QPalette::Button);
348  if (btn->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) {
349  painter->setPen(pal.dark().color());
350  painter->setBrush(fill);
351  painter->drawRect(r.adjusted(0, 0, -1, -1));
352  } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) {
353  QWindowsCEStylePrivate::drawWinCEButton(painter, r, pal, flags & (State_Sunken | State_On),
354  &fill);
355  } else {
356  painter->fillRect(r, fill);
357  }
358 
359  }
360  break;
361  case PE_FrameDefaultButton: {
362  painter->setPen(option->palette.shadow().color());
363  QRect rect = option->rect;
364  rect.adjust(0, 0, -1, -1);
365  painter->drawRect(rect);
366  break; }
368  case PE_IndicatorSpinMinus: {
369  QRect r = option->rect;
370  int fw = pixelMetric(PM_DefaultFrameWidth, option, widget)+2;
371  QRect br = r.adjusted(fw, fw, -fw, -fw);
372  int offset = (option->state & State_Sunken) ? 1 : 0;
373  int step = (br.width() + 4) / 5;
374  painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2,
375  br.width(), step,
376  option->palette.buttonText());
377  if (element == PE_IndicatorSpinPlus)
378  painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4,
379  step, br.height()-7,
380  option->palette.buttonText());
381  break; }
382  case PE_IndicatorSpinUp:
383  case PE_IndicatorSpinDown: {
384  painter->save();
385  QPoint points[7];
386  switch (element) {
387  case PE_IndicatorSpinUp:
388  points[0] = QPoint(-2, -4);
389  points[1] = QPoint(-2, 2);
390  points[2] = QPoint(-1, -3);
391  points[3] = QPoint(-1, 1);
392  points[4] = QPoint(0, -2);
393  points[5] = QPoint(0, 0);
394  points[6] = QPoint(1, -1);
395  break;
397  points[0] = QPoint(0, -4);
398  points[1] = QPoint(0, 2);
399  points[2] = QPoint(-1, -3);
400  points[3] = QPoint(-1, 1);
401  points[4] = QPoint(-2, -2);
402  points[5] = QPoint(-2, 0);
403  points[6] = QPoint(-3, -1);
404  break;
405  default:
406  break;
407  }
408  if (option->state & State_Sunken)
409  painter->translate(pixelMetric(PM_ButtonShiftHorizontal),
411  if (option->state & State_Enabled) {
412  painter->translate(option->rect.x() + option->rect.width() / 2,
413  option->rect.y() + option->rect.height() / 2);
414  painter->setPen(option->palette.buttonText().color());
415  painter->drawLine(points[0], points[1]);
416  painter->drawLine(points[2], points[3]);
417  painter->drawLine(points[4], points[5]);
418  painter->drawPoint(points[6]);
419  } else {
420  painter->translate(option->rect.x() + option->rect.width() / 2 + 1,
421  option->rect.y() + option->rect.height() / 2 + 1);
422  painter->setPen(option->palette.light().color());
423  painter->drawLine(points[0], points[1]);
424  painter->drawLine(points[2], points[3]);
425  painter->drawLine(points[4], points[5]);
426  painter->drawPoint(points[6]);
427  painter->translate(-1, -1);
428  painter->setPen(option->palette.mid().color());
429  painter->drawLine(points[0], points[1]);
430  painter->drawLine(points[2], points[3]);
431  painter->drawLine(points[4], points[5]);
432  painter->drawPoint(points[6]);
433  }
434 
435  painter->restore();
436  break; }
437  case PE_IndicatorArrowUp:
440  case PE_IndicatorArrowLeft: {
441  painter->save();
442  QPoint points[9];
443  switch (element) {
444  case PE_IndicatorArrowUp:
445 
446  points[0] = QPoint(-4, 2);
447  points[1] = QPoint(4, 2);
448  points[2] = QPoint(-3, 1);
449  points[3] = QPoint(3, 1);
450  points[4] = QPoint(-2, 0);
451  points[5] = QPoint(2, 0);
452  points[6] = QPoint(-1, -1);
453  points[7] = QPoint(1, -1);
454  points[8] = QPoint(0, -2);
455  break;
457 
458  points[0] = QPoint(-4, -2);
459  points[1] = QPoint(4, -2);
460  points[2] = QPoint(-3, -1);
461  points[3] = QPoint(3, -1);
462  points[4] = QPoint(-2, 0);
463  points[5] = QPoint(2, 0);
464  points[6] = QPoint(-1, 1);
465  points[7] = QPoint(1, 1);
466  points[8] = QPoint(0, 2);
467  break;
469  points[0] = QPoint(-3, -4);
470  points[1] = QPoint(-3, 4);
471  points[2] = QPoint(-2, -3);
472  points[3] = QPoint(-2, 3);
473  points[4] = QPoint(-1, -2);
474  points[5] = QPoint(-1, 2);
475  points[6] = QPoint(0, -1);
476  points[7] = QPoint(0, 1);
477  points[8] = QPoint(1, 0);
478  break;
480  points[0] = QPoint(1, -4);
481  points[1] = QPoint(1, 4);
482  points[2] = QPoint(0, -3);
483  points[3] = QPoint(0, 3);
484  points[4] = QPoint(-1, -2);
485  points[5] = QPoint(-1, 2);
486  points[6] = QPoint(-2, -1);
487  points[7] = QPoint(-2, 1);
488  points[8] = QPoint(-3, 0);
489  break;
490  default:
491  break;
492  }
493  if (option->state & State_Sunken)
494  painter->translate(pixelMetric(PM_ButtonShiftHorizontal),
496  if (option->state & State_Enabled) {
497  painter->translate(option->rect.x() + option->rect.width() / 2,
498  option->rect.y() + option->rect.height() / 2);
499  painter->setPen(option->palette.buttonText().color());
500  painter->drawLine(points[0], points[1]);
501  painter->drawLine(points[2], points[3]);
502  painter->drawLine(points[4], points[5]);
503  painter->drawLine(points[6], points[7]);
504  painter->drawPoint(points[8]);
505  } else {
506  painter->translate(option->rect.x() + option->rect.width() / 2 + 1,
507  option->rect.y() + option->rect.height() / 2 + 1);
508  painter->setPen(option->palette.light().color());
509  painter->drawLine(points[0], points[1]);
510  painter->drawLine(points[2], points[3]);
511  painter->drawLine(points[4], points[5]);
512  painter->drawLine(points[6], points[7]);
513  painter->drawPoint(points[8]);
514  painter->translate(-1, -1);
515  painter->setPen(option->palette.mid().color());
516  painter->drawLine(points[0], points[1]);
517  painter->drawLine(points[2], points[3]);
518  painter->drawLine(points[4], points[5]);
519  painter->drawLine(points[6], points[7]);
520  painter->drawPoint(points[8]);
521  }
522  painter->restore();
523  break; }
524 
525  case PE_FrameWindow: {
526  QPalette popupPal = option->palette;
527  popupPal.setColor(QPalette::Light, option->palette.background().color());
528  popupPal.setColor(QPalette::Midlight, option->palette.light().color());
529  QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, popupPal, option->state & State_Sunken);
530  break; }
531 
532  case PE_Frame:
533  case PE_FrameMenu:
534  if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
535  QPalette popupPal = frame->palette;
536  QRect r = frame->rect;
537  qDrawPlainRect(painter, r, frame->palette.shadow().color(),1);
538  }
539  break;
540  case PE_FrameStatusBar:
541  QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, true, 0);
542  break;
543 
544  case PE_FrameTabWidget: {
545  QRect rect = option->rect;
546  QPalette pal = option->palette;
547  QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, false, 0);
548  break; }
549  default:
550  QWindowsStyle::drawPrimitive(element, option, painter, widget);
551  break;
552  }
553 }
static const int windowsItemFrame
static Qt::LayoutDirection layoutDirection()
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
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
static const int windowsCEitemViewCheckBoxSize
double qreal
Definition: qglobal.h:1193
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
Definition: qrect.h:267
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
QPointer< QWidget > widget
void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, int lineWidth, const QBrush *fill)
Definition: qdrawutil.cpp:511
const QBrush & dark() const
Returns the dark brush of the current color group.
Definition: qpalette.h:127
The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-l...
Definition: qdockwidget.h:60
void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill)
Definition: qdrawutil.cpp:204
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
#define QT_NO_TOOLBAR
static void drawWinCEPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=0)
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
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
static const QColor windowsCECheckBoxGradientColorBegin
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 moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
static const QColor windowsCECheckBoxGradientColorEnd
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
const QBrush & light() const
Returns the light brush of the current color group.
Definition: qpalette.h:126
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
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
Definition: qstyleoption.h:118
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
static void drawWinCEButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=0)
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
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
Definition: qbrush.h:280
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
static const int windowsCEFrameGroupBoxOffset
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
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
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
Definition: qstyleoption.h:304
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ hitTestComplexControl()

QStyle::SubControl QWindowsCEStyle::hitTestComplexControl ( ComplexControl  cc,
const QStyleOptionComplex opt,
const QPoint pt,
const QWidget w = 0 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 2066 of file qwindowscestyle.cpp.

2067  {
2068  /*switch (control) {
2069  default:
2070  break;
2071  }*/
2072  return QWindowsStyle::hitTestComplexControl(control, option, pos, widget);
2073 }
QPointer< QWidget > widget
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=0) const
Reimplemented Function

◆ pixelMetric()

int QWindowsCEStyle::pixelMetric ( PixelMetric  m,
const QStyleOption opt = 0,
const QWidget widget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 2106 of file qwindowscestyle.cpp.

Referenced by drawComplexControl(), drawControl(), drawPrimitive(), sizeFromContents(), and subControlRect().

2106  {
2107  int ret;
2108 
2109  switch (pm) {
2110  case PM_DefaultFrameWidth:
2111  ret = 1;
2112  break;
2113 
2114  case PM_MenuBarHMargin:
2115  ret = 2;
2116  break;
2117  case PM_MenuBarVMargin:
2118  ret = 2;
2119  break;
2120  /*case PM_MenuBarItemSpacing:
2121  ret = 2;
2122  break;*/
2123 
2125  ret = 10;
2126  break;
2127 
2128  case PM_SpinBoxFrameWidth:
2129  ret = 2;
2130  break;
2134  ret = 1;
2135  break;
2136 #ifndef QT_NO_TABBAR
2138  ret = 0;
2139  break;
2141  ret = 6;
2142  break;
2143 #endif
2145  ret = 60;
2146  break;
2147 
2148  case PM_IndicatorWidth:
2149  ret = windowsCEIndicatorSize;
2150  break;
2151 
2152  case PM_IndicatorHeight:
2153  ret = windowsCEIndicatorSize;
2154  break;
2155 
2158  break;
2159 
2162  break;
2163 
2164 #ifndef QT_NO_SLIDER
2165  case PM_SliderLength:
2166  ret = 12;
2167  break;
2168  case PM_SliderThickness:
2170  break;
2171 
2173  ret = 18;
2174  break;
2175 
2176  // Returns the number of pixels to use for the business part of the
2177  // slider (i.e., the non-tickmark portion). The remaining space is shared
2178  // equally between the tickmark regions.
2180  if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
2181  int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
2182  int ticks = sl->tickPosition;
2183  int n = 0;
2184  if (ticks & QSlider::TicksAbove)
2185  ++n;
2186  if (ticks & QSlider::TicksBelow)
2187  ++n;
2188  if (!n) {
2189  ret = space;
2190  break;
2191  }
2192  int thick = 12;
2193  if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
2194  thick += pixelMetric(PM_SliderLength, sl, widget) / 4;
2195 
2196  space -= thick;
2197  if (space > 0)
2198  thick += (space * 2) / (n + 2);
2199  ret = thick;
2200  } else {
2201  ret = 0;
2202  }
2203  break;
2204 #endif // QT_NO_SLIDER
2205 
2206 #ifndef QT_NO_MENU
2207 
2208  case PM_SmallIconSize:
2209  ret = windowsCEIconSize;
2210  break;
2211  case PM_ButtonMargin:
2212  ret = 6;
2213  break;
2214 
2215  case PM_LargeIconSize:
2216  ret = 32;
2217  break;
2218 
2219  case PM_IconViewIconSize:
2220  ret = pixelMetric(PM_LargeIconSize, opt, widget);
2221  break;
2222 
2223  case PM_ToolBarIconSize:
2224  ret = windowsCEIconSize;
2225  break;
2227  ret = 2;
2228  break;
2229 #if defined(Q_WS_WIN)
2230 // case PM_DockWidgetFrameWidth:
2231 // ret = GetSystemMetrics(SM_CXFRAME);
2232 // break;
2233 #else
2235  ret = 4;
2236  break;
2237 #endif // Q_WS_WIN
2238  break;
2239 
2240 #endif // QT_NO_MENU
2241 
2242  case PM_TitleBarHeight:
2243  ret = 30;
2244  break;
2245  case PM_ScrollBarExtent:
2246  ret = 19;
2247  break;
2248  case PM_SplitterWidth:
2249  ret = qMax(4, QApplication::globalStrut().width());
2250  break;
2251 
2252 #if defined(Q_WS_WIN)
2253  case PM_MDIFrameWidth:
2254  ret = 3;
2255  break;
2256 #endif
2257  case PM_ToolBarItemMargin:
2258  ret = 1;
2259  break;
2260  case PM_ToolBarItemSpacing:
2261  ret = 0;
2262  break;
2264  ret = 10;
2265  break;
2266  case PM_ButtonIconSize:
2267  ret = 22;
2268  break;
2269  default:
2270  ret = QWindowsStyle::pixelMetric(pm, opt, widget);
2271  break;
2272  }
2273  return ret;
2274 }
static QSize globalStrut()
static const int windowsCEIndicatorSize
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
static const int windowsCESliderThickness
int pixelMetric(PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
static const int windowsCEExclusiveIndicatorSize
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
Definition: qstyleoption.h:701
static const int windowsCEIconSize

◆ polish() [1/3]

void QWindowsCEStyle::polish ( QWidget widget)
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 2098 of file qwindowscestyle.cpp.

2098  {
2099  QWindowsStyle::polish(widget);
2100 }
void polish(QApplication *)
Reimplemented Function

◆ polish() [2/3]

void QWindowsCEStyle::polish ( QPalette pal)
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 2102 of file qwindowscestyle.cpp.

2102  {
2103  QWindowsStyle::polish(palette);
2104 }
void polish(QApplication *)
Reimplemented Function

◆ polish() [3/3]

void QWindowsCEStyle::polish ( QApplication app)
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 2094 of file qwindowscestyle.cpp.

2094  {
2095  QWindowsStyle::polish(app);
2096 }
void polish(QApplication *)
Reimplemented Function

◆ sizeFromContents()

QSize QWindowsCEStyle::sizeFromContents ( ContentsType  ct,
const QStyleOption opt,
const QSize contentsSize,
const QWidget widget 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 1776 of file qwindowscestyle.cpp.

1777  {
1778  QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget);
1779  switch (type) {
1780  case CT_PushButton:
1781  if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1782  newSize = QWindowsStyle::sizeFromContents(type, option, size, widget);
1783  int w = newSize.width(),
1784  h = newSize.height();
1785  int defwidth = 0;
1786  if (btn->features & QStyleOptionButton::AutoDefaultButton)
1787  defwidth = 2 * pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
1788  if (w < 75 + defwidth && btn->icon.isNull())
1789  w = 75 + defwidth;
1790  if (h < 23 + defwidth)
1791  h = 23 + defwidth;
1792  newSize = QSize(w+14, h);
1793  }
1794  break;
1795 
1796  case CT_RadioButton:
1797  case CT_CheckBox:
1798  if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1799  bool isRadio = (type == CT_RadioButton);
1800  QRect irect = visualRect(btn->direction, btn->rect,
1802  : SE_CheckBoxIndicator, btn, widget));
1803  int h = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
1804  : PM_IndicatorHeight, btn, widget);
1805  int margins = (!btn->icon.isNull() && btn->text.isEmpty()) ? 0 : 10;
1806  newSize += QSize(irect.right() + margins, 4);
1807  newSize.setHeight(qMax(newSize.height(), h));
1808  }
1809  break;
1810  case CT_ComboBox:
1811  if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
1812  int fw = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0;
1813  newSize = QSize(newSize.width() + fw -1, qMax(24, newSize.height() + fw-1));
1814  }
1815  break;
1816 #ifndef QT_NO_SPINBOX
1817  case CT_SpinBox:
1818  if (const QStyleOptionSpinBox *spnb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
1819  int fw = spnb->frame ? pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0;
1820  newSize = QSize(newSize.width() + fw - 5, newSize.height() + fw - 6);
1821  }
1822  break;
1823 #endif
1824  case CT_LineEdit:
1825  newSize += QSize(0,1);
1826  break;
1827  case CT_MenuBarItem:
1828  newSize += QSize(5, 1);
1829  break;
1830  case CT_MenuItem:
1831  newSize += QSize(0, -2);
1832  break;
1833  case CT_MenuBar:
1834  newSize += QSize(0, -1);
1835  break;
1836  case CT_ToolButton:
1837  if (const QStyleOptionToolButton *b = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
1838  if (b->toolButtonStyle != Qt::ToolButtonIconOnly)
1839  newSize = QSize(newSize.width() + 1, newSize.height() - 1);
1840  else
1841  newSize = QSize(newSize.width() + 1, newSize.height());
1842  }
1843  break;
1844 
1845  default:
1846  break;
1847  }
1848  return newSize;
1849 }
int type
Definition: qmetatype.cpp:239
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
Reimplemented Function
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
The QStyleOptionToolButton class is used to describe the parameters for drawing a tool button...
Definition: qstyleoption.h:768
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
int width() const
Returns the width.
Definition: qsize.h:126
The QStyleOptionSpinBox class is used to describe the parameters necessary for drawing a spin box...
Definition: qstyleoption.h:729
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
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=0) const
Reimplemented Function
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
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279

◆ standardPalette()

QPalette QWindowsCEStyle::standardPalette ( ) const
virtual

Returns the style's standard palette.

Note that on systems that support system colors, the style's standard palette is not used. In particular, the Windows XP, Vista, and Mac styles do not use the standard palette, but make use of native theme engines. With these styles, you should not set the palette with QApplication::setStandardPalette().

Reimplemented from QStyle.

Definition at line 2076 of file qwindowscestyle.cpp.

2076  {
2077  QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ),
2078  QColor(132, 130, 132), QColor(198, 195, 198) , Qt::black, Qt::white, Qt::white, QColor(198, 195, 198));
2079  palette.setColor(QPalette::Window, QColor(198, 195, 198));
2080  palette.setColor(QPalette::Base, Qt::white);
2081  palette.setColor(QPalette::Button, QColor(198, 195, 198));
2082  palette.setColor(QPalette::Highlight, QColor(0, 0, 132));
2083  palette.setColor(QPalette::Light, Qt::white);
2084  palette.setColor(QPalette::Midlight, QColor(222, 223, 222 ));
2085  palette.setColor(QPalette::Dark, QColor(132, 130, 132));
2086  palette.setColor(QPalette::Mid, QColor(132, 130, 132));
2087  palette.setColor(QPalette::Shadow, QColor(0, 0, 0));
2088  palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow)
2089  palette.setColor(QPalette::Link, QColor(24,81,132)); // color for the box around the ItemView indicator
2090 
2091  return palette;
2092 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ standardPixmap()

QPixmap QWindowsCEStyle::standardPixmap ( StandardPixmap  sp,
const QStyleOption opt,
const QWidget widget = 0 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 2276 of file qwindowscestyle.cpp.

2277  {
2278 #ifndef QT_NO_IMAGEFORMAT_XPM
2279  /*switch (standardPixmap) {
2280 
2281  default:
2282  break;
2283  }*/
2284 #endif //QT_NO_IMAGEFORMAT_XPM
2285  return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
2286 }
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function

◆ styleHint()

int QWindowsCEStyle::styleHint ( StyleHint  sh,
const QStyleOption opt = 0,
const QWidget w = 0,
QStyleHintReturn shret = 0 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 2288 of file qwindowscestyle.cpp.

Referenced by drawComplexControl(), drawControl(), and subControlRect().

2289  {
2290  int ret;
2291  switch (hint) {
2292  case SH_TabBar_ElideMode:
2293  ret = Qt::ElideMiddle;
2294  break;
2295  case SH_EtchDisabledText:
2296  ret = false;
2297  break;
2299  ret = RSIP_OnMouseClick;
2300  break;
2301  default:
2302  ret = QWindowsStyle::styleHint(hint, opt, widget, returnData);
2303  break;
2304  }
2305  return ret;
2306 }
QPointer< QWidget > widget
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function

◆ subControlRect()

QRect QWindowsCEStyle::subControlRect ( ComplexControl  cc,
const QStyleOptionComplex opt,
SubControl  sc,
const QWidget w 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 1869 of file qwindowscestyle.cpp.

Referenced by drawComplexControl().

1870  {
1871  QRect rect = QWindowsStyle::subControlRect(control, option, subControl, widget);
1872  switch (control) {
1873 #ifndef QT_NO_SLIDER
1874  case CC_Slider:
1875  if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
1876  int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
1877  int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
1878 
1879  switch (subControl) {
1880  case SC_SliderHandle: {
1881  int sliderPos = 0;
1882  int len = pixelMetric(PM_SliderLength, slider, widget);
1883  bool horizontal = slider->orientation == Qt::Horizontal;
1884  sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum,
1885  slider->sliderPosition,
1886  (horizontal ? slider->rect.width()
1887  : slider->rect.height()) - len,
1888  slider->upsideDown);
1889  if (horizontal)
1890  rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness);
1891  else
1892  rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len);
1893  break; }
1894  default:
1895  break;
1896  }
1897  rect = visualRect(slider->direction, slider->rect, rect);
1898  }
1899  break;
1900 #endif //QT_NO_SLIDER
1901 #ifndef QT_NO_COMBOBOX
1902  case CC_ComboBox:
1903  if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
1904  int x = cb->rect.x(),
1905  y = cb->rect.y(),
1906  wi = cb->rect.width(),
1907  he = cb->rect.height();
1908  int xpos = x;
1909  int margin = cb->frame ? 3 : 0;
1910  int bmarg = cb->frame ? 2 : 0;
1911  xpos += wi - (he - 2*bmarg) - bmarg;
1912  switch (subControl) {
1913  case SC_ComboBoxArrow:
1914  rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg);
1915  break;
1916  case SC_ComboBoxEditField:
1917  rect.setRect(x + margin, y + margin, wi - 2 * margin - (he - 2*bmarg), he - 2 * margin);
1918  break;
1920  rect = cb->rect;
1921  break;
1922  case SC_ComboBoxFrame:
1923  rect = cb->rect;
1924  break;
1925  default:
1926  break;
1927  }
1928  rect = visualRect(cb->direction, cb->rect, rect);
1929  }
1930 #endif //QT_NO_COMBOBOX
1931 #ifndef QT_NO_SPINBOX
1932  case CC_SpinBox:
1933  if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
1934  QSize bs;
1935  int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
1936  bs.setWidth(qMax(18, (spinbox->rect.height() / 2 - fw + 1)));
1937  // 1.6 -approximate golden mean
1938  bs.setHeight(qMax(18, qMin((bs.height() * 8 / 5), (spinbox->rect.width() / 4))));
1940  int y = fw;
1941  int x, lx, rx;
1942  x = spinbox->rect.width() - y - bs.width() * 2;
1943  lx = fw;
1944  rx = x - fw;
1945  switch (subControl) {
1946  case SC_SpinBoxUp:
1947  rect = QRect(x + bs.width(), y, bs.width(), bs.height());
1948  break;
1949  case SC_SpinBoxDown:
1950  rect = QRect(x, y , bs.width(), bs.height());
1951  break;
1952  case SC_SpinBoxEditField:
1953  if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) {
1954  rect = QRect(lx, fw, spinbox->rect.width() - 2*fw - 2, spinbox->rect.height() - 2*fw);
1955  } else {
1956  rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw);
1957  }
1958  break;
1959  case SC_SpinBoxFrame:
1960  rect = spinbox->rect;
1961  default:
1962  break;
1963  }
1964  rect = visualRect(spinbox->direction, spinbox->rect, rect);
1965  }
1966  break;
1967 #endif // Qt_NO_SPINBOX
1968 #ifndef QT_NO_GROUPBOX
1969  case CC_GroupBox: {
1970  if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
1971  switch (subControl) {
1972  case SC_GroupBoxFrame:
1973  // FALL THROUGH
1974  case SC_GroupBoxContents: {
1975  int topMargin = 0;
1976  int topHeight = 0;
1977  int bottomMargin = 0;
1978  int noLabelMargin = 0;
1979  QRect frameRect = groupBox->rect;
1980  int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
1981  if (groupBox->text.size()) {
1982  topHeight = groupBox->fontMetrics.height();
1983  if (verticalAlignment & Qt::AlignVCenter)
1984  topMargin = topHeight / 2;
1985  else if (verticalAlignment & Qt::AlignTop)
1986  topMargin = -topHeight/2;
1987  }
1988  else {
1989  topHeight = groupBox->fontMetrics.height();
1990  noLabelMargin = topHeight / 2;
1991  if (verticalAlignment & Qt::AlignVCenter) {
1992  topMargin = topHeight / 4 - 4;
1993  bottomMargin = topHeight / 4 - 4;
1994  }
1995  else if (verticalAlignment & Qt::AlignTop) {
1996  topMargin = topHeight/2 - 4;
1997  bottomMargin = topHeight/2 - 4;
1998  }
1999  }
2000 
2001  if (subControl == SC_GroupBoxFrame) {
2002  frameRect.setTop(topMargin);
2003  frameRect.setBottom(frameRect.height() + bottomMargin);
2004  rect = frameRect;
2005  break;
2006  }
2007 
2008  int frameWidth = 0;
2009  if ((groupBox->features & QStyleOptionFrameV2::Flat) == 0)
2010  frameWidth = pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
2011  rect = frameRect.adjusted(frameWidth, frameWidth + topHeight, -frameWidth, -frameWidth - noLabelMargin);
2012  break;
2013  }
2014  case SC_GroupBoxCheckBox:
2015  // FALL THROUGH
2016  case SC_GroupBoxLabel: {
2017  QFontMetrics fontMetrics = groupBox->fontMetrics;
2018  int h = fontMetrics.height();
2019  int tw = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width();
2020  int marg = (groupBox->features & QStyleOptionFrameV2::Flat) ? 0 : 8;
2021  rect = groupBox->rect.adjusted(marg, 0, -marg, 0);
2022  rect.setHeight(h);
2023 
2024  int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget);
2025  int indicatorSpace = pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1;
2026  bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
2027  int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
2028 
2029  // Adjusted rect for label + indicatorWidth + indicatorSpace
2030  QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment,
2031  QSize(tw + checkBoxSize, h), rect);
2032 
2033  // Adjust totalRect if checkbox is set
2034  if (hasCheckBox) {
2035  bool ltr = groupBox->direction == Qt::LeftToRight;
2036  int left = 0;
2037  // Adjust for check box
2038  if (subControl == SC_GroupBoxCheckBox) {
2039  int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget);
2040  left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
2041  int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2;
2042  totalRect.setRect(left, top, indicatorWidth, indicatorHeight);
2043  // Adjust for label
2044  } else {
2045  left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left();
2046  totalRect.setRect(left, totalRect.top(),
2047  totalRect.width() - checkBoxSize, totalRect.height());
2048  }
2049  }
2050  rect = totalRect;
2051  break;
2052  }
2053  default:
2054  break;
2055  }
2056  }
2057  break;
2058  }
2059 #endif // QT_NO_GROUPBOX
2060  default:
2061  break;
2062  }
2063  return rect;
2064 }
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...
Definition: qstyle.cpp:2120
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
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
Definition: qrect.h:267
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
QPointer< QWidget > widget
static QSize globalStrut()
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition: qsize.h:187
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
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
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
void setWidth(int w)
Sets the width to the given width.
Definition: qsize.h:132
int width() const
Returns the width.
Definition: qsize.h:126
QSize size(int flags, const QString &str, int tabstops=0, int *tabarray=0) const
Returns the size in pixels of text.
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
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 QStyleOptionGroupBox class describes the parameters for drawing a group box.
Definition: qstyleoption.h:834
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
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
Definition: qstyleoption.h:701
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int height() const
Returns the height of the font.
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=0) const
Reimplemented Function

◆ subElementRect()

QRect QWindowsCEStyle::subElementRect ( SubElement  r,
const QStyleOption opt,
const QWidget widget 
) const
virtual

Reimplemented Function

we need to access the widget here because the style option doesn't

Reimplemented from QCommonStyle.

Definition at line 1851 of file qwindowscestyle.cpp.

Referenced by drawComplexControl(), and sizeFromContents().

1851  {
1852  QRect rect = QWindowsStyle::subElementRect(element, option, widget);
1853  switch (element) {
1854 #ifndef QT_NO_COMBOBOX
1855  case SE_ComboBoxFocusRect:
1856  if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
1857  int margin = cb->frame ? 3 : 0;
1858  rect.setRect(margin, margin, option->rect.width() - 2*margin - 20, option->rect.height() - 2*margin);
1859  rect = visualRect(option->direction, option->rect, rect);
1860  }
1861  break;
1862 #endif // QT_NO_COMBOBOX
1863  default:
1864  break;
1865  }
1866  return rect;
1867 }
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
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function

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