com.trolltech.qt.gui
Class QCleanlooksStyle

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QStyle
                  extended by com.trolltech.qt.gui.QCommonStyle
                      extended by com.trolltech.qt.gui.QWindowsStyle
                          extended by com.trolltech.qt.gui.QCleanlooksStyle
All Implemented Interfaces:
QtJambiInterface

public class QCleanlooksStyle
extends QWindowsStyle

The QCleanlooksStyle class provides a widget style similar to the Clearlooks style available in GNOME.

The Cleanlooks style provides a look and feel for widgets that closely resembles the Clearlooks style, introduced by Richard Stellingwerff and Daniel Borgmann.

See Also:
Cleanlooks Style Widget Gallery, QWindowsXPStyle, QMacStyle, QWindowsStyle, QCDEStyle, QMotifStyle, QPlastiqueStyle

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QStyle
QStyle.ComplexControl, QStyle.ContentsType, QStyle.ControlElement, QStyle.PixelMetric, QStyle.PrimitiveElement, QStyle.StandardPixmap, QStyle.State, QStyle.StateFlag, QStyle.StyleHint, QStyle.SubControl, QStyle.SubElement
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QCleanlooksStyle()
          Constructs a QCleanlooksStyle object.
 
Method Summary
 void drawComplexControl(QStyle.ComplexControl control, QStyleOptionComplex option, QPainter painter, QWidget widget)
          Draws the given control using the provided painter with the style options specified by option.
 void drawControl(QStyle.ControlElement ce, QStyleOption option, QPainter painter, QWidget widget)
          Draws the given ce with the provided painter with the style options specified by option.
 void drawItemPixmap(QPainter painter, QRect rect, int alignment, QPixmap pixmap)
          This function is reimplemented for internal reasons.
 void drawItemText(QPainter painter, QRect rect, int flags, QPalette pal, boolean enabled, java.lang.String text, QPalette.ColorRole textRole)
          Draws the given text in the specified rect using the provided painter and pal.
 void drawPrimitive(QStyle.PrimitiveElement elem, QStyleOption option, QPainter painter, QWidget widget)
          Draws the given primitive elem with the provided painter using the style options specified by option.
static QCleanlooksStyle fromNativePointer(QNativePointer nativePointer)
          This function returns the QCleanlooksStyle instance pointed to by nativePointer
 QPixmap generatedIconPixmap(QIcon.Mode iconMode, QPixmap pixmap, QStyleOption opt)
          This function is reimplemented for internal reasons.
 int hitTestComplexControl(QStyle.ComplexControl cc, QStyleOptionComplex opt, QPoint pt, QWidget w)
          Returns the sub control at the given pt in the given complex cc (with the style options specified by opt).
 QRect itemPixmapRect(QRect r, int flags, QPixmap pixmap)
          This function is reimplemented for internal reasons.
 int pixelMetric(QStyle.PixelMetric metric, QStyleOption option, QWidget widget)
          Returns the value of the given pixel metric.
 void polish(QApplication app)
          This function is reimplemented for internal reasons.
 void polish(QPalette pal)
          This function is reimplemented for internal reasons.
 void polish(QWidget widget)
          This function is reimplemented for internal reasons.
 QSize sizeFromContents(QStyle.ContentsType type, QStyleOption option, QSize size, QWidget widget)
          Returns the size of the element described by the specified option and type, based on the provided size.
protected  QIcon standardIconImplementation(QStyle.StandardPixmap standardIcon, QStyleOption option, QWidget widget)
          This method is used internally by Qt Jambi.
 QPalette standardPalette()
          This function is reimplemented for internal reasons.
 int styleHint(QStyle.StyleHint hint, QStyleOption option, QWidget widget, QStyleHintReturn returnData)
          Returns an integer representing the specified style hint for the given widget described by the provided style option.
 QRect subControlRect(QStyle.ComplexControl cc, QStyleOptionComplex opt, int sc, QWidget widget)
          Returns the rectangle containing the specified sc of the given complex cc (with the style specified by opt).
 QRect subElementRect(QStyle.SubElement r, QStyleOption opt, QWidget widget)
          Returns the sub-area for the given r as described in the provided style opt.
 void unpolish(QApplication app)
          This function is reimplemented for internal reasons.
 void unpolish(QWidget widget)
          This function is reimplemented for internal reasons.
 
