CSDControls

Search for usage in LXR

#include <csdcontrols.h>

Inheritance diagram for CSDControls:

Properties

var buttonsModel
 
bool canMaximize
 
bool canMinimize
 
bool enabled
 
bool isActiveWindow
 
bool maximized
 
QStringList rightWindowControls
 
QUrl source
 
QString styleName
 
- Properties inherited from QObject
 objectName
 

Signals

void buttonClicked (var type)
 
void enableCSDChanged ()
 
void sourceChanged ()
 
void styleNameChanged ()
 

Public Member Functions

 CSDControls (QObject *parent=nullptr)
 
bool enableCSD () const
 
QObjectqmlInstance (QQmlEngine *engine, QJSEngine *scriptEngine)
 
void resetEnableCSD ()
 
void setEnableCSD (const bool &value)
 
QUrl source () const
 
QString styleName () 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 event (QEvent *e)
 
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
 

Static Public Member Functions

static CSDControlsinstance ()
 
- 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)
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- 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)
 

Detailed Description

The client-side-decorations manager for the MauiKit application.

CSD Window control buttons.

Since
org.mauikit.controls
Warning
This is an implementation template for the CSD window control buttons, for a complete and final implementation please use the WindowControls component.
See also
WindowControlsLinux

Notes

Customize

The window control buttons can be customized, by creating a new theme of button assets, or by picking one from the existing ones.

Creating a new theme is simple. There is three important aspects:

  • The config file where the relative paths to the image assets is described.

The following snippet is an example of a config file for the Nitrux CSD theme. The file name must be named 'config.conf'

[Close]
Normal=close.svg
Hover=close-hover.svg
Pressed=close-pressed.svg
Backdrop=close-backdrop.svg
[Maximize]
Normal=maximize.svg
Hover=maximize-hover.svg
Pressed=maximize-pressed.svg
Backdrop=maximize-backdrop.svg
[Restore]
Normal=restore.svg
Hover=restore-hover.svg
Pressed=restore-pressed.svg
Backdrop=restore-backdrop.svg
[Minimize]
Normal=minimize.svg
Hover=minimize-hover.svg
Pressed=minimize-pressed.svg
Backdrop=minimize-backdrop.svg
[FullScreen]
Normal=fullscreen.svg
[Decoration]
BorderRadius=8
Source=CSD.qml
  • The second part is the QML source file, named CSD.qml by convection. If the theme you imagine is not that different from the regular layout, the following snippet of code will do it.

The code consists of a horizontal row layout, where we feed the buttons model and set the component delegate to draw the button.

See also
CSDButton
Control
{
id: control
implicitHeight: _layout.implicitHeight + topPadding + bottomPadding
implicitWidth: _layout.implicitWidth + leftPadding + rightPadding
spacing: Maui.Style.space.small
padding: Maui.Style.defaultPadding
background: null
contentItem: Row
{
id: _layout
spacing: control.spacing
ToolSeparator
{
height: 8
anchors.verticalCenter: parent.verticalCenter
}
Repeater
{
model: buttonsModel
delegate: pluginButton
}
}
Component
{
id: pluginButton
AbstractButton
{
id: _button
visible: modelData === "A" ? canMaximize : true
hoverEnabled: true
implicitWidth: 22
implicitHeight: 22
focusPolicy: Qt.NoFocus
Maui.CSDButton
{
id: button
style: "Nitrux"
type: mapType(modelData)
isHovered: _button.hovered
isPressed: _button.pressed
isFocused: isActiveWindow
isMaximized: maximized
}
contentItem: Maui.Icon
{
smooth: true
source: button.source
color: Maui.Theme.textColor
Behavior on color
{
Maui.ColorTransition{}
}
}
onClicked:
{
console.log("NITRUX CSD BUTTON CLICKED", button.type)
buttonClicked(button.type)
}
}
}
}
void buttonClicked(var type)
A window control button has been clicked.
QUrl source
The source file path of the style being used.
Type type(const QSqlDatabase &db)
QObject * parent() const const
  • And the last part are the actual image assets for the buttons.

Definition at line 211 of file csdcontrols.h.

Property Documentation

◆ buttonsModel

var CSDControls::buttonsModel
read
Remarks
This property is read-only

Definition at line 161 of file CSDControls.qml.

◆ canMaximize

bool CSDControls::canMaximize
read
Remarks
This property is read-only

Definition at line 155 of file CSDControls.qml.

◆ canMinimize

bool CSDControls::canMinimize
read
Remarks
This property is read-only

Definition at line 158 of file CSDControls.qml.

◆ enabled

bool CSDControls::enabled
readwrite

Whether the application shall use CSD (client side decorations).

Note
This property by default uses the MauiMan global preference, but can it be overridden. To reset it back to the original system preference value set it to undefined.

Definition at line 225 of file csdcontrols.h.

◆ isActiveWindow

bool CSDControls::isActiveWindow
read

Definition at line 152 of file CSDControls.qml.

◆ maximized

bool CSDControls::maximized
read

Definition at line 150 of file CSDControls.qml.

◆ rightWindowControls

QStringList CSDControls::rightWindowControls

The model of the window control buttons to be shown, and the order in which they should appear in the right side.

Although the WindowControlsLinux type can be placed arbitrary, it is strongly suggested to always placed them in a right-side area

Definition at line 243 of file csdcontrols.h.

◆ source

QUrl CSDControls::source
read

The source file path of the style being used.

Definition at line 230 of file csdcontrols.h.

◆ styleName

QString CSDControls::styleName
read

The name of the style/theme being used.

This is picked up from the global MauiMan preferences and can not be overridden by the application. This preference is exposed to the end user in the Maui Settings.

Definition at line 237 of file csdcontrols.h.

Constructor & Destructor Documentation

◆ CSDControls()

CSDControls::CSDControls ( QObject * parent = nullptr)
explicit

Definition at line 13 of file csdcontrols.cpp.

Member Function Documentation

◆ buttonClicked

void CSDControls::buttonClicked ( var type)
signal

A window control button has been clicked.

This signal is public and can be mapped to any arbitrary value. Be carefull.

◆ enableCSD()

bool CSDControls::enableCSD ( ) const

Definition at line 96 of file csdcontrols.cpp.

◆ instance()

CSDControls * CSDControls::instance ( )
static

Retrieves the single instance of MauiApp.

Definition at line 351 of file csdcontrols.cpp.

◆ qmlInstance()

QObject * CSDControls::qmlInstance ( QQmlEngine * engine,
QJSEngine * scriptEngine )
inline

Definition at line 266 of file csdcontrols.h.

◆ resetEnableCSD()

void CSDControls::resetEnableCSD ( )

Definition at line 111 of file csdcontrols.cpp.

◆ setEnableCSD()

void CSDControls::setEnableCSD ( const bool & value)

Definition at line 101 of file csdcontrols.cpp.

◆ styleName()

QString CSDControls::styleName ( ) const

Definition at line 122 of file csdcontrols.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:12:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.