KDecoration2::DecorationButton

Search for usage in LXR

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 ()
 
void update (const QRectF &rect)
 

Public Member Functions

Qt::MouseButtons acceptedButtons () const
 
bool contains (const QPointF &pos) const
 
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)
 
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

 DecorationButton (DecorationButtonType type, 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

- 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

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 40 of file decorationbutton.h.

Property Documentation

◆ acceptedButtons

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 80 of file decorationbutton.h.

◆ checkable

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 65 of file decorationbutton.h.

◆ checked

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 71 of file decorationbutton.h.

◆ enabled

bool KDecoration2::DecorationButton::enabled
readwrite

Whether the DecorationButton is enabled.

Only an enabled button accepts hover and mouse press events.

Definition at line 60 of file decorationbutton.h.

◆ geometry

QRectF KDecoration2::DecorationButton::geometry
read

The geometry of the DecorationButton in Decoration-local coordinates.

Definition at line 75 of file decorationbutton.h.

◆ hovered

bool KDecoration2::DecorationButton::hovered
read

Whether the DecorationButton is currently hovered.

Definition at line 55 of file decorationbutton.h.

◆ pressed

bool KDecoration2::DecorationButton::pressed
read

Whether the DecorationButton is currently pressed.

Definition at line 51 of file decorationbutton.h.

◆ visible

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 47 of file decorationbutton.h.

Constructor & Destructor Documentation

◆ DecorationButton()

KDecoration2::DecorationButton::DecorationButton ( DecorationButtonType type,
Decoration * decoration,
QObject * parent = nullptr )
explicitprotected

Definition at line 342 of file decorationbutton.cpp.

Member Function Documentation

◆ acceptedButtons()

Qt::MouseButtons KDecoration2::DecorationButton::acceptedButtons ( ) const

Definition at line 441 of file decorationbutton.cpp.

◆ contains()

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

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

Definition at line 485 of file decorationbutton.cpp.

◆ decoration()

Decoration * KDecoration2::DecorationButton::decoration ( ) const

Definition at line 436 of file decorationbutton.cpp.

◆ event()

bool KDecoration2::DecorationButton::event ( QEvent * event)
overridevirtual

Reimplemented from QObject.

Definition at line 491 of file decorationbutton.cpp.

◆ geometry()

QRectF KDecoration2::DecorationButton::geometry ( ) const

Definition at line 431 of file decorationbutton.cpp.

◆ hoverEnterEvent()

void KDecoration2::DecorationButton::hoverEnterEvent ( QHoverEvent * event)
protectedvirtual

Definition at line 520 of file decorationbutton.cpp.

◆ hoverLeaveEvent()

void KDecoration2::DecorationButton::hoverLeaveEvent ( QHoverEvent * event)
protectedvirtual

Definition at line 529 of file decorationbutton.cpp.

◆ hoverMoveEvent()

void KDecoration2::DecorationButton::hoverMoveEvent ( QHoverEvent * event)
protectedvirtual

Definition at line 538 of file decorationbutton.cpp.

◆ isCheckable()

bool KDecoration2::DecorationButton::isCheckable ( ) const

Definition at line 421 of file decorationbutton.cpp.

◆ isChecked()

bool KDecoration2::DecorationButton::isChecked ( ) const

Definition at line 416 of file decorationbutton.cpp.

◆ isEnabled()

bool KDecoration2::DecorationButton::isEnabled ( ) const

Definition at line 411 of file decorationbutton.cpp.

◆ isHovered()

bool KDecoration2::DecorationButton::isHovered ( ) const

Definition at line 406 of file decorationbutton.cpp.

◆ isPressed()

bool KDecoration2::DecorationButton::isPressed ( ) const

Definition at line 401 of file decorationbutton.cpp.

◆ isVisible()

bool KDecoration2::DecorationButton::isVisible ( ) const

Definition at line 426 of file decorationbutton.cpp.

◆ mouseMoveEvent()

void KDecoration2::DecorationButton::mouseMoveEvent ( QMouseEvent * event)
protectedvirtual

Definition at line 543 of file decorationbutton.cpp.

◆ mousePressEvent()

void KDecoration2::DecorationButton::mousePressEvent ( QMouseEvent * event)
protectedvirtual

Definition at line 554 of file decorationbutton.cpp.

◆ mouseReleaseEvent()

void KDecoration2::DecorationButton::mouseReleaseEvent ( QMouseEvent * event)
protectedvirtual

Definition at line 574 of file decorationbutton.cpp.

◆ paint()

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

◆ setAcceptedButtons()

void KDecoration2::DecorationButton::setAcceptedButtons ( Qt::MouseButtons buttons)

Definition at line 451 of file decorationbutton.cpp.

◆ setCheckable

void KDecoration2::DecorationButton::setCheckable ( bool checkable)
slot

Definition at line 466 of file decorationbutton.cpp.

◆ setChecked

void KDecoration2::DecorationButton::setChecked ( bool checked)
slot

Definition at line 461 of file decorationbutton.cpp.

◆ setEnabled

void KDecoration2::DecorationButton::setEnabled ( bool enabled)
slot

Definition at line 456 of file decorationbutton.cpp.

◆ setGeometry()

void KDecoration2::DecorationButton::setGeometry ( const QRectF & geometry)

Definition at line 476 of file decorationbutton.cpp.

◆ setVisible

void KDecoration2::DecorationButton::setVisible ( bool visible)
slot

Definition at line 471 of file decorationbutton.cpp.

◆ size()

QSizeF KDecoration2::DecorationButton::size ( ) const

Definition at line 396 of file decorationbutton.cpp.

◆ type()

DecorationButtonType KDecoration2::DecorationButton::type ( ) const

Definition at line 446 of file decorationbutton.cpp.

◆ update [1/2]

void KDecoration2::DecorationButton::update ( )
slot

Schedules a repaint of the DecorationButton.

Overloaded method for convenience.

Definition at line 391 of file decorationbutton.cpp.

◆ update [2/2]

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 386 of file decorationbutton.cpp.

◆ wheelEvent()

void KDecoration2::DecorationButton::wheelEvent ( QWheelEvent * event)
protectedvirtual

Definition at line 594 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-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.