Eneboo - Documentación para desarrolladores
Tipos públicos | Métodos públicos | Métodos públicos estáticos | Métodos protegidos
Referencia de la Clase QtCKStyle

#include <qtc_kstyle.h>

Diagrama de herencias de QtCKStyle
QCommonStyle QStyle QStyle QObject QObject QObject QObject Qt Qt Qt Qt Qt Qt Qt Qt

Lista de todos los miembros.

Tipos públicos

enum  KStyleOption { Default = 0x00000000, AllowMenuTransparency = 0x00000001, FilledFrameWorkaround = 0x00000002 }
enum  KStyleScrollBarType { WindowsStyleScrollBar = 0x00000000, PlatinumStyleScrollBar = 0x00000001, ThreeButtonScrollBar = 0x00000002, NextStyleScrollBar = 0x00000004 }
enum  KStylePrimitive {
  KPE_DockWindowHandle, KPE_ToolBarHandle, KPE_GeneralHandle, KPE_SliderGroove,
  KPE_SliderHandle, KPE_ListViewExpander, KPE_ListViewBranch
}
enum  KStylePixelMetric {
  KPM_MenuItemSeparatorHeight = 0x00000001, KPM_MenuItemHMargin = 0x00000002, KPM_MenuItemVMargin = 0x00000004, KPM_MenuItemHFrame = 0x00000008,
  KPM_MenuItemVFrame = 0x00000010, KPM_MenuItemCheckMarkHMargin = 0x00000020, KPM_MenuItemArrowHMargin = 0x00000040, KPM_MenuItemTabSpacing = 0x00000080,
  KPM_ListViewBranchThickness = 0x00000100
}
typedef uint KStyleFlags

Métodos públicos

 QtCKStyle (KStyleFlags flags=QtCKStyle::Default, KStyleScrollBarType sbtype=QtCKStyle::WindowsStyleScrollBar)
 ~QtCKStyle ()
void setScrollBarType (KStyleScrollBarType sbtype)
KStyleFlags styleFlags () const
virtual void drawKStylePrimitive (KStylePrimitive kpe, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption &=QStyleOption::Default) const
int kPixelMetric (KStylePixelMetric kpm, const QWidget *widget=0) const
void polish (QWidget *widget)
void unPolish (QWidget *widget)
void polishPopupMenu (QPopupMenu *)
void drawPrimitive (PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption &=QStyleOption::Default) const
void drawControl (ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, const QStyleOption &=QStyleOption::Default) const
void drawComplexControl (ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags flags=Style_Default, SCFlags controls=SC_All, SCFlags active=SC_None, const QStyleOption &=QStyleOption::Default) const
SubControl querySubControl (ComplexControl control, const QWidget *widget, const QPoint &pos, const QStyleOption &=QStyleOption::Default) const
QRect querySubControlMetrics (ComplexControl control, const QWidget *widget, SubControl sc, const QStyleOption &=QStyleOption::Default) const
int pixelMetric (PixelMetric m, const QWidget *widget=0) const
QRect subRect (SubRect r, const QWidget *widget) const
QPixmap stylePixmap (StylePixmap stylepixmap, const QWidget *widget=0, const QStyleOption &=QStyleOption::Default) const
int styleHint (StyleHint sh, const QWidget *w=0, const QStyleOption &opt=QStyleOption::Default, QStyleHintReturn *shr=0) const

Métodos públicos estáticos

static QString defaultStyle ()

Métodos protegidos

bool eventFilter (QObject *object, QEvent *event)
virtual void virtual_hook (int id, void *data)

Descripción detallada

Simplifies and extends the QStyle API to make style coding easier.

The KStyle class provides a simple internal menu transparency engine which attempts to use XRender for accelerated blending where requested, or falls back to fast internal software tinting/blending routines. It also simplifies more complex portions of the QStyle API, such as the PopupMenuItems, ScrollBars and Sliders by providing extra "primitive elements" which are simple to implement by the style writer.