Methods inherited from class com.trolltech.qt.gui.QWindowsStyle
eventFilter, timerEvent
 
Methods inherited from class com.trolltech.qt.gui.QStyle
alignedRect, combinedLayoutSpacing, combinedLayoutSpacing, combinedLayoutSpacing, drawComplexControl, drawControl, drawItemText, drawPrimitive, hitTestComplexControl, itemTextRect, layoutSpacing, layoutSpacing, layoutSpacing, layoutSpacingImplementation, layoutSpacingImplementation, layoutSpacingImplementation, pixelMetric, pixelMetric, sizeFromContents, sliderPositionFromValue, sliderPositionFromValue, sliderValueFromPosition, sliderValueFromPosition, standardIcon, standardIcon, standardIcon, standardIconImplementation, standardIconImplementation, styleHint, styleHint, styleHint, subControlRect, subElementRect, visualAlignment, visualAlignment, visualPos, visualRect
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QCleanlooksStyle

public QCleanlooksStyle()

Constructs a QCleanlooksStyle object.

Method Detail

standardIconImplementation

protected QIcon standardIconImplementation(QStyle.StandardPixmap standardIcon,
                                           QStyleOption option,
                                           QWidget widget)

This method is used internally by Qt Jambi. Do not use it in your applications.

Overrides:
standardIconImplementation in class QWindowsStyle
See Also:
standardIcon

drawComplexControl

public void drawComplexControl(QStyle.ComplexControl control,
                               QStyleOptionComplex option,
                               QPainter painter,
                               QWidget widget)

Draws the given control using the provided painter with the style options specified by option.

The widget argument is optional and can be used as aid in drawing the control.

The option parameter is a pointer to a QStyleOptionComplex object that can be cast to the correct subclass using the qstyleoption_cast() function. Note that the rect member of the specified option must be in logical coordinates. Reimplementations of this function should use visualRect to change the logical coordinates into screen coordinates before calling the drawPrimitive or drawControl function.

The table below is listing the complex control elements and their associated style option subclass. The style options contain all the parameters required to draw the controls, including QStyleOption::state which holds the style flags that are used when drawing. The table also describes which flags that are set when casting the given option to the appropriate subclass.

Complex ControlQStyleOptionComplex SubclassStyle FlagRemark
CC_SpinBoxQStyleOptionSpinBoxState_EnabledSet if the spin box is enabled.
State_HasFocusSet if the spin box has input focus.
CC_ComboBoxQStyleOptionComboBoxState_EnabledSet if the combobox is enabled.
State_HasFocusSet if the combobox has input focus.
CC_ScrollBarQStyleOptionSliderState_EnabledSet if the scroll bar is enabled.
State_HasFocusSet if the scroll bar has input focus.
CC_SliderQStyleOptionSliderState_EnabledSet if the slider is enabled.
State_HasFocusSet if the slider has input focus.
CC_DialQStyleOptionSliderState_EnabledSet if the dial is enabled.
State_HasFocusSet if the dial has input focus.
CC_ToolButtonQStyleOptionToolButtonState_EnabledSet if the tool button is enabled.
State_HasFocusSet if the tool button has input focus.
State_DownArrowSet if the tool button is down (i.e., a mouse button or the space bar is pressed).
State_OnSet if the tool button is a toggle button and is toggled on.
State_AutoRaiseSet if the tool button has auto-raise enabled.
State_RaisedSet if the button is not down, not on, and doesn't contain the mouse when auto-raise is enabled.
CC_TitleBarQStyleOptionTitleBarState_EnabledSet if the title bar is enabled.
CC_Q3ListViewQStyleOptionQ3ListViewState_EnabledSet if the list view is enabled.

Overrides:
drawComplexControl in class QWindowsStyle
See Also:
drawPrimitive, drawControl

drawControl

public void drawControl(QStyle.ControlElement ce,
                        QStyleOption option,
                        QPainter painter,
                        QWidget widget)

Draws the given ce with the provided painter with the style options specified by option.

The widget argument is optional and can be used as aid in drawing the control. The option parameter is a pointer to a QStyleOption object that can be cast to the correct subclass using the qstyleoption_cast() function.

The table below is listing the control elements and their associated style option subclass. The style options contain all the parameters required to draw the controls, including QStyleOption::state which holds the style flags that are used when drawing. The table also describes which flags that are set when casting the given option to the appropriate subclass.

