Qt 4.8
Public Functions | Protected Functions | List of all members
QWindowsMobileStyle Class Reference

#include <qwindowsmobilestyle.h>

Inheritance diagram for QWindowsMobileStyle:
QWindowsStyle QCommonStyle QStyle QObject

Public Functions

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

Protected Functions

 QWindowsMobileStyle (QWindowsMobileStylePrivate &dd)
 
- 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
 

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 Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 57 of file qwindowsmobilestyle.h.

Constructors and Destructors

◆ QWindowsMobileStyle() [1/2]

QWindowsMobileStyle::QWindowsMobileStyle ( )

Definition at line 4516 of file qwindowsmobilestyle.cpp.

4517  qApp->setEffectEnabled(Qt::UI_FadeMenu, false);
4518  qApp->setEffectEnabled(Qt::UI_AnimateMenu, false);
4519 }
#define qApp
QWindowsStyle()
Constructs a QWindowsStyle object.

◆ QWindowsMobileStyle() [2/2]

QWindowsMobileStyle::QWindowsMobileStyle ( QWindowsMobileStylePrivate dd)
protected

Definition at line 4511 of file qwindowsmobilestyle.cpp.

4511  : QWindowsStyle(dd) {
4512  qApp->setEffectEnabled(Qt::UI_FadeMenu, false);
4513  qApp->setEffectEnabled(Qt::UI_AnimateMenu, false);
4514 }
#define qApp
QWindowsStyle()
Constructs a QWindowsStyle object.

Functions

◆ doubleControls()

bool QWindowsMobileStyle::doubleControls ( ) const

Definition at line 7266 of file qwindowsmobilestyle.cpp.

7266  {
7267 
7268  QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
7269 
7270  return d->doubleControls;
7271 }
double d
Definition: qnumeric_p.h:62

◆ drawComplexControl()

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

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 5839 of file qwindowsmobilestyle.cpp.

5840  {
5841 
5842  painter->setClipping(false);
5843  QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
5844 
5845  switch (control) {
5846 #ifndef QT_NO_SLIDER
5847  case CC_Slider:
5848  if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
5849  int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
5850  int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
5851  int ticks = slider->tickPosition;
5852  QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
5853  QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
5854 
5855  if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
5856  int mid = thickness / 2;
5857  if (ticks & QSlider::TicksAbove)
5858  mid += len / 8;
5859  if (ticks & QSlider::TicksBelow)
5860  mid -= len / 8;
5861 
5862  painter->setPen(slider->palette.shadow().color());
5863  if (slider->orientation == Qt::Horizontal) {
5864  qDrawPlainRect(painter, groove.x(), groove.y() + mid - 2,
5865  groove.width(), 4, option->palette.shadow().color(),1,0);
5866  } else {
5867  qDrawPlainRect(painter, groove.x()+mid-2, groove.y(),
5868  4, groove.height(), option->palette.shadow().color(),1,0);
5869  }
5870  }
5871  if (slider->subControls & SC_SliderTickmarks) {
5872  QStyleOptionSlider tmpSlider = *slider;
5873  tmpSlider.subControls = SC_SliderTickmarks;
5874  QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget);
5875  }
5876 
5877  if (slider->subControls & SC_SliderHandle) {
5878  const QColor c0 = slider->palette.shadow().color();
5879  const QColor c1 = slider->palette.dark().color();
5880  const QColor c3 = slider->palette.midlight().color();
5881  const QColor c4 = slider->palette.dark().color();
5882  QBrush handleBrush;
5883 
5884  if (slider->state & State_Enabled) {
5885  handleBrush = slider->palette.color(QPalette::Light);
5886  } else {
5887  handleBrush = QBrush(slider->palette.color(QPalette::Shadow),
5889  }
5890  int x = handle.x(), y = handle.y(),
5891  wi = handle.width(), he = handle.height();
5892  int x1 = x;
5893  int x2 = x+wi-1;
5894  int y1 = y;
5895  int y2 = y+he-1;
5896 
5897  Qt::Orientation orient = slider->orientation;
5898  bool tickAbove = slider->tickPosition == QSlider::TicksAbove;
5899  bool tickBelow = slider->tickPosition == QSlider::TicksBelow;
5900 
5901  if (slider->state & State_HasFocus) {
5902  QStyleOptionFocusRect fropt;
5903  fropt.QStyleOption::operator=(*slider);
5904  fropt.rect = proxy()->subElementRect(SE_SliderFocusRect, slider, widget);
5905  proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
5906  }
5907  if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
5908  Qt::BGMode oldMode = painter->backgroundMode();
5909  painter->setBackgroundMode(Qt::OpaqueMode);
5910  qDrawPlainRect(painter, QRect(x, y, wi, he)
5911  ,slider->palette.shadow().color(),1,&handleBrush);
5912  painter->setBackgroundMode(oldMode);
5913  QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
5914  if (slider->state & State_Sunken)
5915  painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill);
5916  return;
5917  }
5918  QSliderDirection dir;
5919  if (orient == Qt::Horizontal)
5920  if (tickAbove)
5921  dir = SliderUp;
5922  else
5923  dir = SliderDown;
5924  else
5925  if (tickAbove)
5926  dir = SliderLeft;
5927  else
5928  dir = SliderRight;
5929  QPolygon polygon;
5930  int d = 0;
5931  switch (dir) {
5932  case SliderUp:
5933  x2++;
5934  y1 = y1 + wi / 2;
5935  d = (wi + 1) / 2 - 1;
5936  polygon.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d,y1 - d);
5937  break;
5938  case SliderDown:
5939  x2++;
5940  y2 = y2 - wi/2;
5941  d = (wi + 1) / 2 - 1;
5942  polygon.setPoints(5, x1, y1, x1, y2, x1 + d,y2 + d, x2, y2, x2, y1);
5943  break;
5944  case SliderLeft:
5945  d = (he + 1) / 2 - 1;
5946  x1 = x1 + he/2;
5947  polygon.setPoints(5, x1, y1, x1 - d, y1 + d, x1,y2, x2, y2, x2, y1);
5948  y1--;
5949  break;
5950  case SliderRight:
5951  d = (he + 1) / 2 - 1;
5952  x2 = x2 - he/2;
5953  polygon.setPoints(5, x1, y1, x1, y2, x2,y2, x2 + d, y1 + d, x2, y1);
5954  y1--;
5955  break;
5956  }
5957  QBrush oldBrush = painter->brush();
5958  painter->setPen(Qt::NoPen);
5959  painter->setBrush(handleBrush);
5960  Qt::BGMode oldMode = painter->backgroundMode();
5961  painter->setBackgroundMode(Qt::OpaqueMode);
5962  painter->drawRect(x1, y1, x2-x1+1, y2-y1+1);
5963  painter->drawPolygon(polygon);
5964  QBrush fill = QBrush(option->palette.button().color(), Qt::Dense4Pattern);
5965  painter->setBrush(oldBrush);
5966  painter->setBackgroundMode(oldMode);
5967  if (slider->state & State_Sunken)
5968  painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill);
5969 
5970  if (dir != SliderUp) {
5971  painter->setPen(c0);
5972  painter->drawLine(x1, y1, x2, y1);
5973  }
5974  if (dir != SliderLeft) {
5975  painter->setPen(c0);
5976  painter->drawLine(x1, y1, x1, y2);
5977  }
5978  if (dir != SliderRight) {
5979  painter->setPen(c0);
5980  painter->drawLine(x2, y1, x2, y2);
5981  }
5982  if (dir != SliderDown) {
5983  painter->setPen(c0);
5984  painter->drawLine(x1, y2, x2, y2);
5985  }
5986  switch (dir) {
5987  case SliderUp:
5988  if (slider->state & State_Sunken)
5989  painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4, y1),fill);
5990  painter->setPen(c0);
5991  painter->drawLine(x1, y1, x1 + d, y1 - d);
5992  d = wi - d - 1;
5993  painter->drawLine(x2, y1, x2 -d , y1 -d );
5994  d--;
5995  break;
5996  case SliderDown:
5997  if (slider->state & State_Sunken)
5998  painter->fillRect(QRectF(x1+3, y2 - d, x2 - x1 -4,y2 - 8),fill);
5999  painter->setPen(c0);
6000  painter->drawLine(x1, y2, x1 + d, y2 + d);
6001  d = wi - d - 1;
6002  painter->drawLine(x2, y2, x2 - d, y2 + d);
6003  d--;
6004  break;
6005  case SliderLeft:
6006  if (slider->state & State_Sunken)
6007  painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1, y2 - y1 - 3),fill);
6008  painter->setPen(c0);
6009  painter->drawLine(x1, y1, x1 - d, y1 + d);
6010  d = he - d - 1;
6011  painter->drawLine(x1, y2, x1 - d, y2 - d);
6012  d--;
6013  break;
6014  case SliderRight:
6015  if (slider->state & State_Sunken)
6016  painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3),fill);
6017  painter->setPen(c0);
6018  painter->drawLine(x2, y1, x2 + d, y1 + d);
6019  painter->setPen(c0);
6020  d = he - d - 1;
6021  painter->drawLine(x2, y2, x2 + d, y2 - d);
6022  d--;
6023  break;
6024  }
6025  }
6026  }
6027  break;
6028 #endif //QT_NO_SLIDER
6029 #ifndef QT_NO_SCROLLBAR
6030  case CC_ScrollBar:
6031  painter->save();
6032  painter->setPen(option->palette.shadow().color());
6033  if (d->doubleControls) {
6034  QPen pen = painter->pen();
6035  pen.setWidth(2);
6037  painter->setPen(pen);
6038  }
6039  if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
6040  d->drawScrollbarGroove(painter, scrollbar);
6041  // Make a copy here and reset it for each primitive.
6042  QStyleOptionSlider newScrollbar = *scrollbar;
6043  State saveFlags = scrollbar->state;
6044  //Check if the scrollbar is part of an abstractItemView and draw the frame according
6045  bool drawCompleteFrame = true;
6046  bool secondScrollBar = false;
6047  if (widget)
6048  if (QWidget *parent = widget->parentWidget()) {
6049  if (QAbstractScrollArea *abstractScrollArea = qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) {
6050  drawCompleteFrame = (abstractScrollArea->frameStyle() == QFrame::NoFrame) || (abstractScrollArea->frameStyle() == QFrame::StyledPanel);
6051  secondScrollBar = (abstractScrollArea->horizontalScrollBar()->isVisible()
6052  && abstractScrollArea->verticalScrollBar()->isVisible()) ;
6053  }
6054 #ifndef QT_NO_LISTVIEW
6055  if (QListView *listView = qobject_cast<QListView *>(parent->parentWidget()))
6056  drawCompleteFrame = false;
6057 #endif
6058  }
6059  if (scrollbar->minimum == scrollbar->maximum)
6060  saveFlags |= State_Enabled;
6061  if (scrollbar->subControls & SC_ScrollBarSubLine) {
6062  newScrollbar.state = saveFlags;
6063  newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget);
6064  if (newScrollbar.rect.isValid()) {
6065  if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine))
6066  newScrollbar.state &= ~(State_Sunken | State_MouseOver);
6067  d->drawScrollbarHandleUp(painter, &newScrollbar, drawCompleteFrame, secondScrollBar);
6068  }
6069  }
6070  if (scrollbar->subControls & SC_ScrollBarAddLine) {
6071  newScrollbar.rect = scrollbar->rect;
6072  newScrollbar.state = saveFlags;
6073  newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget);
6074  if (newScrollbar.rect.isValid()) {
6075  if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine))
6076  newScrollbar.state &= ~(State_Sunken | State_MouseOver);
6077  d->drawScrollbarHandleDown(painter, &newScrollbar, drawCompleteFrame, secondScrollBar);
6078  }
6079  }
6080  if (scrollbar->subControls & SC_ScrollBarSlider) {
6081 
6082  newScrollbar.rect = scrollbar->rect;
6083  newScrollbar.state = saveFlags;
6084  newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget);
6085 
6086  if (newScrollbar.rect.isValid()) {
6087  if (!(scrollbar->activeSubControls & SC_ScrollBarSlider))
6088  newScrollbar.state &= ~(State_Sunken | State_MouseOver);
6089  d->drawScrollbarGrip(painter, &newScrollbar, option, drawCompleteFrame);
6090  }
6091  }
6092  }
6093  painter->restore();
6094  break;
6095 #endif // QT_NO_SCROLLBAR
6096  case CC_ToolButton:
6097  if (const QStyleOptionToolButton *toolbutton
6098  = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
6099  QRect button, menuarea;
6100  bool isTabWidget = false;
6101 #ifndef QT_NO_TABWIDGET
6102  if (widget)
6103  if (QWidget *parent = widget->parentWidget())
6104  isTabWidget = (qobject_cast<QTabWidget *>(parent->parentWidget()));
6105 #endif //QT_NO_TABWIDGET
6106 
6107  button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget);
6108  menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
6109  State buttonFlags = toolbutton->state;
6110  if (buttonFlags & State_AutoRaise) {
6111  if (!(buttonFlags & State_MouseOver)) {
6112  buttonFlags &= ~State_Raised;
6113  }
6114  }
6115  State menuFlags = buttonFlags;
6116  if (toolbutton->activeSubControls & SC_ToolButton)
6117  buttonFlags |= State_Sunken;
6118  if (toolbutton->activeSubControls & SC_ToolButtonMenu)
6119  menuFlags |= State_On;
6120  QStyleOption tool(0);
6121  tool.palette = toolbutton->palette;
6122  if (toolbutton->subControls & SC_ToolButton) {
6123  tool.rect = button;
6124  tool.state = buttonFlags;
6125  proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
6126  }
6127  if (toolbutton->subControls & SC_ToolButtonMenu) {
6128  tool.rect = menuarea;
6129  tool.state = buttonFlags & State_Enabled;
6130  QStyleOption toolMenu(0);
6131  toolMenu = *toolbutton;
6132  toolMenu.state = menuFlags;
6133  if (buttonFlags & State_Sunken)
6134  proxy()->drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget);
6135  QStyleOption arrowOpt(0);
6136  arrowOpt.rect = tool.rect;
6137  arrowOpt.palette = tool.palette;
6138  State flags = State_None;
6139  if (menuFlags & State_Enabled)
6140  flags |= State_Enabled;
6141  if ((menuFlags & State_On) && !(buttonFlags & State_Sunken)) {
6142  flags |= State_Sunken;
6143  painter->fillRect(menuarea, option->palette.shadow());
6144  }
6145  arrowOpt.state = flags;
6146  proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
6147  }
6148  if (toolbutton->state & State_HasFocus) {
6149  QStyleOptionFocusRect focusRect;
6150  focusRect.QStyleOption::operator=(*toolbutton);
6151  focusRect.rect.adjust(3, 3, -3, -3);
6152  if (toolbutton->features & QStyleOptionToolButton::Menu)
6154  toolbutton, widget), 0);
6155  proxy()->drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget);
6156  }
6157  QStyleOptionToolButton label = *toolbutton;
6158  if (isTabWidget)
6159  label.state = toolbutton->state;
6160  else
6161  label.state = toolbutton->state & State_Enabled;
6162  int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
6163  label.rect = button.adjusted(fw, fw, -fw, -fw);
6164  proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget);
6165  }
6166  break;
6167 
6168 #ifndef QT_NO_GROUPBOX
6169  case CC_GroupBox:
6170  if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
6171  // Draw frame
6172  painter->save();
6173  QFont font = painter->font();
6174  font.setBold(true);
6175  painter->setFont(font);
6176  QStyleOptionGroupBox groupBoxFont = *groupBox;
6177  groupBoxFont.fontMetrics = QFontMetrics(font);
6178  QRect textRect = proxy()->subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget);
6179  QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0);
6180  if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
6181  QStyleOptionFrameV2 frame;
6182  frame.QStyleOption::operator=(*groupBox);
6183  frame.features = groupBox->features;
6184  frame.lineWidth = groupBox->lineWidth;
6185  frame.midLineWidth = groupBox->midLineWidth;
6187  painter->save();
6188  QRegion region(groupBox->rect);
6189  if (!groupBox->text.isEmpty()) {
6190  bool ltr = groupBox->direction == Qt::LeftToRight;
6191  QRect finalRect = checkBoxRect.united(textRect);
6192  if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox)
6193  finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0);
6194  region -= finalRect;
6195  }
6196  proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
6197  painter->restore();
6198  }
6199  // Draw checkbox
6200  if (groupBox->subControls & SC_GroupBoxCheckBox) {
6201  QStyleOptionButton box;
6202  box.QStyleOption::operator=(*groupBox);
6203  box.rect = checkBoxRect;
6204  proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
6205  }
6206  // Draw title
6207  if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
6208  QColor textColor = groupBox->textColor;
6209  if (textColor.isValid())
6210  painter->setPen(textColor);
6211  else
6212  painter->setPen(groupBox->palette.link().color());
6213  painter->setPen(groupBox->palette.link().color());
6214 
6215  int alignment = int(groupBox->textAlignment);
6217  alignment |= Qt::TextHideMnemonic;
6218 
6219  if (groupBox->state & State_Enabled)
6220  proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
6221  groupBox->palette, true, groupBox->text,
6222  textColor.isValid() ? QPalette::NoRole : QPalette::Link);
6223  else
6224  proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
6225  groupBox->palette, true, groupBox->text, QPalette::Mid);
6226  if (groupBox->state & State_HasFocus) {
6227  QStyleOptionFocusRect fropt;
6228  fropt.QStyleOption::operator=(*groupBox);
6229  fropt.rect = textRect;
6230  proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
6231  }
6232  }
6233  painter->restore();
6234  }
6235  break;
6236 #endif //QT_NO_GROUPBOX
6237 
6238 #ifndef QT_NO_COMBOBOX
6239  case CC_ComboBox:
6240  if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
6241  QBrush editBrush = cmb->palette.brush(QPalette::Base);
6242  if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame)
6243  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush);
6244  else
6245  painter->fillRect(option->rect, editBrush);
6246  State flags = State_None;
6248  if ((option->state & State_On)) {
6249  painter->fillRect(ar.adjusted(0, 0, 1, 1),cmb->palette.brush(QPalette::Shadow));
6250  }
6251  if (d->doubleControls)
6252  ar.adjust(5, 0, 5, 0);
6253  else
6254  ar.adjust(2, 0, -2, 0);
6255  if (option->state & State_Enabled)
6256  flags |= State_Enabled;
6257  if (option->state & State_On)
6258  flags |= State_Sunken;
6259  QStyleOption arrowOpt(0);
6260  arrowOpt.rect = ar;
6261  arrowOpt.palette = cmb->palette;
6262  arrowOpt.state = flags;
6264  if (cmb->subControls & SC_ComboBoxEditField) {
6266  if (cmb->state & State_HasFocus && !cmb->editable)
6267  painter->fillRect(re.x(), re.y(), re.width(), re.height(),
6268  cmb->palette.brush(QPalette::Highlight));
6269  if (cmb->state & State_HasFocus) {
6270  painter->setPen(cmb->palette.highlightedText().color());
6271  painter->setBackground(cmb->palette.highlight());
6272  } else {
6273  painter->setPen(cmb->palette.text().color());
6274  painter->setBackground(cmb->palette.background());
6275  }
6276  if (cmb->state & State_HasFocus && !cmb->editable) {
6277  QStyleOptionFocusRect focus;
6278  focus.QStyleOption::operator=(*cmb);
6280  focus.state |= State_FocusAtBorder;
6281  focus.backgroundColor = cmb->palette.highlight().color();
6282  if ((option->state & State_On))
6283  proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
6284  }
6285  }
6286  }
6287  break;
6288 #endif // QT_NO_COMBOBOX
6289 
6290 
6291 #ifndef QT_NO_SPINBOX
6292  case CC_SpinBox:
6293  if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
6294  QStyleOptionSpinBox copy = *spinBox;
6295  //PrimitiveElement primitiveElement;
6296  int primitiveElement;
6297 
6298  if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) {
6300  qDrawPlainRect(painter, r, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget),0);
6301  }
6302  QPalette shadePal(option->palette);
6303  shadePal.setColor(QPalette::Button, option->palette.light().color());
6304  shadePal.setColor(QPalette::Light, option->palette.base().color());
6305  if (spinBox->subControls & SC_SpinBoxUp) {
6306  copy.subControls = SC_SpinBoxUp;
6307  QPalette pal2 = spinBox->palette;
6308  if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
6310  copy.state &= ~State_Enabled;
6311  }
6312  copy.palette = pal2;
6313  if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) {
6314  copy.state |= State_On;
6315  copy.state |= State_Sunken;
6316  } else {
6317  copy.state |= State_Raised;
6318  copy.state &= ~State_Sunken;
6319  }
6320  primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowUpBig
6322  copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
6323  if (copy.state & (State_Sunken | State_On))
6324  qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
6325  else
6326  qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
6328  proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
6329  }
6330  if (spinBox->subControls & SC_SpinBoxDown) {
6331  copy.subControls = SC_SpinBoxDown;
6332  copy.state = spinBox->state;
6333  QPalette pal2 = spinBox->palette;
6334  if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
6336  copy.state &= ~State_Enabled;
6337  }
6338  copy.palette = pal2;
6339  if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) {
6340  copy.state |= State_On;
6341  copy.state |= State_Sunken;
6342  } else {
6343  copy.state |= State_Raised;
6344  copy.state &= ~State_Sunken;
6345  }
6346  primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowDownBig
6348  copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
6349  qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
6350  if (copy.state & (State_Sunken | State_On))
6351  qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
6352  else
6353  qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
6354  copy.rect.adjust(3, 0, -4, 0);
6355  if (primitiveElement == PE_IndicatorArrowUp || primitiveElement == PE_IndicatorArrowDown) {
6356  int frameWidth = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
6357  copy.rect = copy.rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth);
6358  proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
6359  }
6360  else {
6361  proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
6362  }
6363  if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) {
6365  }
6366  }
6367  }
6368  break;
6369 #endif // QT_NO_SPINBOX
6370 
6371  default:
6372  QWindowsStyle::drawComplexControl(control, option, painter, widget);
6373  break;
6374  }
6375 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
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 qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, int lineWidth, const QBrush *fill)
Definition: qdrawutil.cpp:511
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen&#39;s cap style to the given style.
Definition: qpen.cpp:723
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
QRect united(const QRect &other) const
Returns the bounding rectangle of this rectangle and the given rectangle.
Definition: qrect.h:491
static const int PE_IndicatorArrowUpBig
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QSliderDirection
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
Definition: qstyle.cpp:532
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
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
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *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
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
static const int PE_IndicatorArrowDownBig
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 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
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QStyleOptionFocusRect class is used to describe the parameters for drawing a focus rectangle with...
Definition: qstyleoption.h:103
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
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
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Definition: qpalette.cpp:874
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=0) const =0
Returns the sub-area for the given element as described in the provided style option.
The QListView class provides a list or icon view onto a model.
Definition: qlistview.h:57
PrimitiveElement
This enum describes the various primitive elements.
Definition: qstyle.h:145
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
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
The 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
const QStyle * proxy() const
Definition: qstyle.cpp:2546
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
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
static bool isTabWidget(const QAInterface &interface)
void setWidth(int width)
Sets the pen width to the given width in pixels with integer precision.
Definition: qpen.cpp:667
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ drawControl()

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

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 5429 of file qwindowsmobilestyle.cpp.

5430  {
5431 
5432 
5433  QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
5434 
5435 
5436  painter->setClipping(false);
5437  switch (element) {
5438  case CE_MenuBarEmptyArea:
5439  painter->setClipping(true);
5440  QWindowsStyle::drawControl(element, option, painter, widget);
5441  break;
5442  case CE_PushButtonBevel:
5443  if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
5444  QRect br = button->rect;
5445  int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget);
5446 
5447  if (button->features & QStyleOptionButton::AutoDefaultButton)
5448  br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi);
5449  QStyleOptionButton tmpBtn = *button;
5450  tmpBtn.rect = br;
5451  proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget);
5452  if (button->features & QStyleOptionButton::HasMenu) {
5453  int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget);
5454  QRect ir = button->rect;
5455  QStyleOptionButton newButton = *button;
5456  if (d->doubleControls)
5457  newButton.rect = QRect(ir.right() - mbi, ir.height() - 30, mbi, ir.height() - 4);
5458  else
5459  newButton.rect = QRect(ir.right() - mbi, ir.height() - 20, mbi, ir.height() - 4);
5460  proxy()->drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget);
5461  }
5462  if (button->features & QStyleOptionButton::DefaultButton)
5463  proxy()->drawPrimitive(PE_FrameDefaultButton, option, painter, widget);
5464  }
5465  break;
5466  case CE_RadioButton:
5467  case CE_CheckBox:
5468  if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
5469  bool isRadio = (element == CE_RadioButton);
5470  QStyleOptionButton subopt = *button;
5471  subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator
5472  : SE_CheckBoxIndicator, button, widget);
5474  &subopt, painter, widget);
5475  subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonContents
5476  : SE_CheckBoxContents, button, widget);
5477  proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
5478  if (button->state & State_HasFocus) {
5479  QStyleOptionFocusRect fropt;
5480  fropt.QStyleOption::operator=(*button);
5481  fropt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonFocusRect
5482  : SE_CheckBoxFocusRect, button, widget);
5483  proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
5484  }
5485  }
5486  break;
5487  case CE_RadioButtonLabel:
5488  case CE_CheckBoxLabel:
5489  if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
5490  uint alignment = visualAlignment(button->direction, Qt::AlignLeft | Qt::AlignVCenter);
5491  if (!styleHint(SH_UnderlineShortcut, button, widget))
5492  alignment |= Qt::TextHideMnemonic;
5493  QPixmap pix;
5494  QRect textRect = button->rect;
5495  if (!button->icon.isNull()) {
5496  pix = button->icon.pixmap(button->iconSize, button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled);
5497  proxy()->drawItemPixmap(painter, button->rect, alignment, pix);
5498  if (button->direction == Qt::RightToLeft)
5499  textRect.setRight(textRect.right() - button->iconSize.width() - 4);
5500  else
5501  textRect.setLeft(textRect.left() + button->iconSize.width() + 4);
5502  }
5503  if (!button->text.isEmpty()){
5504  if (button->state & State_Enabled)
5505  proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
5506  button->palette, false, button->text, QPalette::WindowText);
5507  else
5508  proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
5509  button->palette, false, button->text, QPalette::Mid);
5510  }
5511  }
5512  break;
5513 #ifndef QT_NO_PROGRESSBAR
5514  case CE_ProgressBarGroove:
5515  if (d->doubleControls)
5516  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.brush(QPalette::Window));
5517  else
5518  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.brush(QPalette::Window));
5519  break;
5520 #endif //QT_NO_PROGRESSBAR
5521 #ifndef QT_NO_TABBAR
5522  case CE_TabBarTab:
5523  if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
5524  proxy()->drawControl(CE_TabBarTabShape, tab, painter, widget);
5525  proxy()->drawControl(CE_TabBarTabLabel, tab, painter, widget);
5526  }
5527  break;
5528  case CE_TabBarTabShape:
5529  if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
5530 
5531  if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast ||
5532  tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) {
5533  d->drawTabBarTab(painter, tab);
5534  } else {
5535  QCommonStyle::drawControl(element, option, painter, widget);
5536  }
5537  break; }
5538 
5539 #endif // QT_NO_TABBAR
5540 
5541 #ifndef QT_NO_TOOLBAR
5542  case CE_ToolBar:
5543  if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
5544  QRect rect = option->rect;
5545  painter->save();
5546  painter->setPen(option->palette.dark().color());
5547  painter->fillRect(rect,option->palette.button());
5548  if (d->doubleControls) {
5549  QPen pen = painter->pen();
5550  pen.setWidth(4);
5551  painter->setPen(pen);
5552  }
5553  if (toolBar->toolBarArea == Qt::TopToolBarArea)
5554  painter->drawLine(rect.bottomLeft(), rect.bottomRight());
5555  else
5556  painter->drawLine(rect.topLeft(), rect.topRight());
5557  painter->restore();
5558  break; }
5559 #endif //QT_NO_TOOLBAR
5560  case CE_Header:
5561  if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
5562  QRegion clipRegion = painter->clipRegion();
5563  painter->setClipRect(option->rect);
5564  proxy()->drawControl(CE_HeaderSection, header, painter, widget);
5565  QStyleOptionHeader subopt = *header;
5566  subopt.rect = proxy()->subElementRect(SE_HeaderLabel, header, widget);
5567  if (header->state & State_Sunken)
5568  subopt.palette.setColor(QPalette::ButtonText, header->palette.brightText().color());
5569  subopt.state |= QStyle::State_On;
5570  if (subopt.rect.isValid())
5571  proxy()->drawControl(CE_HeaderLabel, &subopt, painter, widget);
5572  if (header->sortIndicator != QStyleOptionHeader::None) {
5573  subopt.rect = proxy()->subElementRect(SE_HeaderArrow, option, widget);
5574  proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget);
5575  }
5576  painter->setClipRegion(clipRegion);
5577  }
5578  break;
5579 
5580  case CE_HeaderSection:
5581  if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
5582  QBrush fill;
5583  QColor color;
5584  QRect rect = option->rect;
5585  painter->setPen(option->palette.shadow().color());
5586 
5587  int penSize = 1;
5588 
5589  if (d->doubleControls) {
5590  penSize = 2;
5591  QPen pen = painter->pen();
5592  pen.setWidth(2);
5593  pen.setCapStyle(Qt::FlatCap);
5594  painter->setPen(pen);
5595  }
5596 
5597  //fix Frame
5598 
5599  if (header->position == QStyleOptionHeader::End
5600  || (header->position == QStyleOptionHeader::OnlyOneSection
5601  && !header->text.isEmpty()))
5602  if (Qt::Horizontal == header->orientation )
5603  rect.adjust(0, 0, penSize, 0);
5604  else
5605  rect.adjust(0, 0, 0, penSize);
5606 
5607  if (option->state & State_Sunken) {
5608  fill = option->palette.brush(QPalette::Shadow);
5609  color = option->palette.light().color();
5610  painter->drawLine(rect.bottomLeft(), rect.bottomRight());
5611  painter->drawLine(rect.topRight(), rect.bottomRight());
5612  rect.adjust(0, 0, -penSize, -penSize);
5613  }
5614  else {
5615  fill = option->palette.brush(QPalette::Button);
5616  color = option->palette.shadow().color();
5617  if (Qt::Horizontal == header->orientation )
5618  rect.adjust(-penSize, 0, 0, 0);
5619  else
5620  rect.adjust(0, -penSize, 0, 0);
5621  }
5622  if (Qt::Horizontal == header->orientation )
5623  rect.adjust(0,-penSize,0,0);
5624  else
5625  rect.adjust(-penSize, 0, 0, 0);
5626 
5627  if (option->state & State_Sunken) {
5628  qDrawPlainRect(painter, rect, color, penSize, &fill);
5629  } else {
5630  //Corner
5631  rect.adjust(-penSize, 0, 0, 0);
5632  qDrawPlainRect(painter, rect, color, penSize, &fill);
5633  }
5634 
5635  //Hack to get rid of some double lines... StyleOptions need a clean flag for that
5636  rect = option->rect;
5637 #ifndef QT_NO_SCROLLAREA
5638  if (const QAbstractScrollArea *abstractScrollArea = qobject_cast<const QAbstractScrollArea *> (widget) ) {
5639  QRect rectScrollArea = abstractScrollArea->geometry();
5640  if (Qt::Horizontal == header->orientation )
5641  if ((rectScrollArea.right() - rect.right() ) > 1)
5642  painter->drawLine(rect.topRight(), rect.bottomRight());
5643  else ;
5644  else
5645  if ((rectScrollArea.bottom() - rect.bottom() ) > 1)
5646  painter->drawLine(rect.bottomLeft(), rect.bottomRight());
5647  }
5648 #endif // QT_NO_SCROLLAREA
5649  break;
5650  }
5651 #ifndef QT_NO_COMBOBOX
5652  case CE_ComboBoxLabel:
5653  // This is copied from qcommonstyle.cpp with the difference, that
5654  // the editRect isn't adjusted when calling drawItemText.
5655  if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
5657  painter->save();
5658  painter->setClipRect(editRect);
5659  if (!cb->currentIcon.isNull()) {
5660  QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
5661  : QIcon::Disabled;
5662  QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
5663  QRect iconRect(editRect);
5664  iconRect.setWidth(cb->iconSize.width() + 4);
5665  iconRect = alignedRect(cb->direction,
5667  iconRect.size(), editRect);
5668  if (cb->editable)
5669  painter->fillRect(iconRect, option->palette.brush(QPalette::Base));
5670  proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
5671 
5672  if (cb->direction == Qt::RightToLeft)
5673  editRect.translate(-4 - cb->iconSize.width(), 0);
5674  else
5675  editRect.translate(cb->iconSize.width() + 4, 0);
5676  }
5677  if (!cb->currentText.isEmpty() && !cb->editable) {
5678  proxy()->drawItemText(painter, editRect,
5680  cb->palette, cb->state & State_Enabled, cb->currentText);
5681  }
5682  painter->restore();
5683  }
5684  break;
5685 #endif // QT_NO_COMBOBOX
5686 #ifndef QT_NO_DOCKWIDGET
5687  case CE_DockWidgetTitle:
5688  if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
5689  const QStyleOptionDockWidgetV2 *v2
5690  = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(option);
5691  bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
5692 
5693  QRect rect = dwOpt->rect;
5694  QRect r = rect;
5695 
5696  if (verticalTitleBar) {
5697  QSize s = r.size();
5698  s.transpose();
5699  r.setSize(s);
5700 
5701  painter->save();
5702  painter->translate(r.left(), r.top() + r.width());
5703  painter->rotate(-90);
5704  painter->translate(-r.left(), -r.top());
5705  }
5706 
5707  bool floating = false;
5708  bool active = dwOpt->state & State_Active;
5709  int menuOffset = 0; //used to center text when floated
5710  QColor inactiveCaptionTextColor = option->palette.highlightedText().color();
5711  if (dwOpt->movable) {
5712  QColor left, right;
5713 
5714  //Titlebar gradient
5715  if (widget && widget->isWindow()) {
5716  floating = true;
5717  if (active) {
5718  right = option->palette.highlight().color();
5719  left = right.lighter(125);
5720  } else {
5721  left = option->palette.highlight().color().lighter(125);
5722  right = QColor(0xff, 0xff, 0xff);
5723  }
5724  menuOffset = 2;
5725  QBrush fillBrush(left);
5726  if (left != right) {
5727  QPoint p1(r.x(), r.top() + r.height()/2);
5728  QPoint p2(rect.right(), r.top() + r.height()/2);
5729  QLinearGradient lg(p1, p2);
5730  lg.setColorAt(0, left);
5731  lg.setColorAt(1, right);
5732  fillBrush = lg;
5733  }
5734  painter->fillRect(r.adjusted(0, 0, 0, -3), fillBrush);
5735  } else {
5736  painter->fillRect(r.adjusted(0, 0, 0, -3), option->palette.button().color());
5737  }
5738  painter->setPen(dwOpt->palette.color(QPalette::Light));
5739  if (!widget || !widget->isWindow()) {
5740  painter->drawLine(r.topLeft(), r.topRight());
5741  painter->setPen(dwOpt->palette.color(QPalette::Dark));
5742  painter->drawLine(r.bottomLeft(), r.bottomRight()); }
5743  }
5744  if (!dwOpt->title.isEmpty()) {
5745  QFont oldFont = painter->font();
5746  QFont newFont = oldFont;
5747  if (newFont.pointSize() > 2)
5748  newFont.setPointSize(newFont.pointSize() - 2);
5749  if (floating)
5750  newFont.setBold(true);
5751  painter->setFont(newFont);
5752  QPalette palette = dwOpt->palette;
5753  palette.setColor(QPalette::Window, inactiveCaptionTextColor);
5754  QRect titleRect = proxy()->subElementRect(SE_DockWidgetTitleBarText, option, widget);
5755  if (verticalTitleBar) {
5756  titleRect = QRect(r.left() + rect.bottom()
5757  - titleRect.bottom(),
5758  r.top() + titleRect.left() - rect.left(),
5759  titleRect.height(), titleRect.width());
5760  }
5761  proxy()->drawItemText(painter, titleRect,
5763  dwOpt->state & State_Enabled, dwOpt->title,
5764  floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText);
5765  painter->setFont(oldFont);
5766  }
5767  if (verticalTitleBar)
5768  painter->restore();
5769  }
5770  return;
5771 #endif // QT_NO_DOCKWIDGET
5772 
5773  case CE_PushButtonLabel:
5774  if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
5775  painter->save();
5776  QRect ir = button->rect;
5777  QPalette::ColorRole colorRole;
5779  if (!styleHint(SH_UnderlineShortcut, button, widget))
5780  tf |= Qt::TextHideMnemonic;
5781 
5782  if (button->state & (State_On | State_Sunken))
5783  colorRole = QPalette::Light;
5784  else
5785  colorRole = QPalette::ButtonText;
5786 
5787  if (!button->icon.isNull()) {
5788  QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal
5789  : QIcon::Disabled;
5790  if (mode == QIcon::Normal && button->state & State_HasFocus)
5791  mode = QIcon::Active;
5792  QIcon::State state = QIcon::Off;
5793  if (button->state & State_On)
5794  state = QIcon::On;
5795  QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
5796  int pixw = pixmap.width();
5797  int pixh = pixmap.height();
5798  //Center the icon if there is no text
5799 
5800  QPoint point;
5801  if (button->text.isEmpty()) {
5802  point = QPoint(ir.x() + ir.width() / 2 - pixw / 2,
5803  ir.y() + ir.height() / 2 - pixh / 2);
5804  } else {
5805  point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2);
5806  }
5807  if (button->direction == Qt::RightToLeft)
5808  point.rx() += pixw;
5809 
5810  if ((button->state & (State_On | State_Sunken)) && button->direction == Qt::RightToLeft)
5811  point.rx() -= proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2;
5812 
5813  painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap);
5814 
5815  if (button->direction == Qt::RightToLeft)
5816  ir.translate(-4, 0);
5817  else
5818  ir.translate(pixw + 4, 0);
5819  ir.setWidth(ir.width() - (pixw + 4));
5820  // left-align text if there is
5821  if (!button->text.isEmpty())
5822  tf |= Qt::AlignLeft;
5823  } else {
5824  tf |= Qt::AlignHCenter;
5825  }
5826  if (button->state & State_Enabled)
5827  proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole);
5828  else
5829  proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid);
5830  painter->restore();
5831  }
5832  break;
5833  default:
5834  QWindowsStyle::drawControl(element, option, painter, widget);
5835  break;
5836  }
5837 }
static QMessageBox::StandardButton newButton(int button)
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
void setPointSize(int)
Sets the point size to pointSize.
Definition: qfont.cpp:1099
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
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
The QStyleOptionDockWidget class is used to describe the parameters for drawing a dock widget...
Definition: qstyleoption.h:504
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
QPointer< QWidget > widget
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
Definition: qpalette.h:93
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
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
The QStyleOptionHeader class is used to describe the parameters for drawing a header.
Definition: qstyleoption.h:251
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen&#39;s cap style to the given style.
Definition: qpen.cpp:723
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
State
This enum describes the state for which a pixmap is intended to be used.
Definition: qicon.h:64
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
The QStyleOptionToolBar class is used to describe the parameters for drawing a toolbar.
Definition: qstyleoption.h:369
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
Definition: qstyle.cpp:532
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
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
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
Mode
This enum type describes the mode for which a pixmap is intended to be used.
Definition: qicon.h:63
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
Definition: qrect.h:264
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QStyleOptionFocusRect class is used to describe the parameters for drawing a focus rectangle with...
Definition: qstyleoption.h:103
int & rx()
Returns a reference to the x coordinate of this point.
Definition: qpoint.h:140
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
Definition: qrect.h:448
void transpose()
Swaps the width and height values.
Definition: qsize.cpp:196
unsigned int uint
Definition: qglobal.h:996
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
void drawTabBarTab(QPainter *p, const QStyleOptionTab *tab)
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
virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Draws the given pixmap in the specified rectangle, according to the specified alignment, using the provided painter.
Definition: qstyle.cpp:570
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLe...
Definition: qstyle.cpp:2149
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=0) const =0
Returns the sub-area for the given element as described in the provided style option.
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
QPoint bottomLeft() const
Returns the position of the rectangle&#39;s bottom-left corner.
Definition: qrect.h:297
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
Definition: qrect.h:258
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
Definition: qbrush.h:280
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
T qstyleoption_cast(const QStyleOption *opt)
Definition: qstyleoption.h:885
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
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
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
void setWidth(int w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:442
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
const QStyle * proxy() const
Definition: qstyle.cpp:2546
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 pointSize() const
Returns the point size of the font.
Definition: qfont.cpp:981
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
Definition: qcolor.h:298
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
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
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
void setWidth(int width)
Sets the pen width to the given width in pixels with integer precision.
Definition: qpen.cpp:667
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
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ drawPrimitive()

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

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 4570 of file qwindowsmobilestyle.cpp.

4571  {
4572 
4573  QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
4574 
4575  bool doRestore = false;
4576  QRect rect = option->rect;
4577  painter->setClipping(false);
4578 
4579  switch (element) {
4580  case PE_PanelButtonTool: {
4581  int penSize = 1;
4582  if (d->doubleControls)
4583  penSize = 2;
4584  if (widget)
4585  if (QWidget *parent = widget->parentWidget())
4586 #ifndef QT_NO_TABWIDGET
4587  if (qobject_cast<QTabWidget *>(parent->parentWidget())) {
4588 #else
4589  if (false) {
4590 #endif //QT_NO_TABBAR
4591  rect.adjust(0,2*penSize,0,-1*penSize);
4592  qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light());
4593  if (option->state & (State_Sunken))
4594  qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.shadow());
4595  }
4596  else {
4597  if (!(option->state & State_AutoRaise) || (option->state & (State_Sunken | State_On)))
4598  qDrawPlainRect(painter,option->rect.adjusted(0, penSize, 0, -1 * penSize) ,
4599  option->palette.button().color(), 0, &option->palette.button());
4600  if (option->state & (State_Sunken)) {
4601  qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light());
4602  }
4603  if (option->state & (State_On)){
4604  QBrush fill = QBrush(option->palette.light().color());
4605  painter->fillRect(rect.adjusted(windowsItemFrame , windowsItemFrame ,
4606  -windowsItemFrame , -windowsItemFrame ), fill);
4607  qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light());
4608  }
4609  }
4610  break; }
4612  if (d->doubleControls)
4613  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.button());
4614  else
4615  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.button());
4616  break;
4617 #ifndef QT_NO_TABBAR
4618  case PE_IndicatorTabTear:
4619  if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
4620  bool rtl = tab->direction == Qt::RightToLeft;
4621  QRect rect = tab->rect;
4622  QPainterPath path;
4623  rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3));
4624  rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2));
4625  path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top()));
4626  int count = 3;
4627  for(int jags = 1; jags <= count; ++jags, rtl = !rtl)
4628  path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count));
4629  painter->setPen(QPen(tab->palette.light(), qreal(.8)));
4630  painter->setBrush(tab->palette.background());
4631  painter->setRenderHint(QPainter::Antialiasing);
4632  painter->drawPath(path);
4633  }
4634  break;
4635 #endif //QT_NO_TABBAR
4636 
4637 #ifndef QT_NO_TOOLBAR
4639  painter->save();
4640  QPoint p1, p2;
4641  if (option->state & State_Horizontal) {
4642  p1 = QPoint(option->rect.width()/2, 0);
4643  p2 = QPoint(p1.x(), option->rect.height());
4644  } else {
4645  p1 = QPoint(0, option->rect.height()/2);
4646  p2 = QPoint(option->rect.width(), p1.y());
4647  }
4648 
4649 
4650  painter->setPen(option->palette.mid().color());
4651  if (d->doubleControls) {
4652  QPen pen = painter->pen();
4653  pen.setWidth(2);
4654  pen.setCapStyle(Qt::FlatCap);
4655  painter->setPen(pen);
4656  }
4657  painter->drawLine(p1, p2);
4658  painter->restore();
4659  break; }
4660 #endif // QT_NO_TOOLBAR
4662  painter->save();
4663  painter->translate(option->rect.x(), option->rect.y());
4664  if (option->state & State_Horizontal) {
4665  int x = option->rect.width() / 2 - 4;
4667  x -= 2;
4668  if (option->rect.height() > 4) {
4669  qDrawWinButton(painter,x-1,0,7,option->rect.height(), option->palette, false, 0);
4670 
4671  qDrawShadePanel(painter, x, 1, 3, option->rect.height() - 1,
4672  option->palette, false, 0);
4673  qDrawShadePanel(painter, x + 3, 1, 3, option->rect.height() - 1,
4674  option->palette, false, 0);
4675  painter->setPen(option->palette.button().color());
4676  }
4677  } else {
4678  if (option->rect.width() > 4) {
4679  int y = option->rect.height() / 2 - 4;
4680  qDrawShadePanel(painter, 2, y, option->rect.width() - 2, 3,
4681  option->palette, false, 0);
4682  qDrawShadePanel(painter, 2, y + 3, option->rect.width() - 2, 3,
4683  option->palette, false, 0);
4684  }
4685  }
4686  painter->restore();
4687  break;
4688 
4689 #ifndef QT_NO_PROGRESSBAR
4691  bool vertical = false;
4692  if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option))
4693  vertical = (pb2->orientation == Qt::Vertical);
4694  if (!vertical) {
4695  painter->fillRect(option->rect.x(), option->rect.y()+2, option->rect.width(), option->rect.height()-4,
4696  option->palette.brush(QPalette::Highlight));
4697  } else {
4698  painter->fillRect(option->rect.x()+2, option->rect.y(), option->rect.width()-4, option->rect.height(),
4699  option->palette.brush(QPalette::Highlight));
4700  }
4701  }
4702  break;
4703 #endif // QT_NO_PROGRESSBAR
4704 
4705  case PE_FrameButtonTool: {
4706 #ifndef QT_NO_DOCKWIDGET
4707  if (widget && widget->inherits("QDockWidgetTitleButton")) {
4708  if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent()))
4709  if (dw->isFloating()){
4710  qDrawPlainRect(painter,option->rect.adjusted(1, 1, 0, 0),
4711  option->palette.shadow().color(),1,&option->palette.button());
4712  return;
4713  }
4714  }
4715 #endif // QT_NO_DOCKWIDGET
4716  QBrush fill;
4717  bool stippled;
4718  bool panel = (element == PE_PanelButtonTool);
4719  if ((!(option->state & State_Sunken ))
4720  && (!(option->state & State_Enabled)
4721  || ((option->state & State_Enabled ) && !(option->state & State_MouseOver)))
4722  && (option->state & State_On)) {
4723  fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
4724  stippled = true;
4725  } else {
4726  fill = option->palette.brush(QPalette::Button);
4727  stippled = false;
4728  }
4729  if (option->state & (State_Raised | State_Sunken | State_On)) {
4730  if (option->state & State_AutoRaise) {
4731  if(option->state & (State_Enabled | State_Sunken | State_On)){
4732  if (panel)
4733  qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill);
4734  else
4735  qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill);
4736  }
4737  if (stippled) {
4738  painter->setPen(option->palette.button().color());
4739  painter->drawRect(option->rect.adjusted(1, 1, -2, -2));
4740  }
4741  } else {
4742  qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill);
4743  }
4744  } else {
4745  painter->fillRect(option->rect, fill);
4746  }
4747  break; }
4748 
4749  case PE_FrameFocusRect:
4750  if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) {
4751  //### check for d->alt_down
4752  int penSize;
4753  d->doubleControls ? penSize = 2 : penSize = 1;
4754  bool alternateFocusStyle = false;
4755  if (!widget)
4756  alternateFocusStyle = true;
4757 #ifndef QT_NO_COMBOBOX
4758  if (qobject_cast<const QComboBox*>(widget))
4759  alternateFocusStyle = true;
4760 #endif
4761  if (!(fropt->state & State_KeyboardFocusChange) && !styleHint(SH_UnderlineShortcut, option))
4762  return;
4763  QRect r = option->rect;
4764  painter->save();
4765  painter->setBackgroundMode(Qt::TransparentMode);
4766  if (alternateFocusStyle) {
4767  QColor bg_col = fropt->backgroundColor;
4768  if (!bg_col.isValid())
4769  bg_col = painter->background().color();
4770  // Create an "XOR" color.
4771  QColor patternCol((bg_col.red() ^ 0xff) & 0xff,
4772  (bg_col.green() ^ 0xff) & 0xff,
4773  (bg_col.blue() ^ 0xff) & 0xff);
4774  painter->setBrush(QBrush(patternCol, Qt::Dense4Pattern));
4775  painter->setBrushOrigin(r.topLeft());
4776  }
4777  else {
4778  painter->setPen(option->palette.highlight().color());
4779  painter->setBrush(option->palette.highlight());
4780  }
4781  painter->setPen(Qt::NoPen);
4782  painter->setBrushOrigin(r.topLeft());
4783  painter->drawRect(r.left(), r.top(), r.width(), penSize); // Top
4784  painter->drawRect(r.left(), r.bottom(), r.width() + penSize - 1, penSize); // Bottom
4785  painter->drawRect(r.left(), r.top(), penSize, r.height()); // Left
4786  painter->drawRect(r.right(), r.top(), penSize, r.height()); // Right
4787  painter->restore();
4788  }
4789  break;
4790 
4791  case PE_PanelButtonBevel: {
4792  QBrush fill;
4793  bool panel = element != PE_FrameButtonBevel;
4794  painter->setBrushOrigin(option->rect.topLeft());
4795  if (!(option->state & State_Sunken) && (option->state & State_On))
4796  fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
4797  else
4798  fill = option->palette.brush(QPalette::Button);
4799 
4800  if (option->state & (State_Raised | State_On | State_Sunken)) {
4801  if (d->doubleControls)
4802  qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),2,&fill);
4803  else
4804  qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),1,&fill);
4805  } else {
4806  if (panel)
4807  painter->fillRect(option->rect, fill);
4808  else
4809  painter->drawRect(option->rect);
4810  }
4811  break; }
4812 
4813  case PE_FrameGroupBox:
4814  if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
4815 
4816  const QStyleOptionFrameV2 *frame2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(option);
4817  if (frame2 && !(frame2->features & QStyleOptionFrameV2::Flat)) {
4818  QPen oldPen = painter->pen();
4819  QRect r = frame->rect;
4820  painter->setPen(frame->palette.shadow().color());
4821  painter->fillRect(r.x(), r.y(), r.x() + r.width()-1,
4823  frame->palette.light());
4824  painter ->drawLine(r.topLeft() + QPoint(-2, 1), r.topRight()+ QPoint(0, 1));
4825  if (d->doubleControls)
4826  painter ->drawLine(r.topLeft() + QPoint(-2, 2), r.topRight()+ QPoint(0, 2));
4827  painter->setPen(oldPen);
4828  }
4829  }
4830  break;
4831 
4832  case PE_IndicatorCheckBox: {
4833  QBrush fill;
4834  QRect r = d->doubleControls ? option->rect.adjusted(0,1,0,-1) : option->rect;
4835  if (option->state & State_NoChange)
4836  fill = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern);
4837  else if (option->state & State_Sunken)
4838  fill = option->palette.button();
4839  else if (option->state & State_Enabled)
4840  fill = option->palette.base();
4841  else
4842  fill = option->palette.background();
4843  painter->save();
4844  doRestore = true;
4845  if (d->doubleControls && (option->state & State_NoChange))
4846  painter->fillRect(r, fill);
4847  else
4848  painter->fillRect(option->rect, fill);
4849  painter->setPen(option->palette.shadow().color());
4850  painter->drawLine(r.topLeft(), r.topRight());
4851  painter->drawLine(r.topRight(), r.bottomRight());
4852  painter->drawLine(r.bottomLeft(), r.bottomRight());
4853  painter->drawLine(r.bottomLeft(), r.topLeft());
4854  if (d->doubleControls) {
4855  QRect r0 = r.adjusted(1, 1, -1, -1);
4856  painter->drawLine(r0.topLeft(), r0.topRight());
4857  painter->drawLine(r0.topRight(), r0.bottomRight());
4858  painter->drawLine(r0.bottomLeft(), r0.bottomRight());
4859  painter->drawLine(r0.bottomLeft(), r0.topLeft());
4860  }
4861  if (option->state & State_HasFocus) {
4862  painter->setPen(option->palette.highlight().color());
4863  QRect r2 = d->doubleControls ? r.adjusted(2, 2, -2, -2) : r.adjusted(1, 1, -1, -1);
4864  painter->drawLine(r2.topLeft(), r2.topRight());
4865  painter->drawLine(r2.topRight(), r2.bottomRight());
4866  painter->drawLine(r2.bottomLeft(), r2.bottomRight());
4867  painter->drawLine(r2.bottomLeft(), r2.topLeft());
4868  if (d->doubleControls) {
4869  QRect r3 = r2.adjusted(1, 1, -1, -1);
4870  painter->drawLine(r3.topLeft(), r3.topRight());
4871  painter->drawLine(r3.topRight(), r3.bottomRight());
4872  painter->drawLine(r3.bottomLeft(), r3.bottomRight());
4873  painter->drawLine(r3.bottomLeft(), r3.topLeft());
4874  }
4875  painter->setPen(option->palette.shadow().color());
4876  }
4877  //fall through...
4878  }
4880  case PE_Q3CheckListIndicator: {
4881  if (!doRestore) {
4882  painter->save();
4883  doRestore = true;
4884  }
4885  if (element == PE_Q3CheckListIndicator || element == PE_IndicatorViewItemCheck) {
4886  painter->setPen(option->palette.shadow().color());
4887  if (option->state & State_NoChange)
4888  painter->setBrush(option->palette.brush(QPalette::Button));
4889  if (d->doubleControls) {
4890  QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize * 2, windowsMobileitemViewCheckBoxSize * 2);
4891  qDrawPlainRect(painter, r, option->palette.shadow().color(), 2);
4892  } else {
4893  QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize, windowsMobileitemViewCheckBoxSize);
4894  qDrawPlainRect(painter, r, option->palette.shadow().color(), 1);
4895  }
4896  if (option->state & State_Enabled)
4897  d->imageChecked.setColor(1, option->palette.shadow().color().rgba());
4898  else
4899  d->imageChecked.setColor(1, option->palette.dark().color().rgba());
4900  if (!(option->state & State_Off)) {
4901  if (d->doubleControls)
4902  painter->drawImage(option->rect.x(), option->rect.y(), d->imageChecked);
4903  else
4904  painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageChecked);
4905  }
4906  }
4907  else {
4908  if (option->state & State_NoChange)
4909  d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba());
4910  else if (option->state & State_Enabled)
4911  d->imageCheckedBold.setColor(1, option->palette.shadow().color().rgba());
4912  else
4913  d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba());
4914  if (!(option->state & State_Off)) {
4915  if (d->doubleControls)
4916  painter->drawImage(option->rect.x() + 2, option->rect.y(), d->imageCheckedBold);
4917  else
4918  painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageCheckedBold);
4919  }
4920  }
4921  if (doRestore)
4922  painter->restore();
4923  break; }
4924  case PE_IndicatorRadioButton: {
4925  painter->save();
4926 
4927  if (option->state & State_HasFocus) {
4928  d->imageRadioButtonHighlighted.setColor(1, option->palette.shadow().color().rgba());
4929  d->imageRadioButtonHighlighted.setColor(2, option->palette.highlight().color().rgba());
4930  painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButtonHighlighted);
4931  }
4932  else {
4933  d->imageRadioButton.setColor(1, option->palette.shadow().color().rgba());
4934  painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButton);
4935  }
4936  if (option->state & (State_Sunken | State_On)) {
4937  if (option->state & State_Enabled)
4938  d->imageRadioButtonChecked.setColor(1, option->palette.shadow().color().rgba());
4939  else
4940  d->imageRadioButtonChecked.setColor(1, option->palette.dark().color().rgba());
4941 
4942  static const int offset = d->doubleControls ? 6 : 3;
4943  painter->drawImage(option->rect.x() + offset, option->rect.y() + offset, d->imageRadioButtonChecked);
4944  }
4945  painter->restore();
4946  break; }
4947  case PE_PanelButtonCommand:
4948  if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
4949  QBrush fill;
4950  State flags = option->state;
4951  QPalette pal = option->palette;
4952  QRect r = option->rect;
4953  if ((flags & State_Sunken || flags & State_On) )
4954  fill = pal.brush(QPalette::Shadow);
4955  else
4956  fill = pal.brush(QPalette::Button);
4957  int singleLine = 1;
4958  int doubleLine = 2;
4959  if (d->doubleControls) {
4960  singleLine = 2;
4961  doubleLine = 4;
4962  }
4963  if (button->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) {
4964  if (d->doubleControls) {
4965  qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill);
4966  qDrawPlainRect(painter, r.adjusted(1, 1, -1, 1), pal.shadow().color(), 1, &fill);
4967  }
4968  else {
4969  qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill);
4970  }
4971  } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) {
4972  qDrawPlainRect(painter, r, pal.shadow().color(), singleLine, &fill);
4973  } else {
4974  painter->fillRect(r, fill);
4975  }
4976  }
4977  break;
4978  case PE_FrameDefaultButton: {
4979  painter->save();
4980  painter->setPen(option->palette.shadow().color());
4981  QRect rect = option->rect;
4982  if (d->doubleControls) {
4983  rect.adjust(1, 1, -2, -2);
4984  painter->drawRect(rect);
4985  painter->drawRect(rect.adjusted(1, 1, -1, -1));
4986  }
4987 
4988  else {
4989  rect.adjust(2, 2, -3, -3);
4990  painter->drawRect(rect);
4991  }
4992  painter->restore();
4993  break; }
4994  case PE_IndicatorSpinPlus:
4995  case PE_IndicatorSpinMinus: {
4996  QRect r = option->rect;
4997  int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget)+2;
4998  QRect br = r.adjusted(fw, fw, -fw, -fw);
4999  int offset = (option->state & State_Sunken) ? 1 : 0;
5000  int step = (br.width() + 4) / 5;
5001  painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2,
5002  br.width(), step, option->palette.buttonText());
5003  if (element == PE_IndicatorSpinPlus)
5004  painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4,
5005  step, br.height() - 7, option->palette.buttonText());
5006  break; }
5007  case PE_IndicatorSpinUp:
5008  case PE_IndicatorSpinDown: {
5009  painter->save();
5010  QPoint points[7];
5011  switch (element) {
5012  case PE_IndicatorSpinUp:
5013  points[0] = QPoint(-2, -4);
5014  points[1] = QPoint(-2, 2);
5015  points[2] = QPoint(-1, -3);
5016  points[3] = QPoint(-1, 1);
5017  points[4] = QPoint(0, -2);
5018  points[5] = QPoint(0, 0);
5019  points[6] = QPoint(1, -1);
5020  break;
5021  case PE_IndicatorSpinDown:
5022  points[0] = QPoint(0, -4);
5023  points[1] = QPoint(0, 2);
5024  points[2] = QPoint(-1, -3);
5025  points[3] = QPoint(-1, 1);
5026  points[4] = QPoint(-2, -2);
5027  points[5] = QPoint(-2, 0);
5028  points[6] = QPoint(-3, -1);
5029  break;
5030  default:
5031  break;
5032  }
5033  if (option->state & State_Sunken)
5034  painter->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal),
5036  if (option->state & State_Enabled) {
5037  painter->translate(option->rect.x() + option->rect.width() / 2,
5038  option->rect.y() + option->rect.height() / 2);
5039  painter->setPen(option->palette.buttonText().color());
5040  painter->drawLine(points[0], points[1]);
5041  painter->drawLine(points[2], points[3]);
5042  painter->drawLine(points[4], points[5]);
5043  painter->drawPoint(points[6]);
5044  } else {
5045  painter->translate(option->rect.x() + option->rect.width() / 2 + 1,
5046  option->rect.y() + option->rect.height() / 2 + 1);
5047  painter->setPen(option->palette.light().color());
5048  painter->drawLine(points[0], points[1]);
5049  painter->drawLine(points[2], points[3]);
5050  painter->drawLine(points[4], points[5]);
5051  painter->drawPoint(points[6]);
5052  painter->translate(-1, -1);
5053  painter->setPen(option->palette.mid().color());
5054  painter->drawLine(points[0], points[1]);
5055  painter->drawLine(points[2], points[3]);
5056  painter->drawLine(points[4], points[5]);
5057  painter->drawPoint(points[6]);
5058  }
5059  painter->restore();
5060  break; }
5061 
5066 
5067  case PE_IndicatorArrowUp:
5068  case PE_IndicatorArrowDown:
5070  case PE_IndicatorArrowLeft: {
5071  painter->save();
5072 
5073  if (d->doubleControls) {
5074  QColor color;
5075  if (option->state & State_Sunken)
5076  color = option->palette.light().color();
5077  else
5078  color = option->palette.buttonText().color();
5079  QImage image;
5080  int xoffset, yoffset;
5081  bool isTabBarArrow = widget && widget->parent()
5082  && widget->inherits("QToolButton")
5083  && widget->parent()->inherits("QTabBar");
5084 
5085  switch (element) {
5086  case PE_IndicatorArrowUp:
5087  image = d->imageArrowUp;
5088  xoffset = 1;
5089  yoffset = 12;
5090  break;
5091  case PE_IndicatorArrowDown:
5092  image = d->imageArrowDown;
5093  xoffset = 1;
5094  yoffset =12;
5095  break;
5096  case PE_IndicatorArrowLeft:
5097  image = d->imageArrowLeft;
5098  xoffset = 8;
5099  yoffset = isTabBarArrow ? 12 : 2;
5100  break;
5102  image = d->imageArrowRight;
5103  xoffset = 8;
5104  yoffset = isTabBarArrow ? 12 : 2;
5105  break;
5107  image = d->imageArrowUpBig;
5108  xoffset = 3;
5109  yoffset = 12;
5110  break;
5112  image = d->imageArrowDownBig;
5113  xoffset = 2;
5114  yoffset =12;
5115  break;
5117  image = d->imageArrowLeftBig;
5118  xoffset = 8;
5119  yoffset = 2;
5120  break;
5122  image = d->imageArrowRightBig;
5123  xoffset = 8;
5124  yoffset = 2;
5125  break;
5126  default:
5127  break;
5128  }
5129  image.setColor(1, color.rgba());
5130  painter->drawImage(option->rect.x() + xoffset, option->rect.y() + yoffset, image);
5131  }
5132  else {
5133  QPoint points[7];
5134  switch (element) {
5135  case PE_IndicatorArrowUp:
5137  points[0] = QPoint(-3, 1);
5138  points[1] = QPoint(3, 1);
5139  points[2] = QPoint(-2, 0);
5140  points[3] = QPoint(2, 0);
5141  points[4] = QPoint(-1, -1);
5142  points[5] = QPoint(1, -1);
5143  points[6] = QPoint(0, -2);
5144  break;
5145  case PE_IndicatorArrowDown:
5147  points[0] = QPoint(-3, -1);
5148  points[1] = QPoint(3, -1);
5149  points[2] = QPoint(-2, 0);
5150  points[3] = QPoint(2, 0);
5151  points[4] = QPoint(-1, 1);
5152  points[5] = QPoint(1, 1);
5153  points[6] = QPoint(0, 2);
5154  break;
5157  points[0] = QPoint(-2, -3);
5158  points[1] = QPoint(-2, 3);
5159  points[2] = QPoint(-1, -2);
5160  points[3] = QPoint(-1, 2);
5161  points[4] = QPoint(0, -1);
5162  points[5] = QPoint(0, 1);
5163  points[6] = QPoint(1, 0);
5164  break;
5165  case PE_IndicatorArrowLeft:
5167  points[0] = QPoint(0, -3);
5168  points[1] = QPoint(0, 3);
5169  points[2] = QPoint(-1, -2);
5170  points[3] = QPoint(-1, 2);
5171  points[4] = QPoint(-2, -1);
5172  points[5] = QPoint(-2, 1);
5173  points[6] = QPoint(-3, 0);
5174  break;
5175  default:
5176  break;
5177  }
5178  if (option->state & State_Sunken)
5179  painter->setPen(option->palette.light().color());
5180  else
5181  painter->setPen(option->palette.buttonText().color());
5182  if (option->state & State_Enabled) {
5183  painter->translate(option->rect.x() + option->rect.width() / 2,
5184  option->rect.y() + option->rect.height() / 2 - 1);
5185  painter->drawLine(points[0], points[1]);
5186  painter->drawLine(points[2], points[3]);
5187  painter->drawLine(points[4], points[5]);
5188  painter->drawPoint(points[6]);
5189  } else {
5190  painter->translate(option->rect.x() + option->rect.width() / 2,
5191  option->rect.y() + option->rect.height() / 2 - 1);
5192  painter->setPen(option->palette.mid().color());
5193  painter->drawLine(points[0], points[1]);
5194  painter->drawLine(points[2], points[3]);
5195  painter->drawLine(points[4], points[5]);
5196  painter->drawPoint(points[6]);
5197  }
5198  }
5199  painter->restore();
5200  break; }
5201 #ifndef QT_NO_TABWIDGET
5202  case PE_FrameTabWidget:
5203  if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
5204  QRect rect = option->rect;
5205  QPalette pal = option->palette;
5206  painter->save();
5207  QBrush fill = pal.light();
5208  painter->fillRect(rect, fill);
5209  painter->setPen(pal.shadow().color());
5210  if (d->doubleControls) {
5211  QPen pen = painter->pen();
5212  pen.setWidth(2);
5213  pen.setCapStyle(Qt::FlatCap);
5214  painter->setPen(pen);
5215  }
5216  switch (tab->shape) {
5217  case QTabBar::RoundedNorth:
5218 #ifdef Q_WS_WINCE_WM
5219  if (!d->wm65)
5220 #endif
5221  {
5222  if (d->doubleControls)
5223  painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1));
5224  else
5225  painter->drawLine(rect.topLeft(), rect.topRight());
5226  }
5227  break;
5228  case QTabBar::RoundedSouth:
5229 #ifdef Q_WS_WINCE_WM
5230  if (!d->wm65)
5231 #endif
5232  {
5233  if (d->doubleControls)
5234  painter->drawLine(rect.bottomLeft(), rect.bottomRight());
5235  else
5236  painter->drawLine(rect.bottomLeft(), rect.bottomRight());
5237  }
5238  break;
5239  case QTabBar::RoundedEast:
5240 #ifdef Q_WS_WINCE_WM
5241  if (!d->wm65)
5242 #endif
5243  painter->drawLine(rect.topRight(), rect.bottomRight());
5244  break;
5245  case QTabBar::RoundedWest:
5246 #ifdef Q_WS_WINCE_WM
5247  if (!d->wm65)
5248 #endif
5249  painter->drawLine(rect.topLeft(), rect.bottomLeft());
5250  break;
5255  if (d->doubleControls)
5256  qDrawPlainRect(painter, rect.adjusted(0,-2,0,0), option->palette.shadow().color(),2,&pal.light());
5257  else
5258  qDrawPlainRect(painter, rect, option->palette.shadow().color(),1,&pal.light());
5259  break;
5260  default:
5261  break;
5262  }
5263  painter->restore();
5264  }
5265  break;
5266 #endif //QT_NO_TABBAR
5267 #ifndef QT_NO_ITEMVIEWS
5268  case PE_PanelItemViewRow:
5269  if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
5270  QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
5272  if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
5273  cg = QPalette::Inactive;
5274 
5276  d->drawPanelItemViewSelected(painter, vopt);
5277  else if (vopt->features & QStyleOptionViewItemV2::Alternate)
5278  painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase));
5279  else if (!(vopt->state & QStyle::State_Enabled))
5280  painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base));
5281  }
5282  break;
5283  case PE_PanelItemViewItem:
5284  if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
5285  QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
5287  if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
5288  cg = QPalette::Inactive;
5289 
5290  if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) {
5291  d->drawPanelItemViewSelected(painter, vopt);
5292  } else {
5293  if (vopt->backgroundBrush.style() != Qt::NoBrush) {
5294  QPointF oldBO = painter->brushOrigin();
5295  painter->setBrushOrigin(vopt->rect.topLeft());
5296  painter->fillRect(vopt->rect, vopt->backgroundBrush);
5297  painter->setBrushOrigin(oldBO);
5298  }
5299 
5300  if (vopt->state & QStyle::State_Selected) {
5302  d->drawPanelItemViewSelected(painter, vopt, textRect);
5303  }
5304  }
5305  }
5306  break;
5307 #endif //QT_NO_ITEMVIEWS
5308 
5309  case PE_FrameWindow: {
5310  QPalette popupPal = option->palette;
5311  popupPal.setColor(QPalette::Light, option->palette.background().color());
5312  popupPal.setColor(QPalette::Midlight, option->palette.light().color());
5313  if (d->doubleControls)
5314  qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),2,0);
5315  else
5316  qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),1,0);
5317  break; }
5318  case PE_FrameTabBarBase: {
5319  break; }
5320  case PE_Widget:
5321  break;
5323  int markW = option->rect.width() > 7 ? 7 : option->rect.width();
5324  int markH = markW;
5325  if (d->doubleControls)
5326  markW*=2;
5327  markH*=2;
5328  int posX = option->rect.x() + (option->rect.width() - markW)/2 + 1;
5329  int posY = option->rect.y() + (option->rect.height() - markH)/2;
5330 
5332  a.reserve(markH);
5333 
5334  int i, xx, yy;
5335  xx = posX;
5336  yy = 3 + posY;
5337  for (i = 0; i < markW/2; ++i) {
5338  a << QLineF(xx, yy, xx, yy + 2);
5339  ++xx;
5340  ++yy;
5341  }
5342  yy -= 2;
5343  for (; i < markH; ++i) {
5344  a << QLineF(xx, yy, xx, yy + 2);
5345  ++xx;
5346  --yy;
5347  }
5348  if (!(option->state & State_Enabled) && !(option->state & State_On)) {
5349  int pnt;
5350  painter->setPen(option->palette.highlightedText().color());
5351  QPoint offset(1, 1);
5352  for (pnt = 0; pnt < a.size(); ++pnt)
5353  a[pnt].translate(offset.x(), offset.y());
5354  painter->drawLines(a);
5355  for (pnt = 0; pnt < a.size(); ++pnt)
5356  a[pnt].translate(offset.x(), offset.y());
5357  }
5358  painter->setPen(option->palette.text().color());
5359  painter->drawLines(a);
5360  break; }
5361  case PE_IndicatorBranch: {
5362  // Copied from the Windows style.
5363  static const int decoration_size = d->doubleControls ? 18 : 9;
5364  static const int ofsA = d->doubleControls ? 4 : 2;
5365  static const int ofsB = d->doubleControls ? 8 : 4;
5366  static const int ofsC = d->doubleControls ? 12 : 6;
5367  static const int ofsD = d->doubleControls ? 1 : 0;
5368  int mid_h = option->rect.x() + option->rect.width() / 2;
5369  int mid_v = option->rect.y() + option->rect.height() / 2;
5370  int bef_h = mid_h;
5371  int bef_v = mid_v;
5372  int aft_h = mid_h;
5373  int aft_v = mid_v;
5374  if (option->state & State_Children) {
5375  int delta = decoration_size / 2;
5376  bef_h -= delta;
5377  bef_v -= delta;
5378  aft_h += delta;
5379  aft_v += delta;
5380  QPen oldPen = painter->pen();
5381  QPen crossPen = oldPen;
5382  crossPen.setWidth(2);
5383  painter->setPen(crossPen);
5384  painter->drawLine(bef_h + ofsA + ofsD, bef_v + ofsB + ofsD, bef_h + ofsC + ofsD, bef_v + ofsB + ofsD);
5385  if (!(option->state & State_Open))
5386  painter->drawLine(bef_h + ofsB + ofsD, bef_v + ofsA + ofsD, bef_h + ofsB + ofsD, bef_v + ofsC + ofsD);
5387  painter->setPen(option->palette.dark().color());
5388  painter->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1);
5389  if (d->doubleControls)
5390  painter->drawRect(bef_h + 1, bef_v + 1, decoration_size - 3, decoration_size - 3);
5391  painter->setPen(oldPen);
5392  }
5393  QBrush brush(option->palette.dark().color(), Qt::Dense4Pattern);
5394  if (option->state & State_Item) {
5395  if (option->direction == Qt::RightToLeft)
5396  painter->fillRect(option->rect.left(), mid_v, bef_h - option->rect.left(), 1, brush);
5397  else
5398  painter->fillRect(aft_h, mid_v, option->rect.right() - aft_h + 1, 1, brush);
5399  }
5400  if (option->state & State_Sibling)
5401  painter->fillRect(mid_h, aft_v, 1, option->rect.bottom() - aft_v + 1, brush);
5402  if (option->state & (State_Open | State_Children | State_Item | State_Sibling))
5403  painter->fillRect(mid_h, option->rect.y(), 1, bef_v - option->rect.y(), brush);
5404  break; }
5405  case PE_Frame:
5406  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),
5407  d->doubleControls ? 2 : 1, &option->palette.background());
5408  break;
5409  case PE_FrameLineEdit:
5410  case PE_FrameMenu:
5411  if (d->doubleControls)
5412  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2);
5413  else
5414  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1);
5415  break;
5416  case PE_FrameStatusBar:
5417  if (d->doubleControls)
5418  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2,0);
5419  else
5420  qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1,0);
5421  break;
5422 
5423  default:
5424  QWindowsStyle::drawPrimitive(element, option, painter, widget);
5425  break;
5426  }
5427 }
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
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
void setColor(int i, QRgb c)
Sets the color at the given index in the color table, to the given to colorValue. ...
Definition: qimage.cpp:1850
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
The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-l...
Definition: qdockwidget.h:60
static const int windowsMobileitemViewCheckBoxSize
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen&#39;s cap style to the given style.
Definition: qpen.cpp:723
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
void drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItemV4 *option, QRect rect=QRect())
static const int PE_IndicatorArrowUpBig
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
Definition: qstyleoption.h:609
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
long ASN1_INTEGER_get ASN1_INTEGER * a
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
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...
ColorGroup
Definition: qpalette.h:92
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.
The QStyleOptionProgressBarV2 class is used to describe the parameters necessary for drawing a progre...
Definition: qstyleoption.h:417
static const int PE_IndicatorArrowDownBig
QPoint bottomRight() const
Returns the position of the rectangle&#39;s bottom-right corner.
Definition: qrect.h:291
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 QStyleOptionFocusRect class is used to describe the parameters for drawing a focus rectangle with...
Definition: qstyleoption.h:103
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
Definition: qstyleoption.h:118
void qDrawWinButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, const QBrush *fill)
Definition: qdrawutil.cpp:435
The QStyleOptionTabWidgetFrame class is used to describe the parameters for drawing the frame around ...
Definition: qstyleoption.h:175
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
The State element defines configurations of objects and properties.
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition: qobject.h:275
FrameFeatures features
a bitwise OR of the features that describe this frame.
Definition: qstyleoption.h:143
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Definition: qpalette.cpp:874
#define QT_NO_TABWIDGET
QPoint topRight() const
Returns the position of the rectangle&#39;s top-right corner.
Definition: qrect.h:294
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
const QBrush & shadow() const
Returns the shadow brush of the current color group.
Definition: qpalette.h:139
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=0) const =0
Returns the sub-area for the given element as described in the provided style option.
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
QPoint bottomLeft() const
Returns the position of the rectangle&#39;s bottom-left corner.
Definition: qrect.h:297
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
T qstyleoption_cast(const QStyleOption *opt)
Definition: qstyleoption.h:885
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
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 QStyleOptionFrameV2 class is used to describe the parameters necessary for drawing a frame in Qt ...
Definition: qstyleoption.h:134
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
const QStyle * proxy() const
Definition: qstyle.cpp:2546
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
Definition: qstyleoption.h:304
static const int windowsMobileFrameGroupBoxOffset
static const int PE_IndicatorArrowRightBig
void reserve(int size)
Attempts to allocate memory for at least size elements.
Definition: qvector.h:339
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
static const int PE_IndicatorArrowLeftBig
bool isValid() const
Returns true if the color is valid; otherwise returns false.
Definition: qcolor.h:295
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
static const int windowsItemFrame
void setWidth(int width)
Sets the pen width to the given width in pixels with integer precision.
Definition: qpen.cpp:667
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
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ generatedIconPixmap()

QPixmap QWindowsMobileStyle::generatedIconPixmap ( QIcon::Mode  iconMode,
const QPixmap pixmap,
const QStyleOption opt 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 7237 of file qwindowsmobilestyle.cpp.

7238  {
7239 
7240  switch (iconMode) {
7241  case QIcon::Selected: {
7242 #ifdef Q_WS_WINCE_WM
7243  if (d_func()->wm65)
7244  return pixmap;
7245 #endif //Q_WS_WINCE_WM
7247  int imgh = img.height();
7248  int imgw = img.width();
7249  for (int y = 0; y < imgh; y += 2) {
7250  for (int x = 0; x < imgw; x += 2) {
7251  QColor c = option->palette.highlight().color().rgb();
7252  c.setAlpha( qAlpha(img.pixel(x, y)));
7253  QRgb pixel = c.rgba();
7254  img.setPixel(x, y, pixel);
7255  }
7256  }
7257  return QPixmap::fromImage(img);
7258  }
7259  default:
7260  break;
7261  }
7262  return QWindowsStyle::generatedIconPixmap(iconMode, pixmap, option);
7263 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QImage toImage() const
Converts the pixmap to a QImage.
Definition: qpixmap.cpp:542
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
Definition: qpixmap.cpp:2197
unsigned int QRgb
Definition: qrgb.h:53
unsigned char c[8]
Definition: qnumeric_p.h:62
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
Definition: qrgb.h:66
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
Reimplemented Function
QRgb pixel(int x, int y) const
Returns the color of the pixel at coordinates (x, y).
Definition: qimage.cpp:4240
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
void setPixel(int x, int y, uint index_or_rgb)
Sets the pixel index or color at (x, y) to index_or_rgb.
Definition: qimage.cpp:4311
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
Definition: qimage.cpp:3966
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
Definition: qcolor.cpp:1094
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019

◆ pixelMetric()

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

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 6919 of file qwindowsmobilestyle.cpp.

6919  {
6920 
6921  QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
6922  int ret;
6923 
6924  switch (pm) {
6926  ret =0;
6927  break;
6929  d->doubleControls ? ret = 8 : ret = 4;
6930  break;
6931  case PM_HeaderMargin:
6932  d->doubleControls ? ret = 2 : ret = 1;
6933  break;
6934  case PM_DefaultChildMargin:
6935  d->doubleControls ? ret = 10 : ret = 5;
6936  break;
6938  d->doubleControls ? ret = 6 : ret = 3;
6939  break;
6940  case PM_DefaultFrameWidth:
6941  d->doubleControls ? ret = 2 : ret = 1;
6942  break;
6943  case PM_MenuVMargin:
6944  ret = 1;
6945  break;
6946  case PM_MenuHMargin:
6947  ret = 1;
6948  break;
6950  ret = d->doubleControls ? 24 : 14;
6951  break;
6952  case PM_ComboBoxFrameWidth:
6953  d->doubleControls ? ret = 2 : ret = 1;
6954  break;
6955  case PM_SpinBoxFrameWidth:
6956  d->doubleControls ? ret = 2 : ret = 1;
6957  break;
6961  d->doubleControls ? ret = 2 : ret = 1;
6962  break;
6963 #ifndef QT_NO_TABBAR
6965  ret = 0;
6966  break;
6968  ret = 0;
6969  break;
6970 #endif
6972  ret = 60;
6973  break;
6974  case PM_TabBarTabVSpace:
6975  ret = d->doubleControls ? 12 : 6;
6976  break;
6977  case PM_TabBarBaseHeight:
6978  ret = 0;
6979  break;
6980  case PM_IndicatorWidth:
6982  break;
6983  case PM_IndicatorHeight:
6985  break;
6988  break;
6991  break;
6992 #ifndef QT_NO_SLIDER
6993  case PM_SliderLength:
6994  ret = d->doubleControls ? 16 : 8;
6995  break;
6996  case PM_FocusFrameHMargin:
6997  ret = d->doubleControls ? 1 : 2;
6998  break;
6999  case PM_SliderThickness:
7001  break;
7003  ret = d->doubleControls ? 14 * 2 : 18;
7004  break;
7007  ret = d->doubleControls ? 6 * 2 : 6;
7008  break;
7009  // Returns the number of pixels to use for the business part of the
7010  // slider (i.e., the non-tickmark portion). The remaining space is shared
7011  // equally between the tickmark regions.
7013  if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
7014  int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
7015  int ticks = sl->tickPosition;
7016  int n = 0;
7017  if (ticks & QSlider::TicksAbove)
7018  ++n;
7019  if (ticks & QSlider::TicksBelow)
7020  ++n;
7021  if (!n) {
7022  ret = space;
7023  break;
7024  }
7025  int thick = 8;
7026  if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
7027  thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4;
7028 
7029  space -= thick;
7030  if (space > 0)
7031  thick += (space * 2) / (n + 2);
7032  ret = thick;
7033  } else {
7034  ret = 0;
7035  }
7036  break;
7037 #endif // QT_NO_SLIDER
7038 #ifndef QT_NO_MENU
7039  case PM_SmallIconSize:
7041  break;
7042  case PM_ButtonMargin:
7043  d->doubleControls ? ret = 8 : ret = 4;
7044  break;
7045  case PM_LargeIconSize:
7046  d->doubleControls ? ret = 64 : ret = 32;
7047  break;
7048  case PM_IconViewIconSize:
7049  ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
7050  break;
7051  case PM_ToolBarIconSize:
7053  break;
7055  ret = 2;
7056  break;
7057 #if defined(Q_WS_WIN)
7058 #else
7060  ret = 4;
7061  break;
7062 #endif // Q_WS_WIN
7063  break;
7064 #endif // QT_NO_MENU
7065 
7066  case PM_TitleBarHeight:
7067  d->doubleControls ? ret = 42 : ret = 21;
7068  break;
7069  case PM_ScrollBarSliderMin:
7070 #ifdef Q_WS_WINCE_WM
7071  if (d->wm65)
7072 #else
7073  if (false)
7074 #endif
7075  {
7076  d->doubleControls ? ret = 68 : ret = 34;
7077  } else {
7078  d->doubleControls ? ret = 36 : ret = 18;
7079  }
7080  break;
7081  case PM_ScrollBarExtent: {
7082 
7083  if (d->smartphone)
7084  ret = 9;
7085  else
7086  d->doubleControls ? ret = 25 : ret = 13;
7087 
7088 #ifdef Q_WS_WINCE_WM
7089  if (d->wm65)
7090 #else
7091  if (false)
7092 #endif
7093  {
7094  d->doubleControls ? ret = 26 : ret = 13;
7095  break;
7096  }
7097 
7098 #ifndef QT_NO_SCROLLAREA
7099  //Check if the scrollbar is part of an abstractItemView and set size according
7100  if (widget)
7101  if (QWidget *parent = widget->parentWidget())
7102  if (qobject_cast<QAbstractScrollArea *>(parent->parentWidget()))
7103  if (d->smartphone)
7104  ret = 8;
7105  else
7106  d->doubleControls ? ret = 24 : ret = 12;
7107 #endif
7108  }
7109  break;
7110  case PM_SplitterWidth:
7111  ret = qMax(4, QApplication::globalStrut().width());
7112  break;
7113 
7114 #if defined(Q_WS_WIN)
7115  case PM_MDIFrameWidth:
7116  ret = 1;
7117  break;
7118 #endif
7120  d->doubleControls ? ret = 32 : ret = 16;
7121  break;
7122  case PM_ToolBarItemMargin:
7123  d->doubleControls ? ret = 2 : ret = 1;
7124  break;
7125  case PM_ToolBarItemSpacing:
7126  d->doubleControls ? ret = 2 : ret = 1;
7127  break;
7129  d->doubleControls ? ret = 16 : ret = 8;
7130  break;
7131  case PM_ButtonIconSize:
7132  d->doubleControls ? ret = 32 : ret = 16;
7133  break;
7134  case PM_TextCursorWidth:
7135  ret = 2;
7136  break;
7138  ret = 0;
7139  break;
7140  default:
7141  ret = QWindowsStyle::pixelMetric(pm, opt, widget);
7142  break;
7143  }
7144  return ret;
7145 }
double d
Definition: qnumeric_p.h:62
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
static const int windowsMobileExclusiveIndicatorSize
static QSize globalStrut()
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
static const int windowsMobileSliderThickness
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
int pixelMetric(PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
static const int windowsMobileIconSize
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
const QStyle * proxy() const
Definition: qstyle.cpp:2546
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
Definition: qstyleoption.h:701
static const int windowsMobileIndicatorSize

◆ polish() [1/3]

void QWindowsMobileStyle::polish ( QApplication application)
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 6885 of file qwindowsmobilestyle.cpp.

6885  {
6886  QWindowsStyle::polish(application);
6887 }
void polish(QApplication *)
Reimplemented Function

◆ polish() [2/3]

void QWindowsMobileStyle::polish ( QWidget widget)
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 6890 of file qwindowsmobilestyle.cpp.

6890  {
6891 
6892 #ifndef QT_NO_TOOLBAR
6893  if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
6894  QPalette pal = toolBar->palette();
6895  pal.setColor(QPalette::Background, pal.button().color());
6896  toolBar->setPalette(pal);
6897  }
6898  else
6899 #endif //QT_NO_TOOLBAR
6900 
6901  QWindowsStyle::polish(widget);
6902 }
void polish(QApplication *)
Reimplemented Function
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
The QToolBar class provides a movable panel that contains a set of controls.
Definition: qtoolbar.h:62
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
const QBrush & button() const
Returns the button brush of the current color group.
Definition: qpalette.h:125
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ polish() [3/3]

void QWindowsMobileStyle::polish ( QPalette palette)
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 6915 of file qwindowsmobilestyle.cpp.

6915  {
6916  QWindowsStyle::polish(palette);
6917 }
void polish(QApplication *)
Reimplemented Function

◆ setDoubleControls()

void QWindowsMobileStyle::setDoubleControls ( bool  doubleControls)

Definition at line 7273 of file qwindowsmobilestyle.cpp.

7273  {
7274 
7275  QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
7276 
7278 }
double d
Definition: qnumeric_p.h:62

◆ sizeFromContents()

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

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 6377 of file qwindowsmobilestyle.cpp.

6378  {
6379 
6380  QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget);
6381  switch (type) {
6382  case CT_PushButton:
6383  if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
6384  newSize = QCommonStyle::sizeFromContents(type, option, size, widget);
6385  int w = newSize.width(),
6386  h = newSize.height();
6387  int defwidth = 0;
6388  if (button->features & QStyleOptionButton::AutoDefaultButton)
6389  defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget);
6390 
6391  int minwidth = int(QStyleHelper::dpiScaled(55.0f));
6392  int minheight = int(QStyleHelper::dpiScaled(19.0f));
6393 
6394  if (w < minwidth + defwidth && button->icon.isNull())
6395  w = minwidth + defwidth;
6396  if (h < minheight + defwidth)
6397  h = minheight + defwidth;
6398  newSize = QSize(w + 4, h + 4);
6399  }
6400  break;
6401 
6402 #ifndef QT_NO_GROUPBOX
6403  case CT_GroupBox:
6404  if (const QGroupBox *grb = static_cast<const QGroupBox *>(widget)) {
6405  newSize = size + QSize(!grb->isFlat() ? 16 : 0, !grb->isFlat() ? 16 : 0);
6406  }
6407  break;
6408 #endif // QT_NO_GROUPBOX
6409 
6410  case CT_RadioButton:
6411  case CT_CheckBox:
6412  newSize = size;
6413  if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
6414  bool isRadio = (type == CT_RadioButton);
6415  QRect irect = visualRect(button->direction, button->rect,
6417  : SE_CheckBoxIndicator, button, widget));
6418  int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
6419  : PM_IndicatorHeight, button, widget);
6420  int margins = (!button->icon.isNull() && button->text.isEmpty()) ? 0 : 10;
6421  if (d_func()->doubleControls)
6422  margins *= 2;
6423  newSize += QSize(irect.right() + margins, 1);
6424  newSize.setHeight(qMax(newSize.height(), h));
6425  }
6426  break;
6427 #ifndef QT_NO_COMBOBOX
6428  case CT_ComboBox:
6429  if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
6430  int fw = comboBox->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0;
6431  newSize = QSize(newSize.width() + fw + 9, newSize.height() + fw); //Nine is a magic Number - See CommonStyle for real magic (23)
6432  }
6433  break;
6434 #endif
6435 #ifndef QT_NO_SPINBOX
6436  case CT_SpinBox:
6437  if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
6438  int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0;
6439  newSize = QSize(newSize.width() + fw-5, newSize.height() + fw-6);
6440  }
6441  break;
6442 #endif
6443 #ifndef QT_NO_LINEEDIT
6444  case CT_LineEdit:
6445  newSize += QSize(0,1);
6446  break;
6447 #endif
6448  case CT_ToolButton:
6449  newSize = QSize(newSize.width() + 1, newSize.height());
6450  break;
6451  case CT_TabBarTab:
6452  if (d_func()->doubleControls)
6453  newSize = QSize(newSize.width(), 42);
6454  else
6455  newSize = QSize(newSize.width(), 21);
6456  break;
6457  case CT_HeaderSection:
6458  newSize += QSize(4, 2);
6459  break;
6460 #ifndef QT_NO_ITEMVIEWS
6461 #ifdef Q_WS_WINCE_WM
6462  case CT_ItemViewItem:
6463  if (d_func()->wm65)
6464  if (d_func()->doubleControls)
6465  newSize.setHeight(46);
6466  else
6467  newSize.setHeight(23);
6468  break;
6469 #endif //Q_WS_WINCE_WM
6470 #endif //QT_NO_ITEMVIEWS
6471  default:
6472  break;
6473  }
6474  return newSize;
6475 }
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
Reimplemented Function
int type
Definition: qmetatype.cpp:239
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
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
The QGroupBox widget provides a group box frame with a title.
Definition: qgroupbox.h:57
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=0) const
Reimplemented Function
qreal dpiScaled(qreal value)
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
const QStyle * proxy() const
Definition: qstyle.cpp:2546
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QStyleOptionButton class is used to describe the parameters for drawing buttons.
Definition: qstyleoption.h:279

◆ standardPalette()

QPalette QWindowsMobileStyle::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 6864 of file qwindowsmobilestyle.cpp.

6864  {
6865  QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ),
6866  QColor(132, 130, 132), QColor(198, 195, 198), Qt::black, Qt::white, Qt::white, QColor(198, 195, 198));
6867  palette.setColor(QPalette::Window, QColor(206, 223, 239));
6868  palette.setColor(QPalette::Link, QColor(8,77,123)); //Alternate TextColor for labels...
6869  palette.setColor(QPalette::Base, Qt::white);
6870  palette.setColor(QPalette::Button, QColor(206, 223, 239));
6871  palette.setColor(QPalette::Highlight, QColor(49, 146, 214));
6872  palette.setColor(QPalette::Light, Qt::white);
6873  palette.setColor(QPalette::Text, Qt::black);
6874  palette.setColor(QPalette::ButtonText, Qt::black);
6875  palette.setColor(QPalette::Midlight, QColor(222, 223, 222 ));
6876  palette.setColor(QPalette::Dark, QColor(132, 130, 132));
6877  palette.setColor(QPalette::Mid, QColor(189, 190, 189));
6878  palette.setColor(QPalette::Shadow, QColor(0, 0, 0));
6879  palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow)
6880  return palette;
6881 }
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 QWindowsMobileStyle::standardPixmap ( StandardPixmap  sp,
const QStyleOption opt,
const QWidget widget 
) const
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 7187 of file qwindowsmobilestyle.cpp.