Ver también:
QStyle::QStyle
QCommonStyle::QCommonStyle
Autor:
Karol Szwed (gallium@kde.org)
Versión:
$Id$

Documentación de los 'Typedef' miembros de la clase

QtCKStyle Flags:

  • Default - Default style setting, where menu transparency and the FilledFrameWorkaround are disabled.
  • AllowMenuTransparency - Enable this flag to use QtCKStyle's internal menu transparency engine.
  • FilledFrameWorkaround - Enable this flag to facilitate proper repaints of QMenuBars and QToolBars when the style chooses to paint the interior of a QFrame. The style primitives in question are PE_PanelMenuBar and PE_PanelDockWindow. The HighColor style uses this workaround to enable painting of gradients in menubars and toolbars.

Documentación de las enumeraciones miembro de la clase

Valores de enumeraciones:
Default 

All options disabled.

AllowMenuTransparency 

Internal transparency enabled.

FilledFrameWorkaround 

Filled frames enabled.

Valores de enumeraciones:
KPM_MenuItemSeparatorHeight 
KPM_MenuItemHMargin 
KPM_MenuItemVMargin 
KPM_MenuItemHFrame 
KPM_MenuItemVFrame 
KPM_MenuItemCheckMarkHMargin 
KPM_MenuItemArrowHMargin 
KPM_MenuItemTabSpacing 
KPM_ListViewBranchThickness 

KStyle Primitive Elements:

The KStyle class extends the Qt's Style API by providing certain simplifications for parts of QStyle. To do this, the KStylePrimitive elements were defined, which are very similar to Qt's PrimitiveElement.

The first three Handle primitives simplify and extend PE_DockWindowHandle, so do not reimplement PE_DockWindowHandle if you want the KStyle handle simplifications to be operable. Similarly do not reimplement CC_Slider, SC_SliderGroove and SC_SliderHandle when using the KStyle slider primitives. KStyle automatically double-buffers slider painting when they are drawn via these KStyle primitives to avoid flicker.

  • KPE_DockWindowHandle - This primitive is already implemented in KStyle, and paints a bevelled rect with the DockWindow caption text. Re-implement this primitive to perform other more fancy effects when drawing the dock window handle.
  • KPE_ToolBarHandle - This primitive must be reimplemented. It currently only paints a filled rectangle as default behavior. This primitive is used to render QToolBar handles.
  • KPE_GeneralHandle - This primitive must be reimplemented. It is used to render general handles that are not part of a QToolBar or QDockWindow, such as the applet handles used in Kicker. The default implementation paints a filled rect of arbitrary color.
  • KPE_SliderGroove - This primitive must be reimplemented. It is used to paint the slider groove. The default implementation paints a filled rect of arbitrary color.
  • KPE_SliderHandle - This primitive must be reimplemented. It is used to paint the slider handle. The default implementation paints a filled rect of arbitrary color.
  • KPE_ListViewExpander - This primitive is already implemented in KStyle. It is used to draw the Expand/Collapse element in QListViews. To indicate the expanded state, the style flags are set to Style_Off, while Style_On implies collapsed.
  • KPE_ListViewBranch - This primitive is already implemented in KStyle. It is used to draw the ListView branches where necessary.
Valores de enumeraciones:
KPE_DockWindowHandle 
KPE_ToolBarHandle 
KPE_GeneralHandle 
KPE_SliderGroove 
KPE_SliderHandle 
KPE_ListViewExpander 
KPE_ListViewBranch 

KStyle ScrollBarType:

Allows the style writer to easily select what type of scrollbar should be used without having to duplicate large amounts of source code by implementing the complex control CC_ScrollBar.

  • WindowsStyleScrollBar - Two button scrollbar with the previous button at the top/left, and the next button at the bottom/right.
  • PlatinumStyleScrollBar - Two button scrollbar with both the previous and next buttons at the bottom/right.
  • ThreeButtonScrollBar - KDE style three button scrollbar with two previous buttons, and one next button. The next button is always at the bottom/right, whilst the two previous buttons are on either end of the scrollbar.
  • NextStyleScrollBar - Similar to the PlatinumStyle scroll bar, but with the buttons grouped on the opposite end of the scrollbar.
