KDecoration3::Decoration

Search for usage in LXR

KDecoration3::Decoration Class Referenceabstract

#include <decoration.h>

Inheritance diagram for KDecoration3::Decoration:

Properties

int borderBottom
 
int borderLeft
 
int borderRight
 
QMargins borders
 
int borderTop
 
bool opaque
 
int resizeOnlyBorderBottom
 
int resizeOnlyBorderLeft
 
int resizeOnlyBorderRight
 
QMargins resizeOnlyBorders
 
int resizeOnlyBorderTop
 
Qt::WindowFrameSection sectionUnderMouse
 
QRect titleBar
 
- Properties inherited from QObject
 objectName
 

Signals

void blurRegionChanged ()
 
void bordersChanged ()
 
void damaged (const QRegion &region)
 
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 QRect &rect)
 

Public Member Functions

QRegion blurRegion () const
 
int borderBottom () const
 
int borderLeft () const
 
int borderRight () const
 
QMargins borders () const
 
int borderTop () const
 
bool event (QEvent *event) override
 
bool isOpaque () const
 
virtual void paint (QPainter *painter, const QRect &repaintArea)=0
 
QRect rect () const
 
int resizeOnlyBorderBottom () const
 
int resizeOnlyBorderLeft () const
 
int resizeOnlyBorderRight () const
 
QMargins resizeOnlyBorders () const
 
int resizeOnlyBorderTop () const
 
Qt::WindowFrameSection sectionUnderMouse () const
 
void setSettings (const std::shared_ptr< DecorationSettings > &settings)
 
std::shared_ptr< DecorationSettingssettings () const
 
std::shared_ptr< DecorationShadowshadow () const
 
QSize size () const
 
QRect titleBar () const
 
DecoratedWindowwindow () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () 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< QByteArraydynamicPropertyNames () const const
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
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 QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () 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
 
qobject_cast (const QObject *object)
 
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)
 
QThreadthread () const const
 

Protected Member Functions

 Decoration (QObject *parent, const QVariantList &args)
 
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 &region)
 
void setBorders (const QMargins &borders)
 
void setOpaque (bool opaque)
 
void setResizeOnlyBorders (const QMargins &borders)
 
void setShadow (const std::shared_ptr< DecorationShadow > &shadow)
 
