| basic |
|
|
- |
| CMakeLists.txt |
|
4040 |
- |
| configure.cmake |
|
2607 |
- |
| designer |
|
|
- |
| doc |
|
|
- |
| fluentwinui3 |
|
|
- |
| fusion |
|
|
- |
| imagine |
|
|
- |
| ios |
|
|
- |
| macos |
|
|
- |
| material |
|
|
- |
| native |
|
|
- |
| qmldir |
|
73 |
- |
| qquickattachedpropertypropagator.cpp |
!
\class QQuickAttachedPropertyPropagator
\brief The QQuickAttachedPropertyPropagator class provides a way to
propagate attached properties.
\inmodule QtQuickControls2
\since 6.5
In QML, it is possible to
\l {Attached Properties and Attached Signal Handlers}{attach properties and
signal handlers} to objects. \l {Providing Attached Properties} goes into more
detail about how to expose your own C++ attached types.
QQuickAttachedPropertyPropagator provides an API to propagate attached
properties from a parent object to its children, similar to
\l {Control::}{font} and \l {Item::}{palette} propagation. It supports
propagation through \l {Item}{items}, \l {Popup}{popups}, and
\l {Window}{windows}.
If propagation of properties is not important, consider using a
\l {QML_SINGLETON}{C++} or
\l {Contents of a Module Definition qmldir File}{QML} singleton instead,
as it is better suited for that use case, and is more efficient in that
it only requires one QObject.
To implement a custom attached property:
\list 1
\li Derive a class that exposes the attached property from
QQuickAttachedPropertyPropagator.
For example, to implement an attached \c {MyStyle.theme} property,
declare the \c {MyStyle} class:
\quotefromfile ../../examples/quickcontrols/attachedstyleproperties/MyStyle/mystyle.h
\skipto class
\printto {
\li Call \l initialize() in the constructor of your class:
\quotefromfile ../../examples/quickcontrols/attachedstyleproperties/MyStyle/mystyle.cpp
\skipto MyStyle::MyStyle
\printuntil }
\li Define set/inherit/propagate/reset functions for the attached property
as needed. For example, to define a \c theme attached property:
\quotefromfile ../../examples/quickcontrols/attachedstyleproperties/MyStyle/mystyle.cpp
\skipto theme()
\printto MyStyle::themeChange()
\li Reimplement \l attachedParentChange() to handle property inheritance:
\quotefromfile ../../examples/quickcontrols/attachedstyleproperties/MyStyle/mystyle.cpp
\skipto attachedParentChange
\printuntil /^\}/
\li Implement a static \c qmlAttachedProperties function and declare the
type as an attached QML type with \l QML_ELEMENT and \l QML_ATTACHED,
as detailed in \l {Providing Attached Properties}:
\quotefromfile ../../examples/quickcontrols/attachedstyleproperties/MyStyle/mystyle.cpp
\skipto qmlAttachedProperties
\printuntil }
\endlist
The complete implementation is available in
\l {Qt Quick Controls - Attached Style Properties Example}.
\sa {Styling Qt Quick Controls}
|
21891 |
- |
| qquickattachedpropertypropagator.h |
|
1202 |
- |
| qquickstyle.cpp |
!
\class QQuickStyle
\brief The QQuickStyle class allows configuring the application style.
\inmodule QtQuickControls2
\since 5.7
QQuickStyle provides API for querying and configuring the application
\l {Styling Qt Quick Controls}{styles} of Qt Quick Controls.
\code
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickStyle>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQuickStyle::setStyle("Material");
QQmlApplicationEngine engine;
engine.load(QUrl("qrc:/main.qml"));
return app.exec();
}
\endcode
\note The style must be configured \b before loading QML that imports
Qt Quick Controls. It is not possible to change the style after the QML
types have been registered.
\note QQuickStyle is not supported when using
\l {Compile-Time Style Selection}{compile-time style selection}.
To create your own custom style, see \l {Creating a Custom Style}. Custom
styles do not need to implement all controls. By default, the styling
system uses the \l {Basic style} as a fallback for controls that a custom
style does not provide. It is possible to specify a different fallback
style to customize or extend one of the built-in styles.
\code
QQuickStyle::setStyle("MyStyle");
QQuickStyle::setFallbackStyle("Material");
\endcode
\sa {Styling Qt Quick Controls}
|
16303 |
- |
| qquickstyle.h |
|
594 |
- |
| qquickstyle_p.h |
|
1421 |
- |
| qquickstyleplugin.cpp |
|
8067 |
- |
| qquickstyleplugin_p.h |
|
1415 |
- |
| qt_cmdline.cmake |
|
708 |
- |
| qtquickcontrols2global.h |
|
485 |
- |
| qtquickcontrols2plugin.cpp |
|
11879 |
- |
| quicknativestyle |
|
|
- |
| universal |
|
|
- |
| windows |
|
|
- |