Ver también:
KStyle::KStyle()
Valores de enumeraciones:
WindowsStyleScrollBar 

two button, windows style

PlatinumStyleScrollBar 

two button, platinum style

ThreeButtonScrollBar 

three buttons, KDE style

NextStyleScrollBar 

two button, NeXT style


Documentación del constructor y destructor

QtCKStyle::QtCKStyle ( KStyleFlags  flags = QtCKStyle::Default,
KStyleScrollBarType  sbtype = QtCKStyle::WindowsStyleScrollBar 
)

Constructs a KStyle object.

Select the appropriate KStyle flags and scrollbar type for your style. The user's style preferences selected in KControl are read by using QSettings and are automatically applied to the style. As a fallback, KStyle paints progressbars and tabbars. It inherits from QCommonStyle for speed, so don't expect much to be implemented.

It is advisable to use a currently implemented style such as the HighColor style as a foundation for any new KStyle, so the limited number of drawing fallbacks should not prove problematic.

Parámetros:
flagsthe style to be applied
sbtypethe scroll bar type
Ver también:
KStyle::KStyleFlags
KStyle::KStyleScrollBarType
Autor:
Karol Szwed (gallium@kde.org)
QtCKStyle::~QtCKStyle ( )

Destructs the QtCKStyle object.


Documentación de las funciones miembro

QString QtCKStyle::defaultStyle ( ) [static]

Returns the default widget style depending on color depth.

void QtCKStyle::drawComplexControl ( ComplexControl  control,
QPainter p,
const QWidget widget,
const QRect r,
const QColorGroup cg,
SFlags  flags = Style_Default,
SCFlags  controls = SC_All,
SCFlags  active = SC_None,
const QStyleOption opt = QStyleOption::Default 
) const [virtual]

Reimplementado de QCommonStyle.

void QtCKStyle::drawControl ( ControlElement  element,
QPainter p,
const QWidget widget,
const QRect r,
const QColorGroup cg,
SFlags  flags = Style_Default,
const QStyleOption opt = QStyleOption::Default 
) const [virtual]

Reimplementado de QCommonStyle.

void QtCKStyle::drawKStylePrimitive ( KStylePrimitive  kpe,
QPainter p,
const QWidget widget,
const QRect r,
const QColorGroup cg,
SFlags  flags = Style_Default,
const QStyleOption = QStyleOption::Default 
) const [virtual]

This function is identical to Qt's QStyle::drawPrimitive(), except that it adds one further parameter, 'widget', that can be used to determine the widget state of the KStylePrimitive in question.

Ver también:
KStyle::KStylePrimitive
QStyle::drawPrimitive
QStyle::drawComplexControl
void QtCKStyle::drawPrimitive ( PrimitiveElement  pe,
QPainter p,
const QRect r,
const QColorGroup cg,
SFlags  flags = Style_Default,
const QStyleOption opt = QStyleOption::Default 
) const [virtual]

Reimplementado de QCommonStyle.

bool QtCKStyle::eventFilter ( QObject ,
QEvent  
) [protected, virtual]

Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event e, out, i.e. stop it being handled further, return TRUE; otherwise return FALSE.

Example:

    class MyMainWindow : public QMainWindow
    {
    public:
        MyMainWindow( QWidget *parent = 0, const char *name = 0 );

    protected:
        bool eventFilter( QObject *obj, QEvent *ev );

    private:
        QTextEdit *textEdit;
    };

    MyMainWindow::MyMainWindow( QWidget *parent, const char *name )
        : QMainWindow( parent, name )
    {
        textEdit = new QTextEdit( this );
        setCentralWidget( textEdit );
        textEdit->installEventFilter( this );
    }

    bool MyMainWindow::eventFilter( QObject *obj, QEvent *ev )
    {
        if ( obj == textEdit ) {
            if ( e->type() == QEvent::KeyPress ) {
                QKeyEvent *k = (QKeyEvent*)ev;
                qDebug( "Ate key press %d", k->key() );
                return TRUE;
            } else {
                return FALSE;
            }
        } else {
            // pass the event on to the parent class
            return QMainWindow::eventFilter( obj, ev );
        }
    }

Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.