void setTitleBar (const QRect &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
 
QObjectsender () 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.

See also
DecoratedWindow
DecorationButton
DecorationButtonGroup

Definition at line 57 of file decoration.h.

Property Documentation

◆ borderBottom

int KDecoration3::Decoration::borderBottom
read

Definition at line 64 of file decoration.h.

◆ borderLeft

int KDecoration3::Decoration::borderLeft
read

Definition at line 61 of file decoration.h.

◆ borderRight

int KDecoration3::Decoration::borderRight
read

Definition at line 62 of file decoration.h.

◆ borders

QMargins KDecoration3::Decoration::borders
read

Definition at line 60 of file decoration.h.

◆ borderTop

int KDecoration3::Decoration::borderTop
read

Definition at line 63 of file decoration.h.

◆ opaque

bool KDecoration3::Decoration::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 87 of file decoration.h.

◆ resizeOnlyBorderBottom

int KDecoration3::Decoration::resizeOnlyBorderBottom
read

Definition at line 69 of file decoration.h.

◆ resizeOnlyBorderLeft

int KDecoration3::Decoration::resizeOnlyBorderLeft
read

Definition at line 66 of file decoration.h.

◆ resizeOnlyBorderRight

int KDecoration3::Decoration::resizeOnlyBorderRight
read

Definition at line 67 of file decoration.h.

◆ resizeOnlyBorders

QMargins KDecoration3::Decoration::resizeOnlyBorders
read

Definition at line 65 of file decoration.h.

◆ resizeOnlyBorderTop

int KDecoration3::Decoration::resizeOnlyBorderTop
read

Definition at line 68 of file decoration.h.

◆ sectionUnderMouse

Qt::WindowFrameSection KDecoration3::Decoration::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 74 of file decoration.h.

◆ titleBar

QRect KDecoration3::Decoration::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 80 of file decoration.h.

Constructor & Destructor Documentation

◆ Decoration()

KDecoration3::Decoration::Decoration ( QObject * parent,
const QVariantList & args )
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
parentThe parent of the Decoration
argsAdditional arguments passed in from the framework

Definition at line 131 of file decoration.cpp.

Member Function Documentation

◆ blurRegion()

QRegion KDecoration3::Decoration::blurRegion ( ) const

The decoration's blur region in local coordinates.

Definition at line 272 of file decoration.cpp.

◆ borderBottom()

int KDecoration3::Decoration::borderBottom ( ) const

Definition at line 337 of file decoration.cpp.

◆ borderLeft()

int KDecoration3::Decoration::borderLeft ( ) const

Definition at line 307 of file decoration.cpp.

◆ borderRight()

int KDecoration3::Decoration::borderRight ( ) const

Definition at line 317 of file decoration.cpp.

◆ borders()

QMargins KDecoration3::Decoration::borders ( ) const

Definition at line 277 of file decoration.cpp.

◆ borderTop()

int KDecoration3::Decoration::borderTop ( ) const

Definition at line 327 of file decoration.cpp.

◆ event()

bool KDecoration3::Decoration::event ( QEvent * event)
overridevirtual

Reimplemented from QObject.

Definition at line 359 of file decoration.cpp.

◆ hoverEnterEvent()

void KDecoration3::Decoration::hoverEnterEvent ( QHoverEvent * event)
protectedvirtual

Definition at line 388 of file decoration.cpp.

◆ hoverLeaveEvent()

void KDecoration3::Decoration::hoverLeaveEvent ( QHoverEvent * event)
protectedvirtual

Definition at line 397 of file decoration.cpp.

◆ hoverMoveEvent()

void KDecoration3::Decoration::hoverMoveEvent ( QHoverEvent * event)
protectedvirtual

Definition at line 405 of file decoration.cpp.

◆ init

virtual bool KDecoration3::Decoration::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 302 of file decoration.cpp.

◆ mouseMoveEvent()

void KDecoration3::Decoration::mouseMoveEvent ( QMouseEvent * event)
protectedvirtual

Definition at line 427 of file decoration.cpp.

◆ mousePressEvent()

void KDecoration3::Decoration::mousePressEvent ( QMouseEvent * event)
protectedvirtual

Definition at line 438 of file decoration.cpp.

◆ mouseReleaseEvent()

void KDecoration3::Decoration::mouseReleaseEvent ( QMouseEvent * event)
protectedvirtual

Definition at line 451 of file decoration.cpp.

◆ paint()

virtual void KDecoration3::Decoration::paint ( QPainter * painter,
const QRect & repaintArea )
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
painterThe painter which needs to be used for rendering
repaintAreaThe region which needs to be repainted.

◆ rect()

QRect KDecoration3::Decoration::rect ( ) const

The decoration's geometry in local coordinates.

Basically the size of the DecoratedWindow combined with the borders.

Definition at line 354 of file decoration.cpp.

◆ requestClose

void KDecoration3::Decoration::requestClose ( )
slot

Definition at line 147 of file decoration.cpp.

◆ requestContextHelp

void KDecoration3::Decoration::requestContextHelp ( )
slot

Definition at line 152 of file decoration.cpp.

◆ requestHideToolTip

void KDecoration3::Decoration::requestHideToolTip ( )
slot

Definition at line 199 of file decoration.cpp.

◆ requestMinimize

void KDecoration3::Decoration::requestMinimize ( )
slot

Definition at line 157 of file decoration.cpp.

◆ requestShowApplicationMenu

void KDecoration3::Decoration::requestShowApplicationMenu ( const QRect & rect,
int actionId )
slot

Definition at line 219 of file decoration.cpp.

◆ requestShowToolTip

void KDecoration3::Decoration::requestShowToolTip ( const QString & text)
slot

Definition at line 194 of file decoration.cpp.

◆ requestShowWindowMenu

void KDecoration3::Decoration::requestShowWindowMenu ( const QRect & rect)
slot
Parameters
rectthe location at which to show the window menu

Definition at line 189 of file decoration.cpp.

◆ requestToggleKeepAbove

void KDecoration3::Decoration::requestToggleKeepAbove ( )
slot

Definition at line 172 of file decoration.cpp.

◆ requestToggleKeepBelow

void KDecoration3::Decoration::requestToggleKeepBelow ( )
slot

Definition at line 177 of file decoration.cpp.

◆ requestToggleMaximization

void KDecoration3::Decoration::requestToggleMaximization ( Qt::MouseButtons buttons)
slot

Definition at line 204 of file decoration.cpp.

◆ requestToggleOnAllDesktops

void KDecoration3::Decoration::requestToggleOnAllDesktops ( )
slot

Definition at line 162 of file decoration.cpp.

◆ requestToggleShade

void KDecoration3::Decoration::requestToggleShade ( )
slot

Definition at line 167 of file decoration.cpp.

◆ resizeOnlyBorderBottom()

int KDecoration3::Decoration::resizeOnlyBorderBottom ( ) const

Definition at line 342 of file decoration.cpp.

◆ resizeOnlyBorderLeft()

int KDecoration3::Decoration::resizeOnlyBorderLeft ( ) const

Definition at line 312 of file decoration.cpp.

◆ resizeOnlyBorderRight()

int KDecoration3::Decoration::resizeOnlyBorderRight ( ) const

Definition at line 322 of file decoration.cpp.

◆ resizeOnlyBorders()

QMargins KDecoration3::Decoration::resizeOnlyBorders ( ) const

Definition at line 282 of file decoration.cpp.

◆ resizeOnlyBorderTop()

int KDecoration3::Decoration::resizeOnlyBorderTop ( ) const

Definition at line 332 of file decoration.cpp.

◆ sectionUnderMouse()

Qt::WindowFrameSection KDecoration3::Decoration::sectionUnderMouse ( ) const

Definition at line 292 of file decoration.cpp.

◆ setBlurRegion()

void KDecoration3::Decoration::setBlurRegion ( const QRegion & region)
protected

Definition at line 224 of file decoration.cpp.

◆ setBorders()

void KDecoration3::Decoration::setBorders ( const QMargins & borders)
protected

Definition at line 232 of file decoration.cpp.

◆ setOpaque()

void KDecoration3::Decoration::setOpaque ( bool opaque)
protected

Definition at line 256 of file decoration.cpp.

◆ setResizeOnlyBorders()

void KDecoration3::Decoration::setResizeOnlyBorders ( const QMargins & borders)
protected

Definition at line 240 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 483 of file decoration.cpp.

◆ setShadow()

void KDecoration3::Decoration::setShadow ( const std::shared_ptr< DecorationShadow > & shadow)
protected

Definition at line 264 of file decoration.cpp.

◆ settings()

std::shared_ptr< DecorationSettings > KDecoration3::Decoration::settings ( ) const
Returns
The DecorationSettings used for this Decoration.

Definition at line 488 of file decoration.cpp.

◆ setTitleBar()

void KDecoration3::Decoration::setTitleBar ( const QRect & rect)
protected

An implementation has to invoke this method whenever the area containing the controls and caption changes.

Parameters
rectThe new geometry of the titleBar in Decoration coordinates

Definition at line 248 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 297 of file decoration.cpp.

◆ showApplicationMenu

void KDecoration3::Decoration::showApplicationMenu ( int actionId)
slot

Definition at line 209 of file decoration.cpp.

◆ size()

QSize KDecoration3::Decoration::size ( ) const

Definition at line 347 of file decoration.cpp.

◆ titleBar()

QRect KDecoration3::Decoration::titleBar ( ) const

Definition at line 287 of file decoration.cpp.

◆ update [1/2]

void KDecoration3::Decoration::update ( )
slot

Definition at line 478 of file decoration.cpp.

◆ update [2/2]

void KDecoration3::Decoration::update ( const QRect & rect)
slot

Definition at line 473 of file decoration.cpp.

◆ wheelEvent()

void KDecoration3::Decoration::wheelEvent ( QWheelEvent * event)
protectedvirtual

Definition at line 463 of file decoration.cpp.

◆ window()

DecoratedWindow * KDecoration3::Decoration::window ( ) const

The DecoratedWindow for this Decoration.

Definition at line 142 of file decoration.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.