Note that if a control element is not listed here, it is because it uses a plain QStyleOption object.

Control ElementQStyleOption SubclassStyle FlagRemark
CE_MenuItem, CE_MenuBarItemQStyleOptionMenuItemState_SelectedThe menu item is currently selected item.
State_EnabledThe item is enabled.
State_DownArrowIndicates that a scroll down arrow should be drawn.
State_UpArrowIndicates that a scroll up arrow should be drawn
State_HasFocusSet if the menu bar has input focus.
CE_PushButton, CE_PushButtonBevel, CE_PushButtonLabelQStyleOptionButtonState_EnabledSet if the button is enabled.
State_HasFocusSet if the button has input focus.
State_RaisedSet if the button is not down, not on and not flat.
State_OnSet if the button is a toggle button and is toggled on.
State_SunkenSet if the button is down (i.e., the mouse button or the space bar is pressed on the button).
CE_RadioButton, CE_RadioButtonLabel, CE_CheckBox, CE_CheckBoxLabelQStyleOptionButtonState_EnabledSet if the button is enabled.
State_HasFocusSet if the button has input focus.
State_OnSet if the button is checked.
State_OffSet if the button is not checked.
State_NoChangeSet if the button is in the NoChange state.
State_SunkenSet if the button is down (i.e., the mouse button or the space bar is pressed on the button).
CE_ProgressBarContents, CE_ProgressBarLabel, CE_ProgressBarGrooveQStyleOptionProgressBarState_EnabledSet if the progress bar is enabled.
State_HasFocusSet if the progress bar has input focus.
CE_Header, CE_HeaderSection, CE_HeaderLabelQStyleOptionHeader
CE_ToolButtonLabelQStyleOptionToolButtonState_EnabledSet if the tool button is enabled.
State_HasFocusSet if the tool button has input focus.
State_SunkenSet if the tool button is down (i.e., a mouse button or the space bar is pressed).
State_OnSet if the tool button is a toggle button and is toggled on.
State_AutoRaiseSet if the tool button has auto-raise enabled.
State_MouseOverSet if the mouse pointer is over the tool button.
State_RaisedSet if the button is not down and is not on.
CE_ToolBoxTabQStyleOptionToolBoxState_SelectedThe tab is the currently selected tab.
CE_HeaderSectionQStyleOptionHeaderState_SunkenIndicates that the section is pressed.
State_UpArrowIndicates that the sort indicator should be pointing up.
State_DownArrowIndicates that the sort indicator should be pointing down.

Overrides:
drawControl in class QWindowsStyle
See Also:
drawPrimitive, drawComplexControl

drawItemPixmap

public void drawItemPixmap(QPainter painter,
                           QRect rect,
                           int alignment,
                           QPixmap pixmap)

This function is reimplemented for internal reasons.

Overrides:
drawItemPixmap in class QStyle
See Also:
drawItemText

drawItemText

public void drawItemText(QPainter painter,
                         QRect rect,
                         int flags,
                         QPalette pal,
                         boolean enabled,
                         java.lang.String text,
                         QPalette.ColorRole textRole)

Draws the given text in the specified rect using the provided painter and pal.

Text is drawn using the painter's pen. If an explicit textRole is specified, then the text is drawn using the pal's color for the specified role. The enabled value indicates whether or not the item is enabled; when reimplementing, this value should influence how the item is drawn.

The text is aligned and wrapped according to the specified flags.

Overrides:
drawItemText in class QStyle
See Also:
Qt::Alignment

drawPrimitive

public void drawPrimitive(QStyle.PrimitiveElement elem,
                          QStyleOption option,
                          QPainter painter,
                          QWidget widget)

Draws the given primitive elem with the provided painter using the style options specified by option.

The widget argument is optional and may contain a widget that may aid in drawing the primitive element.

The table below is listing the primitive elements and their associated style option subclasses. The style options contain all the parameters required to draw the elements, including QStyleOption::state which holds the style flags that are used when drawing. The table also describes which flags that are set when casting the given option to the appropriate subclass.

Note that if a primitive element is not listed here, it is because it uses a plain QStyleOption object.

