Kirigami::Platform::StyleHints Class

class Kirigami::Platform::StyleHints

A class providing an attached property to set hints for styles to use. More...

Header: #include <Kirigami/Platform/StyleHints>
CMake: find_package(KF6 REQUIRED COMPONENTS KirigamiPlatform)
target_link_libraries(mytarget PRIVATE KF6::KirigamiPlatform)
In QML: StyleHints

Public Functions

QString iconName() const
QUrl iconSource() const
void setIconName(const QString &newIconName)
void setIconSource(const QUrl &newIconSource)
void setShowFramedBackground(bool newShowFramedBackground)
void setTickMarkStepSize(int newTickMarkStepSize)
void setUseAlternateBackgroundColor(bool newUseAlternateBackgroundColor)
bool showFramedBackground() const
int tickMarkStepSize() const
bool useAlternateBackgroundColor() const

Signals

Static Public Members

void setMakeStyleHintsFunction(const std::function<StyleHints *(QObject *)> &function)

Protected Functions

virtual void propertyChanged(Kirigami::Platform::StyleHints::ChangedProperty change)

Detailed Description

This is mostly a class for QtQuick API. However, if you need to trigger specific behaviour in a custom style, you can call setMakeStyleHintsFunction() with a custom factory function to create a custom subclass of this class. The subclass can then respond to property changes of instances of this class.

Member Function Documentation

[virtual protected] void StyleHints::propertyChanged(Kirigami::Platform::StyleHints::ChangedProperty change)

Helper function to notify subclasses of a property change.

Reimplement this in a subclass to handle a change to one of the properties, without the overhead of making separate signal connections for each property.

[static] void StyleHints::setMakeStyleHintsFunction(const std::function<StyleHints *(QObject *)> &function)

Set a different function to be used by qmlAttachedProperties() to create a StyleHints instance.

This is provided to allow different platform plugins to provide their own StyleHints subclass.

\todoKF7: This should really be part of PlatformPluginFactory but we cannot add new virtuals to it due to binary compatibility. Once we break binary compatibility, move this to PlatformPluginFactory.