Atención:
If you delete the receiver object in this function, be sure to return TRUE. Otherwise, Qt will forward the event to the deleted object and the program might crash.
Ver también:
installEventFilter()

Reimplementado de QObject.

int QtCKStyle::kPixelMetric ( KStylePixelMetric  kpm,
const QWidget widget = 0 
) const
int QtCKStyle::pixelMetric ( PixelMetric  m,
const QWidget widget = 0 
) const [virtual]

Reimplementado de QCommonStyle.

void QtCKStyle::polish ( QWidget ) [virtual]

Initializes the appearance of a widget.

This function is called for every widget at some point after it has been fully created but just before it is shown the very first time.

Reasonable actions in this function might be to call QWidget::setBackgroundMode() for the widget. An example of highly unreasonable use would be setting the geometry! Reimplementing this function gives you a back-door through which you can change the appearance of a widget. With Qt 3.0's style engine you will rarely need to write your own polish(); instead reimplement drawItem(), drawPrimitive(), etc.

The QWidget::inherits() function may provide enough information to allow class-specific customizations. But be careful not to hard-code things too much because new QStyle subclasses are expected to work reasonably with all current and future widgets.

Ver también:
unPolish()

Reimplementado de QStyle.

void QtCKStyle::polishPopupMenu ( QPopupMenu ) [virtual]

Polishes the popup menu according to the GUI style. This usually means setting the mouse tracking ({QPopupMenu::setMouseTracking()}) and whether the menu is checkable by default ({QPopupMenu::setCheckable()}).

Implementa QStyle.

QStyle::SubControl QtCKStyle::querySubControl ( ComplexControl  control,
const QWidget widget,
const QPoint pos,
const QStyleOption opt = QStyleOption::Default 
) const [virtual]

Reimplementado de QCommonStyle.

QRect QtCKStyle::querySubControlMetrics ( ComplexControl  control,
const QWidget widget,
SubControl  sc,
const QStyleOption opt = QStyleOption::Default 
) const [virtual]

Reimplementado de QCommonStyle.

void QtCKStyle::setScrollBarType ( KStyleScrollBarType  sbtype)

Modifies the scrollbar type used by the style.

This function is only provided for convenience. It allows you to make a late decision about what scrollbar type to use for the style after performing some processing in your style's constructor. In most situations however, setting the scrollbar type via the QtCKStyle constructor should suffice.

Parámetros:
sbtypethe scroll bar type
Ver también:
QtCKStyle::KStyleScrollBarType
QtCKStyle::KStyleFlags QtCKStyle::styleFlags ( ) const

Returns the KStyle flags used to initialize the style.

This is used solely for the kcmstyle module, and hence is internal.

int QtCKStyle::styleHint ( StyleHint  sh,
const QWidget w = 0,
const QStyleOption = QStyleOption::Default,
QStyleHintReturn *  = 0 
) const [virtual]

Reimplementado de QCommonStyle.

QPixmap QtCKStyle::stylePixmap ( StylePixmap  sp,
const QWidget widget = 0,
const QStyleOption = QStyleOption::Default 
) const [virtual]

Reimplementado de QCommonStyle.

QRect QtCKStyle::subRect ( SubRect  r,
const QWidget widget 
) const [virtual]

Reimplementado de QCommonStyle.

void QtCKStyle::unPolish ( QWidget ) [virtual]

Undoes the initialization of a widget's appearance.

This function is the counterpart to polish. It is called for every polished widget when the style is dynamically changed. The former style has to unpolish its settings before the new style can polish them again.

Ver también:
polish()

Reimplementado de QStyle.

void QtCKStyle::virtual_hook ( int  id,
void *  data 
) [protected, virtual]

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'