Primitive ElementQStyleOption SubclassStyle FlagRemark
PE_FrameFocusRectQStyleOptionFocusRectState_FocusAtBorderWhether the focus is is at the border or inside the widget.
PE_IndicatorCheckBoxQStyleOptionButtonState_NoChangeIndicates a "tri-state" checkbox.
State_OnIndicates the indicator is checked.
PE_IndicatorRadioButtonQStyleOptionButtonState_OnIndicates that a radio button is selected.
PE_Q3CheckListExclusiveIndicator, PE_Q3CheckListIndicatorQStyleOptionQ3ListViewState_OnIndicates whether or not the controller is selected.
State_NoChangeIndicates a "tri-state" controller.
State_EnabledIndicates the controller is enabled.
PE_IndicatorBranchQStyleOptionState_ChildrenIndicates that the control for expanding the tree to show child items, should be drawn.
State_ItemIndicates that a horizontal branch (to show a child item), should be drawn.
State_OpenIndicates that the tree branch is expanded.
State_SiblingIndicates that a vertical line (to show a sibling item), should be drawn.
PE_IndicatorHeaderArrowQStyleOptionHeaderState_UpArrowIndicates that the arrow should be drawn up; otherwise it should be down.
PE_FrameGroupBox, PE_Frame, PE_FrameLineEdit, PE_FrameMenu, PE_FrameDockWidgetQStyleOptionFrameState_SunkenIndicates that the Frame should be sunken.
PE_IndicatorToolBarHandleQStyleOptionState_HorizontalIndicates that the window handle is horizontal instead of vertical.
PE_Q3DockWindowSeparatorQStyleOptionState_HorizontalIndicates that the separator is horizontal instead of vertical.
PE_IndicatorSpinPlus, PE_IndicatorSpinMinus, PE_IndicatorSpinUp, PE_IndicatorSpinDown,QStyleOptionSpinBoxState_SunkenIndicates that the button is pressed.

Overrides:
drawPrimitive in class QWindowsStyle
See Also:
drawComplexControl, drawControl

generatedIconPixmap

public QPixmap generatedIconPixmap(QIcon.Mode iconMode,
                                   QPixmap pixmap,
                                   QStyleOption opt)

This function is reimplemented for internal reasons.

Overrides:
generatedIconPixmap in class QCommonStyle
See Also:
QIcon

hitTestComplexControl

public int hitTestComplexControl(QStyle.ComplexControl cc,
                                 QStyleOptionComplex opt,
                                 QPoint pt,
                                 QWidget w)

Returns the sub control at the given pt in the given complex cc (with the style options specified by opt).

Note that the pt is expressed in screen coordinates.

The opt argument is a pointer to a QStyleOptionComplex object (or one of its subclasses). The object can be cast to the appropriate type using the qstyleoption_cast() function. See drawComplexControl for details. The w argument is optional and can contain additional information for the function.

Overrides:
hitTestComplexControl in class QCommonStyle
See Also:
drawComplexControl, subControlRect

itemPixmapRect

public QRect itemPixmapRect(QRect r,
                            int flags,
                            QPixmap pixmap)

This function is reimplemented for internal reasons.

Overrides:
itemPixmapRect in class QStyle

pixelMetric

public int pixelMetric(QStyle.PixelMetric metric,
                       QStyleOption option,
                       QWidget widget)

Returns the value of the given pixel metric.

The specified option and widget can be used for calculating the metric. In general, the widget argument is not used. The option can be cast to the appropriate type using the qstyleoption_cast() function. Note that the option may be zero even for PixelMetrics that can make use of it. See the table below for the appropriate option casts:

Pixel MetricQStyleOption Subclass
PM_SliderControlThicknessQStyleOptionSlider
PM_SliderLengthQStyleOptionSlider
PM_SliderTickmarkOffsetQStyleOptionSlider
PM_SliderSpaceAvailableQStyleOptionSlider
PM_ScrollBarExtentQStyleOptionSlider
PM_TabBarTabOverlapQStyleOptionTab
PM_TabBarTabHSpaceQStyleOptionTab
PM_TabBarTabVSpaceQStyleOptionTab
PM_TabBarBaseHeightQStyleOptionTab
PM_TabBarBaseOverlapQStyleOptionTab

Some pixel metrics are called from widgets and some are only called internally by the style. If the metric is not called by a widget, it is the discretion of the style author to make use of it. For some styles, this may not be appropriate.

Overrides:
pixelMetric in class QWindowsStyle

polish

public void polish(QApplication app)

This function is reimplemented for internal reasons.

Overrides:
polish in class QWindowsStyle

polish

public void polish(QWidget widget)

