KDecoration3::Decoration
#include <decoration.h>
Properties | |
qreal | borderBottom |
qreal | borderLeft |
qreal | borderRight |
QMarginsF | borders |
qreal | borderTop |
bool | opaque |
qreal | resizeOnlyBorderBottom |
qreal | resizeOnlyBorderLeft |
qreal | resizeOnlyBorderRight |
QMarginsF | resizeOnlyBorders |
qreal | resizeOnlyBorderTop |
Qt::WindowFrameSection | sectionUnderMouse |
QRectF | titleBar |
Properties inherited from QObject | |
objectName | |
Signals | |
void | blurRegionChanged () |
void | bordersChanged () |
void | currentStateChanged (std::shared_ptr< DecorationState > state) |
void | damaged (const QRegion ®ion) |
void | nextStateChanged (std::shared_ptr< DecorationState > state) |
void | opaqueChanged (bool) |
void | resizeOnlyBordersChanged () |
void | sectionUnderMouseChanged (Qt::WindowFrameSection) |
void | shadowChanged (const std::shared_ptr< DecorationShadow > &shadow) |
void | titleBarChanged () |
Public Slots | |
virtual bool | init ()=0 |
void | requestClose () |
void | requestContextHelp () |
void | requestHideToolTip () |
void | requestMinimize () |
void | requestShowApplicationMenu (const QRect &rect, int actionId) |
void | requestShowToolTip (const QString &text) |
void | requestShowWindowMenu (const QRect &rect) |
void | requestToggleKeepAbove () |
void | requestToggleKeepBelow () |
void | requestToggleMaximization (Qt::MouseButtons buttons) |
void | requestToggleOnAllDesktops () |
void | requestToggleShade () |
void | showApplicationMenu (int actionId) |
void | update () |
void | update (const QRectF &rect) |
Public Member Functions | |
void | apply (std::shared_ptr< DecorationState > state) |
QRegion | blurRegion () const |
qreal | borderBottom () const |
qreal | borderLeft () const |
qreal | borderRight () const |
QMarginsF | borders () const |
qreal | borderTop () const |
void | create () |
std::shared_ptr< DecorationState > | currentState () const |
bool | event (QEvent *event) override |
bool | isOpaque () const |
std::shared_ptr< DecorationState > | nextState () const |
virtual void | paint (QPainter *painter, const QRectF &repaintArea)=0 |
QRectF | rect () const |
qreal | resizeOnlyBorderBottom () const |
qreal | resizeOnlyBorderLeft () const |
qreal | resizeOnlyBorderRight () const |
QMarginsF | resizeOnlyBorders () const |
qreal | resizeOnlyBorderTop () const |
Qt::WindowFrameSection | sectionUnderMouse () const |
void | setSettings (const std::shared_ptr< DecorationSettings > &settings) |
void | setState (std::function< void(DecorationState *state)> callback) |
std::shared_ptr< DecorationSettings > | settings () const |
std::shared_ptr< DecorationShadow > | shadow () const |
QSizeF | size () const |
QRectF | titleBar () const |
DecoratedWindow * | window () const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QBindable< QString > | bindableObjectName () |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () const const |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isQuickItemType () const const |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_GADGET_EXPORT (EXPORT_MACRO) | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_MOC_INCLUDE Q_MOC_INCLUDE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setObjectName (QAnyStringView name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | setProperty (const char *name, QVariant &&value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType) |
QThread * | thread () const const |
Protected Member Functions | |
Decoration (QObject *parent, const QVariantList &args) | |
virtual std::shared_ptr< DecorationState > | createState () |
virtual void | hoverEnterEvent (QHoverEvent *event) |
virtual void | hoverLeaveEvent (QHoverEvent *event) |
virtual void | hoverMoveEvent (QHoverEvent *event) |
virtual void | mouseMoveEvent (QMouseEvent *event) |
virtual void | mousePressEvent (QMouseEvent *event) |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
void | setBlurRegion (const QRegion ®ion) |
void | setBorders (const QMarginsF &borders) |
void | setOpaque (bool opaque) |
void | setResizeOnlyBorders (const QMarginsF &borders) |
void | setShadow (const std::shared_ptr< DecorationShadow > &shadow) |
void | setTitleBar (const QRectF &rect) |
virtual void | wheelEvent (QWheelEvent *event) |
Protected Member Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
Public Types inherited from QObject | |
typedef | QObjectList |
Static Public Member Functions inherited from QObject | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
Detailed Description
Base class for the Decoration.
To provide a Decoration one needs to inherit from this class. The framework will instantiate an instance of the inherited class for each DecoratedWindow.
The main tasks of the Decoration is to provide borders around the DecoratedWindow. For this the Deocration provides border sizes: those should be adjusted depending on the state of the DecoratedWindow. E.g. commonly a maximized DecoratedWindow does not have borders on the side, only the title bar.
Whenever the visual representation of the Decoration changes the slot Decoration::update should be invoked to request a repaint. The framework will in return invoke the Decoration::paint method. This method needs to be implemented by inheriting classes.
A Decoration commonly provides buttons for interaction. E.g. a close button to close the DecoratedWindow. For such actions the Decoration provides slots which should be connected to the clicked signals of the buttons. For convenience the framework provides the DecorationButton and the DecorationButtonGroup for easier layout. It is not required to use those, if one uses different ways to represent the actions one needs to filter the events accordingly.
Definition at line 82 of file decoration.h.
Property Documentation
◆ borderBottom
|
read |
Definition at line 89 of file decoration.h.
◆ borderLeft
|
read |
Definition at line 86 of file decoration.h.
◆ borderRight
|
read |
Definition at line 87 of file decoration.h.
◆ borders
|
read |
Definition at line 85 of file decoration.h.
◆ borderTop
|
read |
Definition at line 88 of file decoration.h.
◆ opaque
|
read |
Whether the Decoration is fully opaque.
By default a Decoration is considered to use the alpha channel and this property has the value false
. But for e.g. a maximized DecoratedWindow it is possible that the Decoration is fully opaque. In this case the Decoration should set this property to true
.
Definition at line 112 of file decoration.h.
◆ resizeOnlyBorderBottom
|
read |
Definition at line 94 of file decoration.h.
◆ resizeOnlyBorderLeft
|
read |
Definition at line 91 of file decoration.h.
◆ resizeOnlyBorderRight
|
read |
Definition at line 92 of file decoration.h.
◆ resizeOnlyBorders
|
read |
Definition at line 90 of file decoration.h.
◆ resizeOnlyBorderTop
|
read |
Definition at line 93 of file decoration.h.
◆ sectionUnderMouse
|
read |
This property denotes the part of the Decoration which is currently under the mouse pointer.
It gets automatically updated whenever a QMouseEvent or QHoverEvent gets processed.
Definition at line 99 of file decoration.h.
◆ titleBar
|
read |
The titleBar is the area inside the Decoration containing all controls (e.g.
Buttons) and the caption. The titleBar is the main interaction area, while all other areas of the Decoration are normally used as resize areas.
Definition at line 105 of file decoration.h.
Constructor & Destructor Documentation
◆ Decoration()
|
explicitprotected |
Constructor for the Decoration.
The args
are used by the decoration framework to pass meta information to the Decoration. An inheriting class is supposed to pass the args to the parent class.
- Parameters
-
parent The parent of the Decoration args Additional arguments passed in from the framework
Definition at line 167 of file decoration.cpp.
Member Function Documentation
◆ apply()
void KDecoration3::Decoration::apply | ( | std::shared_ptr< DecorationState > | state | ) |
Make the specified state current.
The decoration maintains a double-buffered state. If a double-buffered property needs to be changed, the next state will be updated and the nextStateChanged() signal will be emitted to notify the compositor about it.
When the next state gets applied is subject to compositor policies. For example, the compositor may apply the new state immediately, or it can synchronize double-buffered decoration state with double-buffered toplevel state.
- See also
- currentState(), nextState(), createState()
Definition at line 553 of file decoration.cpp.
◆ blurRegion()
QRegion KDecoration3::Decoration::blurRegion | ( | ) | const |
The decoration's blur region in local coordinates.
Definition at line 306 of file decoration.cpp.
◆ borderBottom()
qreal KDecoration3::Decoration::borderBottom | ( | ) | const |
Definition at line 371 of file decoration.cpp.
◆ borderLeft()
qreal KDecoration3::Decoration::borderLeft | ( | ) | const |
Definition at line 341 of file decoration.cpp.
◆ borderRight()
qreal KDecoration3::Decoration::borderRight | ( | ) | const |
Definition at line 351 of file decoration.cpp.
◆ borders()
QMarginsF KDecoration3::Decoration::borders | ( | ) | const |
Definition at line 311 of file decoration.cpp.
◆ borderTop()
qreal KDecoration3::Decoration::borderTop | ( | ) | const |
Definition at line 361 of file decoration.cpp.
◆ create()
void KDecoration3::Decoration::create | ( | ) |
Allocates the resources associated with the decoration, for example state containers.
- Note
- This method gets invoked by the compositor before init(), the decoration implementation must not call it.
Definition at line 541 of file decoration.cpp.
◆ createState()
|
protectedvirtual |
Create a state container.
The decoration implementation can override this method to attach its own properties to the decoration state.
The default implementation simply creates an instance of the DecorationState type.
- See also
- currentState(), nextState()
Definition at line 526 of file decoration.cpp.
◆ currentState()
std::shared_ptr< DecorationState > KDecoration3::Decoration::currentState | ( | ) | const |
◆ event()
|
overridevirtual |
Reimplemented from QObject.
Definition at line 392 of file decoration.cpp.
◆ hoverEnterEvent()
|
protectedvirtual |
Definition at line 421 of file decoration.cpp.
◆ hoverLeaveEvent()
|
protectedvirtual |
Definition at line 430 of file decoration.cpp.
◆ hoverMoveEvent()
|
protectedvirtual |
Definition at line 438 of file decoration.cpp.
◆ init
|
pure virtualslot |
This method gets invoked from the framework once the Decoration is created and completely setup.
An inheriting class should override this method and perform all initialization in this method instead of the constructor.
- Returns
- true if initialization has been successful, false otherwise (for example, a QML component could not be loaded)
◆ isOpaque()
bool KDecoration3::Decoration::isOpaque | ( | ) | const |
Definition at line 336 of file decoration.cpp.
◆ mouseMoveEvent()
|
protectedvirtual |
Definition at line 460 of file decoration.cpp.
◆ mousePressEvent()
|
protectedvirtual |
Definition at line 471 of file decoration.cpp.
◆ mouseReleaseEvent()
|
protectedvirtual |
Definition at line 484 of file decoration.cpp.
◆ nextState()
std::shared_ptr< DecorationState > KDecoration3::Decoration::nextState | ( | ) | const |
Returns the next state, i.e.
the state that the decoration implementation wants to be current.
- See also
- apply()
Definition at line 536 of file decoration.cpp.
◆ paint()
|
pure virtual |
Implement this method in inheriting classes to provide the rendering.
The painter
is set up to paint on an internal QPaintDevice. The painting is implicitly double buffered.
- Parameters
-
painter The painter which needs to be used for rendering repaintArea The region which needs to be repainted.
◆ rect()
QRectF KDecoration3::Decoration::rect | ( | ) | const |
The decoration's geometry in local coordinates.
Basically the size of the DecoratedWindow combined with the borders.
Definition at line 387 of file decoration.cpp.
◆ requestClose
|
slot |
Definition at line 180 of file decoration.cpp.
◆ requestContextHelp
|
slot |
Definition at line 185 of file decoration.cpp.
◆ requestHideToolTip
|
slot |
Definition at line 232 of file decoration.cpp.
◆ requestMinimize
|
slot |
Definition at line 190 of file decoration.cpp.
◆ requestShowApplicationMenu
|
slot |
Definition at line 252 of file decoration.cpp.
◆ requestShowToolTip
|
slot |
Definition at line 227 of file decoration.cpp.
◆ requestShowWindowMenu
|
slot |
- Parameters
-
rect the location at which to show the window menu
Definition at line 222 of file decoration.cpp.
◆ requestToggleKeepAbove
|
slot |
Definition at line 205 of file decoration.cpp.
◆ requestToggleKeepBelow
|
slot |
Definition at line 210 of file decoration.cpp.
◆ requestToggleMaximization
|
slot |
Definition at line 237 of file decoration.cpp.
◆ requestToggleOnAllDesktops
|
slot |
Definition at line 195 of file decoration.cpp.
◆ requestToggleShade
|
slot |
Definition at line 200 of file decoration.cpp.
◆ resizeOnlyBorderBottom()
qreal KDecoration3::Decoration::resizeOnlyBorderBottom | ( | ) | const |
Definition at line 376 of file decoration.cpp.
◆ resizeOnlyBorderLeft()
qreal KDecoration3::Decoration::resizeOnlyBorderLeft | ( | ) | const |
Definition at line 346 of file decoration.cpp.
◆ resizeOnlyBorderRight()
qreal KDecoration3::Decoration::resizeOnlyBorderRight | ( | ) | const |
Definition at line 356 of file decoration.cpp.
◆ resizeOnlyBorders()
QMarginsF KDecoration3::Decoration::resizeOnlyBorders | ( | ) | const |
Definition at line 316 of file decoration.cpp.
◆ resizeOnlyBorderTop()
qreal KDecoration3::Decoration::resizeOnlyBorderTop | ( | ) | const |
Definition at line 366 of file decoration.cpp.
◆ sectionUnderMouse()
Qt::WindowFrameSection KDecoration3::Decoration::sectionUnderMouse | ( | ) | const |
Definition at line 326 of file decoration.cpp.
◆ setBlurRegion()
|
protected |
Definition at line 257 of file decoration.cpp.
◆ setBorders()
|
protected |
Definition at line 265 of file decoration.cpp.
◆ setOpaque()
|
protected |
Definition at line 290 of file decoration.cpp.
◆ setResizeOnlyBorders()
|
protected |
Definition at line 274 of file decoration.cpp.
◆ setSettings()
void KDecoration3::Decoration::setSettings | ( | const std::shared_ptr< DecorationSettings > & | settings | ) |
Invoked by the framework to set the Settings for this Decoration before init is invoked.
Definition at line 516 of file decoration.cpp.
◆ setShadow()
|
protected |
Definition at line 298 of file decoration.cpp.
◆ setState()
void KDecoration3::Decoration::setState | ( | std::function< void(DecorationState *state)> | callback | ) |
Notifies the framework that the decoration state has changed.
When the new state is applied is subject to compositor policies. For example, the compositor may re-configure the window and apply the new state when the window is repainted.
Definition at line 547 of file decoration.cpp.
◆ settings()
std::shared_ptr< DecorationSettings > KDecoration3::Decoration::settings | ( | ) | const |
- Returns
- The DecorationSettings used for this Decoration.
Definition at line 521 of file decoration.cpp.
◆ setTitleBar()
|
protected |
An implementation has to invoke this method whenever the area containing the controls and caption changes.
- Parameters
-
rect The new geometry of the titleBar in Decoration coordinates
Definition at line 282 of file decoration.cpp.
◆ shadow()
std::shared_ptr< DecorationShadow > KDecoration3::Decoration::shadow | ( | ) | const |
DecorationShadow for this Decoration.
It is recommended that multiple Decorations share the same DecorationShadow. E.g one DecorationShadow for all inactive Decorations and one for the active Decoration.
Definition at line 331 of file decoration.cpp.
◆ showApplicationMenu
|
slot |
Definition at line 242 of file decoration.cpp.
◆ size()
QSizeF KDecoration3::Decoration::size | ( | ) | const |
Definition at line 381 of file decoration.cpp.
◆ titleBar()
QRectF KDecoration3::Decoration::titleBar | ( | ) | const |
Definition at line 321 of file decoration.cpp.
◆ update [1/2]
|
slot |
Definition at line 511 of file decoration.cpp.
◆ update [2/2]
|
slot |
Definition at line 506 of file decoration.cpp.
◆ wheelEvent()
|
protectedvirtual |
Definition at line 496 of file decoration.cpp.
◆ window()
DecoratedWindow * KDecoration3::Decoration::window | ( | ) | const |
The DecoratedWindow for this Decoration.
Definition at line 175 of file decoration.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:55:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.