7188  {
7189 
7190  QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
7191  switch (sp) {
7192 #ifndef QT_NO_IMAGEFORMAT_XPM
7194  QPixmap pixmap = QCommonStyle::standardPixmap(sp, option, widget);
7195  if (d->doubleControls)
7196  return pixmap.scaledToHeight(pixmap.height() * 2);
7197  else
7198  return pixmap;
7199  }
7200  case SP_TitleBarMaxButton:
7203  case SP_TitleBarMinButton: {
7204  QImage image;
7205  switch (sp) {
7206  case SP_TitleBarMaxButton:
7207  image = d->imageMaximize;
7208  break;
7210  image = d->imageClose;
7211  break;
7213  image = d->imageNormalize;
7214  break;
7215  case SP_TitleBarMinButton:
7216  image = d->imageMinimize;
7217  break;
7218  default:
7219  break;
7220  }
7221  if (option) {
7222  image.setColor(0, option->palette.shadow().color().rgba());
7223  image.setColor(1, option->palette.highlight().color().rgba());
7224  image.setColor(2, option->palette.highlight().color().lighter(150).rgba());
7225  image.setColor(3, option->palette.highlightedText().color().rgba());
7226  }
7227 
7228  return QPixmap::fromImage(image);
7229  }
7230 
7231 #endif
7232  default:
7233  return QWindowsStyle::standardPixmap(sp, option, widget);
7234  }
7235 }
double d
Definition: qnumeric_p.h:62
QPixmap scaledToHeight(int h, Qt::TransformationMode mode=Qt::FastTransformation) const
Definition: qpixmap.cpp:1673
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
Definition: qpixmap.cpp:2197
void setColor(int i, QRgb c)
Sets the color at the given index in the color table, to the given to colorValue. ...
Definition: qimage.cpp:1850
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt=0, const QWidget *widget=0) const
Reimplemented Function
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=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
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645

