KColorSchemeManager

Search for usage in LXR

#include <KColorSchemeManager>

Inheritance diagram for KColorSchemeManager:

Public Slots

void activateScheme (const QModelIndex &index)
 

Public Member Functions

 KColorSchemeManager (QObject *parent=nullptr)
 
QString activeSchemeId () const
 
QString activeSchemeName () const
 
QModelIndex indexForScheme (const QString &name) const
 
QModelIndex indexForSchemeId (const QString &id) const
 
QAbstractItemModelmodel () const
 
void saveSchemeToConfigFile (const QString &schemeName) const
 
void setAutosaveChanges (bool autosaveChanges)
 
- 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 KColorSchemeManagerinstance ()
 
- 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
 
- Properties inherited from QObject
 objectName
 
- 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

A small helper to get access to all available color schemes and activating a scheme in the QApplication.

This is useful for applications which want to provide a selection of custom color schemes to their user. For example it is very common for photo and painting applications to use a dark color scheme even if the default is a light scheme. Since version 5.67 it also allows going back to following the system color scheme.

The model() member function provides access to the KColorSchemeModel that the KColorSchemeManager uses which holds all the available color schemes. A possible usage looks like the following:

QListView *view = new QListView(this);
view->setModel(schemes->model());
A small helper to get access to all available color schemes and activating a scheme in the QApplicati...
QAbstractItemModel * model() const
A QAbstractItemModel of all available color schemes.
void activateScheme(const QModelIndex &index)
Activates the KColorScheme identified by the provided index.
void activated(const QModelIndex &index)
virtual void setModel(QAbstractItemModel *model)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)

A convenience function that creates a KActionMenu that contains and activates color schemes exists in KColorSchemeMenu::createMenu

By default KColorSchemeManager remembers the activated color scheme and restores it on the next start of the application. Use setAutosaveChanges() to change this behavior.

See also
KColorSchemeMenu::createMenu, KColorSchemeModel
Since
5.0

Definition at line 53 of file kcolorschememanager.h.

Constructor & Destructor Documentation

◆ KColorSchemeManager()

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

Definition at line 110 of file kcolorschememanager.cpp.

◆ ~KColorSchemeManager()

KColorSchemeManager::~KColorSchemeManager ( )
override

Definition at line 118 of file kcolorschememanager.cpp.

Member Function Documentation

◆ activateScheme

void KColorSchemeManager::activateScheme ( const QModelIndex & index)
slot

Activates the KColorScheme identified by the provided index.

Installs the KColorScheme as the QApplication's QPalette.

Parameters
indexThe index for the KColorScheme to activate. The index must reference the QAbstractItemModel provided by model. Since version 5.67 passing an invalid index activates the system scheme.
See also
model()

Definition at line 207 of file kcolorschememanager.cpp.

◆ activeSchemeId()

QString KColorSchemeManager::activeSchemeId ( ) const

Returns the id of the currently active scheme or an empty string if the default scheme is active.

Since
5.107

Definition at line 234 of file kcolorschememanager.cpp.

◆ activeSchemeName()

QString KColorSchemeManager::activeSchemeName ( ) const

Returns the name of the currently active scheme or an empty string if the default scheme is active.

Since
6.6

Definition at line 239 of file kcolorschememanager.cpp.

◆ indexForScheme()

QModelIndex KColorSchemeManager::indexForScheme ( const QString & name) const

Returns the model index for the scheme with the given name.

If no such scheme exists an invalid index is returned. If you pass an empty string the index that is equivalent to going back to following the system scheme is returned for versions 5.67 and newer.

See also
model

Definition at line 192 of file kcolorschememanager.cpp.

◆ indexForSchemeId()

QModelIndex KColorSchemeManager::indexForSchemeId ( const QString & id) const

Returns the model index for the scheme with the given id.

If no such scheme exists an invalid index is returned. If you pass an empty string the index returned is equivalent to going back to following the system scheme.

See also
model
Since
6.6

Definition at line 183 of file kcolorschememanager.cpp.

◆ instance()

KColorSchemeManager * KColorSchemeManager::instance ( )
static

Returns the manager for the current application instance.

If no instance is existing, it will be constructed. Must be called after construction of the gui application instance.

Returns
color scheme manager for the current application instance
Since
6.6

Definition at line 244 of file kcolorschememanager.cpp.

◆ model()

QAbstractItemModel * KColorSchemeManager::model ( ) const

A QAbstractItemModel of all available color schemes.

The model provides the name of the scheme in Qt::DisplayRole, a preview in Qt::DelegateRole and the full path to the scheme file in Qt::UserRole. The system theme has an empty Qt::UserRole.

Returns
Model of all available color schemes.
See also
KColorSchemeModel

Definition at line 162 of file kcolorschememanager.cpp.

◆ saveSchemeToConfigFile()

void KColorSchemeManager::saveSchemeToConfigFile ( const QString & schemeName) const

Saves the color scheme to config file.

The scheme is saved by default whenever it's changed. Use this method when autosaving is turned off, see setAutosaveChanges().

Since
5.89

Definition at line 226 of file kcolorschememanager.cpp.

◆ setAutosaveChanges()

void KColorSchemeManager::setAutosaveChanges ( bool autosaveChanges)

Sets color scheme autosaving.

Default value is true. If this is set to false, the scheme is not going to be remembered when the application is restarted.

Parameters
autosaveChangesEnables/Disables autosaving of the color scheme.
Since
5.89

Definition at line 178 of file kcolorschememanager.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 Oct 4 2024 12:06:07 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.