This function is reimplemented for internal reasons.

Overrides:
polish in class QWindowsStyle
See Also:
unpolish

polish

public void polish(QPalette pal)

This function is reimplemented for internal reasons.

Overrides:
polish in class QWindowsStyle
See Also:
QPalette, QApplication::setPalette

sizeFromContents

public QSize sizeFromContents(QStyle.ContentsType type,
                              QStyleOption option,
                              QSize size,
                              QWidget widget)

Returns the size of the element described by the specified option and type, based on the provided size.

The option argument is a pointer to a QStyleOption or one of its subclasses. The option can be cast to the appropriate type using the qstyleoption_cast() function. The widget is an optional argument and can contain extra information used for calculating the size.

See the table below for the appropriate option casts:

Contents TypeQStyleOption Subclass
CT_PushButtonQStyleOptionButton
CT_CheckBoxQStyleOptionButton
CT_RadioButtonQStyleOptionButton
CT_ToolButtonQStyleOptionToolButton
CT_ComboBoxQStyleOptionComboBox
CT_SplitterQStyleOption
CT_Q3DockWindowQStyleOptionQ3DockWindow
CT_ProgressBarQStyleOptionProgressBar
CT_MenuItemQStyleOptionMenuItem

Overrides:
sizeFromContents in class QWindowsStyle
See Also:
ContentsType, QStyleOption

standardPalette

public QPalette standardPalette()

This function is reimplemented for internal reasons.

Overrides:
standardPalette in class QStyle

styleHint

public int styleHint(QStyle.StyleHint hint,
                     QStyleOption option,
                     QWidget widget,
                     QStyleHintReturn returnData)

Returns an integer representing the specified style hint for the given widget described by the provided style option.

Note that currently, the returnData and widget parameters are not used; they are provided for future enhancement. In addition, the option parameter is used only in case of the SH_ComboBox_Popup, SH_ComboBox_LayoutDirection, and SH_GroupBox_TextLabelColor style hints.

Overrides:
styleHint in class QWindowsStyle

subControlRect

public QRect subControlRect(QStyle.ComplexControl cc,
                            QStyleOptionComplex opt,
                            int sc,
                            QWidget widget)

Returns the rectangle containing the specified sc of the given complex cc (with the style specified by opt). The rectangle is defined in screen coordinates.

The opt argument is a pointer to QStyleOptionComplex or one of its subclasses, and can be cast to the appropriate type using the qstyleoption_cast() function. See drawComplexControl for details. The widget is optional and can contain additional information for the function.

Overrides:
subControlRect in class QCommonStyle
See Also:
drawComplexControl

subElementRect

public QRect subElementRect(QStyle.SubElement r,
                            QStyleOption opt,
                            QWidget widget)

Returns the sub-area for the given r as described in the provided style opt. The returned rectangle is defined in screen coordinates.

The widget argument is optional and can be used to aid determining the area. The QStyleOption object can be cast to the appropriate type using the qstyleoption_cast() function. See the table below for the appropriate opt casts:

Sub ElementQStyleOption Subclass
SE_PushButtonContentsQStyleOptionButton
SE_PushButtonFocusRectQStyleOptionButton
SE_CheckBoxIndicatorQStyleOptionButton
SE_CheckBoxContentsQStyleOptionButton
SE_CheckBoxFocusRectQStyleOptionButton
SE_RadioButtonIndicatorQStyleOptionButton
SE_RadioButtonContentsQStyleOptionButton
SE_RadioButtonFocusRectQStyleOptionButton
SE_ComboBoxFocusRectQStyleOptionComboBox
SE_Q3DockWindowHandleRectQStyleOptionQ3DockWindow
SE_ProgressBarGrooveQStyleOptionProgressBar
SE_ProgressBarContentsQStyleOptionProgressBar
SE_ProgressBarLabelQStyleOptionProgressBar

Overrides:
subElementRect in class QWindowsStyle

unpolish

public void unpolish(QWidget widget)

This function is reimplemented for internal reasons.

Overrides:
unpolish in class QWindowsStyle
See Also:
polish

unpolish

public void unpolish(QApplication app)

This function is reimplemented for internal reasons.

Overrides:
unpolish in class QWindowsStyle

fromNativePointer

public static QCleanlooksStyle fromNativePointer(QNativePointer nativePointer)
This function returns the QCleanlooksStyle instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.