◆ styleHint()

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

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 7147 of file qwindowsmobilestyle.cpp.

7148  {
7149 
7150  int ret;
7151  switch (hint) {
7152  case SH_Menu_MouseTracking:
7154  case SH_EtchDisabledText:
7155  ret = 0;
7156  break;
7157  case SH_DitherDisabledText:
7158  ret = 0;
7159  break;
7161  ret = 0;
7162  break;
7163 #ifndef QT_NO_TABWIDGET
7165  ret = QTabWidget::South;
7166  break;
7167 #endif
7168  case SH_ToolBar_Movable:
7169  ret = false;
7170  break;
7172  ret = false;
7173  break;
7175  ret = false;
7176  break;
7178  ret = RSIP_OnMouseClick;
7179  break;
7180  default:
7181  ret = QWindowsStyle::styleHint(hint, opt, widget, returnData);
7182  break;
7183  }
7184  return ret;
7185 }
QPointer< QWidget > widget
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function

◆ subControlRect()

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

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 6521 of file qwindowsmobilestyle.cpp.

6522  {
6523 
6524  QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
6525 
6526  QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget);
6527  switch (control) {
6528 
6529 #ifndef QT_NO_SCROLLBAR
6530  case CC_ScrollBar:
6531  if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
6532  int sliderButtonExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
6533  float stretchFactor = 1.4f;
6534  int sliderButtonExtentDir = int (sliderButtonExtent * stretchFactor);
6535 
6536 #ifdef Q_WS_WINCE_WM
6537  if (d->wm65)
6538  {
6539  sliderButtonExtent = d->imageScrollbarHandleUp.width();
6540  sliderButtonExtentDir = d->imageScrollbarHandleUp.height();
6541  }
6542 #endif //Q_WS_WINCE_WM
6543 
6544  int sliderlen;
6545  int maxlen = ((scrollbar->orientation == Qt::Horizontal) ?
6546  scrollbar->rect.width() : scrollbar->rect.height()) - (sliderButtonExtentDir * 2);
6547  // calculate slider length
6548  if (scrollbar->maximum != scrollbar->minimum) {
6549  uint range = scrollbar->maximum - scrollbar->minimum;
6550  sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep);
6551 
6552  int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
6553  if (sliderlen < slidermin || range > INT_MAX / 2)
6554  sliderlen = slidermin;
6555  if (sliderlen > maxlen)
6556  sliderlen = maxlen;
6557  } else {
6558  sliderlen = maxlen;
6559  }
6560  int sliderstart = sliderButtonExtentDir + sliderPositionFromValue(scrollbar->minimum,
6561  scrollbar->maximum,
6562  scrollbar->sliderPosition,
6563  maxlen - sliderlen,
6564  scrollbar->upsideDown);
6565  if (d->smartphone) {
6566  sliderstart -= sliderButtonExtentDir;
6567  sliderlen += 2*sliderButtonExtent;
6568  }
6569  switch (subControl) {
6570  case SC_ScrollBarSubLine: // top/left button
6571  if (scrollbar->orientation == Qt::Horizontal) {
6572  int buttonWidth = qMin(scrollbar->rect.width() / 2, sliderButtonExtentDir );
6573  rect.setRect(0, 0, buttonWidth, sliderButtonExtent);
6574  } else {
6575  int buttonHeight = qMin(scrollbar->rect.height() / 2, sliderButtonExtentDir);
6576  rect.setRect(0, 0, sliderButtonExtent, buttonHeight);
6577  }
6578  if (d->smartphone)
6579  rect.setRect(0, 0, 0, 0);
6580  break;
6581  case SC_ScrollBarAddLine: // bottom/right button
6582  if (scrollbar->orientation == Qt::Horizontal) {
6583  int buttonWidth = qMin(scrollbar->rect.width()/2, sliderButtonExtentDir);
6584  rect.setRect(scrollbar->rect.width() - buttonWidth, 0, buttonWidth, sliderButtonExtent);
6585  } else {
6586  int buttonHeight = qMin(scrollbar->rect.height()/2, sliderButtonExtentDir );
6587  rect.setRect(0, scrollbar->rect.height() - buttonHeight, sliderButtonExtent, buttonHeight);
6588  }
6589  if (d->smartphone)
6590  rect.setRect(0, 0, 0, 0);
6591  break;
6592  case SC_ScrollBarSubPage: // between top/left button and slider
6593  if (scrollbar->orientation == Qt::Horizontal)
6594  if (d->smartphone)
6595  rect.setRect(0, 0, sliderstart, sliderButtonExtent);
6596  else
6597  rect.setRect(sliderButtonExtent, 0, sliderstart - sliderButtonExtent, sliderButtonExtent);
6598  else
6599  if (d->smartphone)
6600  rect.setRect(0, 0, sliderButtonExtent, sliderstart);
6601  else
6602  rect.setRect(0, sliderButtonExtent, sliderButtonExtent, sliderstart - sliderButtonExtent);
6603  break;
6604  case SC_ScrollBarAddPage: // between bottom/right button and slider
6605  if (scrollbar->orientation == Qt::Horizontal)
6606  if (d->smartphone)
6607  rect.setRect(sliderstart + sliderlen, 0,
6608  maxlen - sliderstart - sliderlen + 2*sliderButtonExtent, sliderButtonExtent);
6609  else
6610  rect.setRect(sliderstart + sliderlen, 0,
6611  maxlen - sliderstart - sliderlen + sliderButtonExtent, sliderButtonExtent);
6612  else
6613  if (d->smartphone)
6614  rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent,
6615  maxlen - sliderstart - sliderlen + 2*sliderButtonExtent);
6616  else
6617  rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent,
6618  maxlen - sliderstart - sliderlen + sliderButtonExtent);
6619  break;
6620  case SC_ScrollBarGroove:
6621  if (scrollbar->orientation == Qt::Horizontal)
6622  rect.setRect(sliderButtonExtent, 0, scrollbar->rect.width() - sliderButtonExtent * 2,
6623  scrollbar->rect.height());
6624  else
6625  rect.setRect(0, sliderButtonExtent, scrollbar->rect.width(),
6626  scrollbar->rect.height() - sliderButtonExtent * 2);
6627  break;
6628  case SC_ScrollBarSlider:
6629  if (scrollbar->orientation == Qt::Horizontal)
6630  rect.setRect(sliderstart, 0, sliderlen, sliderButtonExtent);
6631  else
6632  rect.setRect(0, sliderstart, sliderButtonExtent, sliderlen);
6633  break;
6634  default:
6635  break;
6636  }
6637  rect = visualRect(scrollbar->direction, scrollbar->rect, rect);
6638  }
6639  break;
6640 #endif // QT_NO_SCROLLBAR
6641 
6642 
6643 
6644 #ifndef QT_NO_TOOLBUTTON
6645  case CC_ToolButton:
6646  if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
6647  int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolButton, widget);
6648  rect = toolButton->rect;
6649  switch (subControl) {
6650  case SC_ToolButton:
6651  if ((toolButton->features
6654  rect.adjust(0, 0, -mbi, 0);
6655  break;
6656  case SC_ToolButtonMenu:
6657  if ((toolButton->features
6660  rect.adjust(rect.width() - mbi, 1, 0, 1);
6661  break;
6662  default:
6663  break;
6664  }
6665  rect = visualRect(toolButton->direction, toolButton->rect, rect);
6666  }
6667  break;
6668 #endif // QT_NO_TOOLBUTTON
6669 
6670 #ifndef QT_NO_SLIDER
6671  case CC_Slider:
6672  if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
6673  int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
6674  int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
6675  switch (subControl) {
6676  case SC_SliderHandle: {
6677  int sliderPos = 0;
6678  int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
6679  bool horizontal = slider->orientation == Qt::Horizontal;
6680  sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum,
6681  slider->sliderPosition,
6682  (horizontal ? slider->rect.width()
6683  : slider->rect.height()) - len,
6684  slider->upsideDown);
6685  if (horizontal)
6686  rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness);
6687  else
6688  rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len);
6689  break; }
6690  default:
6691  break;
6692  }
6693  rect = visualRect(slider->direction, slider->rect, rect);
6694  }
6695  break;
6696 #endif //QT_NO_SLIDER
6697 #ifndef QT_NO_COMBOBOX
6698  case CC_ComboBox:
6699  if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
6700  int x = comboBox->rect.x(),
6701  y = comboBox->rect.y(),
6702  wi = comboBox->rect.width(),
6703  he = comboBox->rect.height();
6704  int xpos = x;
6705  int margin = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0;
6706  int bmarg = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0;
6707  if (subControl == SC_ComboBoxArrow)
6708  xpos += wi - int((he - 2*bmarg)*0.9) - bmarg;
6709  else
6710  xpos += wi - (he - 2*bmarg) - bmarg;
6711  switch (subControl) {
6712  case SC_ComboBoxArrow:
6713  rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg);
6714  break;
6715  case SC_ComboBoxEditField:
6716  rect.setRect(x + margin, y + margin, wi - 2 * margin - int((he - 2*bmarg) * 0.84f), he - 2 * margin);
6717  if (d->doubleControls) {
6718  if (comboBox->editable)
6719  rect.adjust(2, 0, 0, 0);
6720  else
6721  rect.adjust(4, 2, 0, -2);
6722  } else if (!comboBox->editable) {
6723  rect.adjust(2, 1, 0, -1);
6724  }
6725  break;
6726  case SC_ComboBoxFrame:
6727  rect = comboBox->rect;
6728  break;
6729  default:
6730  break;
6731  }
6732  }
6733 #endif //QT_NO_COMBOBOX
6734 #ifndef QT_NO_SPINBOX
6735  case CC_SpinBox:
6736  if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
6737  QSize bs;
6738  int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0;
6739  bs.setHeight(qMax(d->doubleControls ? 28 : 14, (spinBox->rect.height())));
6740  // 1.6 -approximate golden mean
6741  bs.setWidth(qMax(d->doubleControls ? 28 : 14, qMin((bs.height()*7/8), (spinBox->rect.width() / 8))));
6743  int x, lx, rx;
6744  x = spinBox->rect.width() - bs.width()*2;
6745  lx = fw;
6746  rx = x - fw;
6747  switch (subControl) {
6748  case SC_SpinBoxUp:
6749  rect = QRect(x + proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height());
6750  break;
6751  case SC_SpinBoxDown:
6752  rect = QRect(x + bs.width(), 0, bs.width(), bs.height());
6753  break;
6754  case SC_SpinBoxEditField:
6755  if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons) {
6756  rect = QRect(lx, fw, spinBox->rect.width() - 2*fw - 2, spinBox->rect.height() - 2*fw);
6757  } else {
6758  rect = QRect(lx, fw, rx-2, spinBox->rect.height() - 2*fw);
6759  }
6760  break;
6761  case SC_SpinBoxFrame:
6762  rect = spinBox->rect;
6763  default:
6764  break;
6765  }
6766  rect = visualRect(spinBox->direction, spinBox->rect, rect);
6767  }
6768  break;
6769 #endif // Qt_NO_SPINBOX
6770 #ifndef QT_NO_GROUPBOX
6771  case CC_GroupBox: {
6772  if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
6773  switch (subControl) {
6774  case SC_GroupBoxFrame:
6775  // FALL THROUGH
6776  case SC_GroupBoxContents: {
6777  int topMargin = 0;
6778  int topHeight = 0;
6779  int bottomMargin = 0;
6780  int labelMargin = 2;
6781 
6782  QRect frameRect = groupBox->rect;
6783  int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
6784  if (groupBox->text.size()) {
6785  topHeight = groupBox->fontMetrics.height();
6786  if (verticalAlignment & Qt::AlignVCenter)
6787  topMargin = topHeight+5;
6788  else if (verticalAlignment & Qt::AlignTop)
6789  topMargin = -topHeight+5;
6790  }
6791  if (subControl == SC_GroupBoxFrame) {
6792  frameRect.setTop(topMargin);
6793  frameRect.setBottom(frameRect.height() + bottomMargin);
6794  rect = frameRect;
6795  break;
6796  }
6797  int frameWidth = 0;
6798  if (groupBox->text.size()) {
6799  frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
6800  rect = frameRect.adjusted(frameWidth, frameWidth + topHeight + labelMargin, -frameWidth, -frameWidth);
6801  }
6802  else {
6803  rect = groupBox->rect;
6804  }
6805  break;
6806  }
6807  case SC_GroupBoxCheckBox:
6808  // FALL THROUGH
6809  case SC_GroupBoxLabel: {
6810  QFontMetrics fontMetrics = groupBox->fontMetrics;
6811  int h = fontMetrics.height();
6812  int textWidth = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width();
6813  int margX = (groupBox->features & QStyleOptionFrameV2::Flat) ? 0 : 2;
6814  int margY = (groupBox->features & QStyleOptionFrameV2::Flat) ? 0 : 2;
6815  rect = groupBox->rect.adjusted(margX, margY, -margX, 0);
6816  if (groupBox->text.size())
6817  rect.setHeight(h);
6818  else
6819  rect.setHeight(0);
6820  int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
6821  int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1;
6822  bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
6823  int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
6824 
6825  // Adjusted rect for label + indicatorWidth + indicatorSpace
6826  QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment,
6827  QSize(textWidth + checkBoxSize, h), rect);
6828 
6829  // Adjust totalRect if checkbox is set
6830  if (hasCheckBox) {
6831  bool ltr = groupBox->direction == Qt::LeftToRight;
6832  int left = 2;
6833  // Adjust for check box
6834  if (subControl == SC_GroupBoxCheckBox) {
6835  int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
6836  left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
6837  int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2;
6838  totalRect.setRect(left, top, indicatorWidth, indicatorHeight);
6839  // Adjust for label
6840  } else {
6841  left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left();
6842  totalRect.setRect(left, totalRect.top(),
6843  totalRect.width() - checkBoxSize, totalRect.height());
6844  }
6845  }
6846  if ((subControl== SC_GroupBoxLabel))
6847  totalRect.adjust(-2,0,6,0);
6848  rect = totalRect;
6849  break;
6850  }
6851  default:
6852  break;
6853  }
6854  }
6855  break;
6856  }
6857 #endif // QT_NO_GROUPBOX
6858  default:
6859  break;
6860  }
6861  return rect;
6862 }
double d
Definition: qnumeric_p.h:62
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
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:431
void setHeight(int h)
Sets the height of the rectangle to the given height.
Definition: qrect.h:445
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
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
static QSize globalStrut()
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
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 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
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
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
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
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
unsigned int uint
Definition: qglobal.h:996
__int64 qint64
Definition: qglobal.h:942
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
const QStyle * proxy() const
Definition: qstyle.cpp:2546
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.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
#define INT_MAX
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=0) const
Reimplemented Function

