Qt 4.8
|
The QDecoration class is a base class for window decorations in Qt for Embedded Linux. More...
#include <qdecoration_qws.h>
Public Types | |
enum | DecorationRegion { None = 0x0000000000, All = 0x7fffffff, TopLeft = 0x0000000001, Top = 0x0000000002, TopRight = 0x0000000004, Left = 0x0000000008, Right = 0x0000000010, BottomLeft = 0x0000000020, Bottom = 0x0000000040, BottomRight = 0x0000000080, Borders = 0x00000000ff, Menu = 0x0000000100, Title = 0x0000000200, Help = 0x0000000400, Minimize = 0x0000000800, Maximize = 0x0000001000, Normalize = 0x0000002000, Close = 0x0000004000, Move = 0x0000008000, Resize = 0x0000010000 } |
This enum describes the various regions of the window decoration. More... | |
enum | DecorationState { Normal = 0x04, Disabled = 0x08, Hover = 0x01, Pressed = 0x02 } |
This enum describes the various states of a decoration region. More... | |
Public Functions | |
virtual void | buildSysMenu (QWidget *widget, QMenu *menu) |
Builds the system menu for the given top level widget, adding Restore, Move, Size, Minimize, Maximize and Close actions to the given menu. More... | |
void | menuTriggered (QWidget *widget, QAction *action) |
This function is called whenever an action in a top level widget's menu is triggered, and simply calls the regionClicked() function passing the widget and action parameters as arguments. More... | |
virtual bool | paint (QPainter *p, const QWidget *w, int decorationRegion=All, DecorationState state=Normal)=0 |
Implement this function to paint the border and title decoration for the specified top level widget using the given painter and decoration state. More... | |
QDecoration () | |
Constructs a decoration object. More... | |
virtual QRegion | region (const QWidget *w, const QRect &rect, int decorationRegion=All)=0 |
Implement this function to return the region specified by decorationRegion for the given top level widget. More... | |
QRegion | region (const QWidget *w, int decorationRegion=All) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
virtual int | regionAt (const QWidget *w, const QPoint &point) |
Returns the type of the first region of the specified top level widget containing the given point. More... | |
virtual void | regionClicked (QWidget *widget, int region) |
Handles the event that the specified region in the given top level widget is activated by a single click (the region parameter is described using the DecorationRegion enum). More... | |
virtual void | regionDoubleClicked (QWidget *widget, int region) |
Handles the event that the specified region in the given top level widget is activated by a double click (the region parameter is described using the DecorationRegion enum). More... | |
virtual | ~QDecoration () |
Destroys this decoration object. More... | |
Static Public Functions | |
static void | startMove (QWidget *widget) |
Starts to move the given top level widget by making its Title region active and grabbing the mouse input. More... | |
static void | startResize (QWidget *widget) |
Starts to resize the given top level widget by making its BottomRight region active and grabbing the mouse input. More... | |
The QDecoration class is a base class for window decorations in Qt for Embedded Linux.
Note that this class is non-portable and only available in Qt for Embedded Linux.
Qt for Embedded Linux provides window management of top level windows and several ready made decorations (i.e., Default
, Styled
and Windows
). Custom decorations can be implemented by subclassing the QDecoration class and creating a decoration plugin (derived from QDecorationPlugin). The default implementation of the QDecorationFactory class will automatically detect the plugin, and load the decoration into the application at run-time using Qt's How to Create Qt Plugins. To actually apply a decoration, use the QApplication::qwsSetDecoration() function.
When creating a custom decoration, implement the paint() function to paint the border and title decoration, and the region() function to return the regions the decoration occupies. Reimplement the regionClicked() and regionDoubleClicked() functions to respond to mouse clicks (the default implementations responds to (single) clicks on items in a widget's system menu and double clicks on a widget's title).
QDecoration provides the DecorationRegion enum that describes the various regions of the window decoration, and the regionAt() function to determine the region containing a given point. The QDecoration class also provides the DecorationState enum describing the state of a given region, e.g. whether it is active or not.
In addition, it is possible to build the system menu for a given top level widget using the buildSysMenu() function; whenever an action in this menu is triggered, the menuTriggered() function is called automatically.
Finally, the QDecoration class provides a couple of static functions, startMove() and startResize(), which start a move or resize action by making the appropriate decoration region active and grabbing the mouse input.
Definition at line 71 of file qdecoration_qws.h.
This enum describes the various regions of the window decoration.
Enumerator | |
---|---|
None | |
All | |
TopLeft | |
Top | |
TopRight | |
Left | |
Right | |
BottomLeft | |
Bottom | |
BottomRight | |
Borders | |
Menu | |
Title | |
Help | |
Minimize | |
Maximize | |
Normalize | |
Close | |
Move | |
Resize |
Definition at line 87 of file qdecoration_qws.h.
This enum describes the various states of a decoration region.
Enumerator | |
---|---|
Normal | |
Disabled | |
Hover | |
Pressed |
Definition at line 98 of file qdecoration_qws.h.
|
inline |
|
inlinevirtual |
Builds the system menu for the given top level widget, adding Restore, Move, Size, Minimize, Maximize and Close actions to the given menu.
Definition at line 276 of file qdecoration_qws.cpp.
This function is called whenever an action in a top level widget's menu is triggered, and simply calls the regionClicked() function passing the widget and action parameters as arguments.
Definition at line 302 of file qdecoration_qws.cpp.
|
pure virtual |
Implement this function to paint the border and title decoration for the specified top level widget using the given painter and decoration state.
The specified decorationRegion is a bitmask of the values described by the DecorationRegion enum.
Note that Qt for Embedded Linux expects this function to return true if any of the widget's decorations are repainted; otherwise it should return false.
Implemented in QDecorationDefault, QDecorationStyled, and QDecorationWindows.
Referenced by QWidgetBackingStore::removeDirtyWidget().
|
pure virtual |
Implement this function to return the region specified by decorationRegion for the given top level widget.
The rectangle parameter specifies the rectangle the decoration is wrapped around. The decorationRegion is a bitmask of the values described by the DecorationRegion enum.
Implemented in QDecorationDefault, QDecorationStyled, and QDecorationWindows.
Referenced by QDecorationStyled::paint(), QDecorationWindows::paint(), QDecorationDefault::paint(), QDecorationWindows::paintButton(), QDecorationDefault::paintButton(), regionAt(), and QWidgetBackingStore::removeDirtyWidget().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 101 of file qdecoration_qws.h.
Returns the type of the first region of the specified top level widget containing the given point.
The return value is one of the DecorationRegion enum's values. Use the region() function to retrieve the actual region. If none of the widget's regions contain the point, this function returns None .
Definition at line 236 of file qdecoration_qws.cpp.
|
virtual |
Handles the event that the specified region in the given top level widget is activated by a single click (the region parameter is described using the DecorationRegion enum).
This function is called whenever a region in a top level widget is clicked; the default implementation responds to clicks on items in the system menu, performing the requested actions.
Definition at line 322 of file qdecoration_qws.cpp.
Referenced by menuTriggered().
|
virtual |
Handles the event that the specified region in the given top level widget is activated by a double click (the region parameter is described using the DecorationRegion enum).
This function is called whenever a region in a top level widget is double clicked; the default implementation responds to a double click on the widget's title, toggling its size between the maximum and its normal size.
Definition at line 368 of file qdecoration_qws.cpp.
|
static |
Starts to move the given top level widget by making its Title region active and grabbing the mouse input.
Definition at line 387 of file qdecoration_qws.cpp.
Referenced by regionClicked().
|
static |
Starts to resize the given top level widget by making its BottomRight region active and grabbing the mouse input.
Definition at line 403 of file qdecoration_qws.cpp.
Referenced by regionClicked().