diff --git a/example/src/stdafx.h b/example/src/stdafx.h index b0fd29a0..4b4d821c 100644 --- a/example/src/stdafx.h +++ b/example/src/stdafx.h @@ -2,20 +2,36 @@ #define STDAFX_H #define Q_PROPERTY_AUTO(TYPE, M) \ - Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ -public: \ - Q_SIGNAL void M##Changed(); \ - void M(TYPE in_##M) \ - { \ - _##M = in_##M; \ - Q_EMIT M##Changed(); \ - } \ - TYPE M() \ - { \ - return _##M; \ - } \ - \ -private: \ - TYPE _##M; +Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(TYPE in_##M) \ +{ \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ +} \ + TYPE M() \ +{ \ + return _##M; \ +} \ + private: \ + TYPE _##M; \ + + +#define Q_PROPERTY_READONLY_AUTO(TYPE, M) \ +Q_PROPERTY(TYPE M READ M NOTIFY M##Changed FINAL) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(TYPE in_##M) \ +{ \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ +} \ + TYPE M() \ +{ \ + return _##M; \ +} \ + private: \ + TYPE _##M; \ #endif // STDAFX_H diff --git a/src/Qt5/imports/FluentUI/Controls/FluSlider.qml b/src/Qt5/imports/FluentUI/Controls/FluSlider.qml index 7cf14706..eed64624 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluSlider.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluSlider.qml @@ -4,6 +4,7 @@ import FluentUI 1.0 T.Slider { property bool tooltipEnabled: true + property string text: String(control.value) id: control to:100 stepSize:1 @@ -68,6 +69,6 @@ T.Slider { FluTooltip{ parent: control.handle visible: control.tooltipEnabled && (control.pressed || control.hovered) - text:String(control.value) + text:control.text } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluSlider.qml b/src/Qt6/imports/FluentUI/Controls/FluSlider.qml index fa32c591..7b0be429 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluSlider.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluSlider.qml @@ -5,6 +5,7 @@ import FluentUI T.Slider { property bool tooltipEnabled: true + property string text: String(control.value) id: control to:100 stepSize:1 @@ -69,6 +70,6 @@ T.Slider { FluTooltip{ parent: control.handle visible: control.tooltipEnabled && (control.pressed || control.hovered) - text:String(control.value) + text:control.text } } diff --git a/src/stdafx.h b/src/stdafx.h index b0fd29a0..4b4d821c 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -2,20 +2,36 @@ #define STDAFX_H #define Q_PROPERTY_AUTO(TYPE, M) \ - Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ -public: \ - Q_SIGNAL void M##Changed(); \ - void M(TYPE in_##M) \ - { \ - _##M = in_##M; \ - Q_EMIT M##Changed(); \ - } \ - TYPE M() \ - { \ - return _##M; \ - } \ - \ -private: \ - TYPE _##M; +Q_PROPERTY(TYPE M MEMBER _##M NOTIFY M##Changed) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(TYPE in_##M) \ +{ \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ +} \ + TYPE M() \ +{ \ + return _##M; \ +} \ + private: \ + TYPE _##M; \ + + +#define Q_PROPERTY_READONLY_AUTO(TYPE, M) \ +Q_PROPERTY(TYPE M READ M NOTIFY M##Changed FINAL) \ + public: \ + Q_SIGNAL void M##Changed(); \ + void M(TYPE in_##M) \ +{ \ + _##M = in_##M; \ + Q_EMIT M##Changed(); \ +} \ + TYPE M() \ +{ \ + return _##M; \ +} \ + private: \ + TYPE _##M; \ #endif // STDAFX_H