KDecoration2::DecorationButton

KDecoration2::DecorationButton Class Referenceabstract

#include <decorationbutton.h>

Inheritance diagram for KDecoration2::DecorationButton:

Properties

Qt::MouseButtons acceptedButtons
 
bool checkable
 
bool checked
 
bool enabled
 
QRectF geometry
 
bool hovered
 
bool pressed
 
bool visible
 
- Properties inherited from QObject
 objectName
 

Signals

void acceptedButtonsChanged (Qt::MouseButtons)
 
void checkableChanged (bool)
 
void checkedChanged (bool)
 
void clicked (Qt::MouseButton)
 
void doubleClicked ()
 
void enabledChanged (bool)
 
void geometryChanged (const QRectF &)
 
void hoveredChanged (bool)
 
void pointerEntered ()
 
void pointerLeft ()
 
void pressed ()
 
void pressedChanged (bool)
 
void released ()
 
void visibilityChanged (bool)
 

Public Slots

void setCheckable (bool checkable)
 
void setChecked (bool checked)
 
void setEnabled (bool enabled)
 
void setVisible (bool visible)
 
void update (const QRectF &rect)
 
void update ()
 

Public Member Functions

Qt::MouseButtons acceptedButtons () const
 
bool contains (const QPointF &pos) const
 
QPointer< Decorationdecoration () const
 
bool event (QEvent *event) override
 
QRectF geometry () const
 
bool isCheckable () const
 
bool isChecked () const
 
bool isEnabled () const
 
bool isHovered () const
 
bool isPressed () const
 
bool isVisible () const
 
virtual void paint (QPainter *painter, const QRect &repaintArea)=0
 
void setAcceptedButtons (Qt::MouseButtons buttons)
 
void setGeometry (const QRectF &geometry)
 
QSizeF size () const
 
DecorationButtonType type () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
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 ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
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 QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
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_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 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
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

 DecorationButton (DecorationButtonType type, const QPointer< Decoration > &decoration, QObject *parent=nullptr)
 
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)
 
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

- 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 *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
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, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

A button to be used in a Decoration.

The DecorationButton is a simple Button which can be used (but doesn't have to) in a Decoration. It takes care of the input handling and triggers the correct state change methods on the Decoration.

This simplifies the handling of DecorationButtons. A Decoration implementation just needs to subclass DecorationButton and implement the paint method. Everything else is handled by the DecorationButton.

For positioning the DecorationButtons it's recommended to use a DecorationButtonGroup.

See also
Decoration
DecorationButtonGroup

Definition at line 60 of file decorationbutton.h.

Property Documentation

Qt::MouseButtons KDecoration2::DecorationButton::acceptedButtons
readwrite

The mouse buttons the DecorationButton accepts.

By default the Qt::LeftButton gets accepted, for some types more buttons are accepted.

Definition at line 100 of file decorationbutton.h.

bool KDecoration2::DecorationButton::checkable
readwrite

Whether the DecorationButton can be checked.

This is used for state aware DecorationButtons like Maximize, Shade, KeepAbove, KeepBelow and OnAllDesktops.

Definition at line 85 of file decorationbutton.h.

bool KDecoration2::DecorationButton::checked
readwrite

Whether the DecorationButton is checked.

A DecorationButton can only be checked if the DecorationButton is checkable. Note: the checked state is not changed by clicking the DecorationButton. It gets changed if the DecoratedClient changes it's state, though.

Definition at line 91 of file decorationbutton.h.

bool KDecoration2::DecorationButton::enabled
readwrite

Whether the DecorationButton is enabled.

Only an enabled button accepts hover and mouse press events.

Definition at line 80 of file decorationbutton.h.

QRectF KDecoration2::DecorationButton::geometry
read

The geometry of the DecorationButton in Decoration-local coordinates.

Definition at line 95 of file decorationbutton.h.

bool KDecoration2::DecorationButton::hovered
read

Whether the DecorationButton is currently hovered.

Definition at line 75 of file decorationbutton.h.

bool KDecoration2::DecorationButton::pressed
read

Whether the DecorationButton is currently pressed.

Definition at line 71 of file decorationbutton.h.

bool KDecoration2::DecorationButton::visible
readwrite

Whether the DecorationButton is visible.

By default this is true, OnAllDesktops and QuickHelp depend on the DecoratedClient's state.

Definition at line 67 of file decorationbutton.h.

Member Function Documentation

bool KDecoration2::DecorationButton::contains ( const QPointF pos) const

Returns true if pos is inside of the button, otherwise returns false.

Definition at line 450 of file decorationbutton.cpp.

virtual void KDecoration2::DecorationButton::paint ( QPainter painter,
const QRect repaintArea 
)
pure virtual

Invoked for painting this DecorationButtons.

Implementing sub-classes need to implement this method. The coordinate system of the QPainter is set to Decoration coordinates.

This method will be invoked from the rendering thread.

Parameters
painterThe QPainter to paint this DecorationButton.
repaintAreaThe area which is going to be repainted in Decoration coordinates
void KDecoration2::DecorationButton::update ( const QRectF rect)
slot

Schedules a repaint of the DecorationButton.

Calling update will eventually result in paint being invoked.

Parameters
rectThe area to repaint in Decoration local coordinates, a null QRect updates the complete geometry
See also
paint

Definition at line 381 of file decorationbutton.cpp.

void KDecoration2::DecorationButton::update ( )
slot

Schedules a repaint of the DecorationButton.

Overloaded method for convenience.

Definition at line 386 of file decorationbutton.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 23:09:37 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.