◆ subElementRect()

QRect QWindowsMobileStyle::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 6477 of file qwindowsmobilestyle.cpp.

6477  {
6478 
6479  QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
6480  QRect rect = QWindowsStyle::subElementRect(element, option, widget);
6481  switch (element) {
6482 #ifndef QT_NO_TABWIDGET
6483  case SE_TabWidgetTabBar:
6484  if (d->doubleControls)
6485  rect.adjust(-2, 0, 2, 0);
6486  else
6487  rect.adjust(-2, 0, 2, 0);
6488  break;
6489 #endif //QT_NO_TABWIDGET
6490  case SE_CheckBoxFocusRect:
6491  rect.adjust(1,0,-2,-1);
6492  break;
6494  rect.adjust(1,1,-2,-2);
6495  break;
6496  default:
6497  break;
6498 #ifndef QT_NO_SLIDER
6499  case SE_SliderFocusRect:
6500  if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
6501  rect = slider->rect;
6502  }
6503  break;
6505  if (d->doubleControls)
6506  rect.adjust(-1, -1, 0, 0);
6507  break;
6508 #endif // QT_NO_SLIDER
6509 #ifndef QT_NO_ITEMVIEWS
6511 #ifdef Q_WS_WINCE_WM
6512  if (d->wm65)
6513  rect = QRect();
6514 #endif
6515  break;
6516 #endif //QT_NO_ITEMVIEWS
6517  }
6518  return rect;
6519 }
double d
Definition: qnumeric_p.h:62
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 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
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function

◆ unpolish() [1/2]

void QWindowsMobileStyle::unpolish ( QApplication application)
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 6909 of file qwindowsmobilestyle.cpp.

6910 {
6912 }
void unpolish(QApplication *)
Reimplemented Function

◆ unpolish() [2/2]

void QWindowsMobileStyle::unpolish ( QWidget widget)
virtual

Reimplemented Function

Reimplemented from QCommonStyle.

Definition at line 6904 of file qwindowsmobilestyle.cpp.

6905 {
6906  QWindowsStyle::unpolish(widget);
6907 }
void unpolish(QApplication *)
Reimplemented Function

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