Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QDecoration Class

TheQDecoration class is a base class for window decorations in Qt for Embedded LinuxMore...

Header:#include <QDecoration>
Inherited By:

QDecorationDefault

Public Types

enumDecorationRegion { All, Top, Bottom, Left, ..., None }
enumDecorationState { Normal, Disabled, Hover, Pressed }

Public Functions

QDecoration()
virtual~QDecoration()
virtual voidbuildSysMenu(QWidget * widget, QMenu * menu)
voidmenuTriggered(QWidget * widget, QAction * action)
virtual boolpaint(QPainter * painter, const QWidget * widget, int decorationRegion = All, DecorationState state = Normal) = 0
virtual QRegionregion(const QWidget * widget, const QRect & rectangle, int decorationRegion = All) = 0
QRegionregion(const QWidget * widget, int decorationRegion = All)
virtual intregionAt(const QWidget * widget, const QPoint & point)
virtual voidregionClicked(QWidget * widget, int region)
virtual voidregionDoubleClicked(QWidget * widget, int region)

Static Public Members

voidstartMove(QWidget * widget)
voidstartResize(QWidget * widget)

Detailed Description

TheQDecoration class is a base class for window decorations in Qt for Embedded Linux

Note that this class is non-portable and only available inQt for Embedded Linux.

Qt for Embedded Linux provides window management of top level windows and several ready made decorations (i.e.,Default,Styled andWindows). Custom decorations can be implemented by subclassing theQDecoration class and creating a decoration plugin (derived fromQDecorationPlugin). The default implementation of theQDecorationFactory class will automatically detect the plugin, and load the decoration into the application at run-time using Qt'splugin system. To actually apply a decoration, use theQApplication::qwsSetDecoration() function.

When creating a custom decoration, implement thepaint() function to paint the border and title decoration, and theregion() function to return the regions the decoration occupies. Reimplement theregionClicked() andregionDoubleClicked() 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 theDecorationRegion enum that describes the various regions of the window decoration, and theregionAt() function to determine the region containing a given point. TheQDecoration class also provides theDecorationState 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 thebuildSysMenu() function; whenever an action in this menu is triggered, themenuTriggered() function is called automatically.

Finally, theQDecoration class provides a couple of static functions,startMove() andstartResize(), which start a move or resize action by making the appropriate decoration region active and grabbing the mouse input.

See alsoQDecorationFactory,QDecorationPlugin, andQt for Embedded Linux Architecture.

Member Type Documentation

enum QDecoration::DecorationRegion

This enum describes the various regions of the window decoration.

ConstantValueDescription
QDecoration::All0x7fffffffThe entire region used by the window decoration.
QDecoration::Top0x0000000002The top border used to vertically resize the window.
QDecoration::Bottom0x0000000040The bottom border used to vertically resize the window.
QDecoration::Left0x0000000008The left border used to horizontally resize the window.
QDecoration::Right0x0000000010The right border used to horizontally resize the window.
QDecoration::TopLeft0x0000000001The top-left corner of the window used to resize the window both horizontally and vertically.
QDecoration::TopRight0x0000000004The top-right corner of the window used to resize the window both horizontally and vertically.
QDecoration::BottomLeft0x0000000020The bottom-left corner of the window used to resize the window both horizontally and vertically.
QDecoration::BottomRight0x0000000080The bottom-right corner of the window used to resize the window both horizontally and vertically.
QDecoration::Borders0x00000000ffAll the regions used to describe the window's borders.
QDecoration::Title0x0000000200The region containing the window title, used to move the window by dragging with the mouse cursor.
QDecoration::Close0x0000004000The region occupied by the close button. Clicking in this region closes the window.
QDecoration::Minimize0x0000000800The region occupied by the minimize button. Clicking in this region minimizes the window.
QDecoration::Maximize0x0000001000The region occupied by the maximize button. Clicking in this region maximizes the window.
QDecoration::Normalize0x0000002000The region occupied by a button used to restore a window's normal size. Clicking in this region restores a maximized window to its previous size. The region used for this button is often also the Maximize region.
QDecoration::Menu0x0000000100The region occupied by the window's menu button. Clicking in this region opens the window operations (system) menu.
QDecoration::Help0x0000000400The region occupied by the window's help button. Clicking in this region causes the context-sensitive help function to be enabled.
QDecoration::Resize0x0000010000The region used to resize the window.
QDecoration::Move0x0000008000The region used to move the window.
QDecoration::None0x0000000000No region.

See alsoregion(),regionAt(), andDecorationState.

enum QDecoration::DecorationState

This enum describes the various states of a decoration region.

ConstantValueDescription
QDecoration::Normal0x04The region is active
QDecoration::Disabled0x08The region is inactive.
QDecoration::Hover0x01The cursor is hovering over the region.
QDecoration::Pressed0x02The region is pressed.

See alsopaint() andDecorationRegion.

Member Function Documentation

QDecoration::QDecoration()

Constructs a decoration object.

[virtual]QDecoration::~QDecoration()

Destroys this decoration object.

[virtual]void QDecoration::buildSysMenu(QWidget * widget,QMenu * menu)

Builds the system menu for the given top levelwidget, addingRestore,Move,Size,Minimize,Maximize andClose actions to the givenmenu.

See alsomenuTriggered().

void QDecoration::menuTriggered(QWidget * widget,QAction * action)

This function is called whenever an action in a top level widget's menu is triggered, and simply calls theregionClicked() function passing thewidget andaction parameters as arguments.

See alsobuildSysMenu().

[pure virtual]bool QDecoration::paint(QPainter * painter, constQWidget * widget,int decorationRegion = All,DecorationState state = Normal)

Implement this function to paint the border and title decoration for the specified top levelwidget using the givenpainter and decorationstate. The specifieddecorationRegion is a bitmask of the values described by theDecorationRegion enum.

Note thatQt for Embedded Linux expects this function to return true if any of the widget's decorations are repainted; otherwise it should return false.

See alsoregion().

[pure virtual]QRegion QDecoration::region(constQWidget * widget, constQRect & rectangle,int decorationRegion = All)

Implement this function to return the region specified bydecorationRegion for the given top levelwidget.

Therectangle parameter specifies the rectangle the decoration is wrapped around. ThedecorationRegion is a bitmask of the values described by theDecorationRegion enum.

See alsoregionAt() andpaint().

QRegion QDecoration::region(constQWidget * widget,int decorationRegion = All)

This is an overloaded function.

[virtual]int QDecoration::regionAt(constQWidget * widget, constQPoint & point)

Returns the type of the first region of the specified top levelwidget containing the givenpoint.

The return value is one of theDecorationRegion enum's values. Use theregion() function to retrieve the actual region. If none of the widget's regions contain the point, this function returnsNone.

See alsoregion().

[virtual]void QDecoration::regionClicked(QWidget * widget,int region)

Handles the event that the specifiedregion in the given top levelwidget is activated by a single click (theregion parameter is described using theDecorationRegion 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.

See alsoregionDoubleClicked() andregion().

[virtual]void QDecoration::regionDoubleClicked(QWidget * widget,int region)

Handles the event that the specifiedregion in the given top levelwidget is activated by a double click (the region parameter is described using theDecorationRegion 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.

See alsoregionClicked() andregion().

[static]void QDecoration::startMove(QWidget * widget)

Starts to move the given top levelwidget by making itsTitle region active and grabbing the mouse input.

See alsostartResize().

[static]void QDecoration::startResize(QWidget * widget)

Starts to resize the given top levelwidget by making itsBottomRight region active and grabbing the mouse input.

See alsostartMove().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp