This commit is contained in:
zhuzichu 2024-01-17 14:00:20 +08:00
parent 4cfd14e9bd
commit 0f3910c96b
4 changed files with 66 additions and 32 deletions

View File

@ -14,8 +14,24 @@ public:
{ \ { \
return _##M; \ return _##M; \
} \ } \
\
private: \ private: \
TYPE _##M; 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 #endif // STDAFX_H

View File

@ -4,6 +4,7 @@ import FluentUI 1.0
T.Slider { T.Slider {
property bool tooltipEnabled: true property bool tooltipEnabled: true
property string text: String(control.value)
id: control id: control
to:100 to:100
stepSize:1 stepSize:1
@ -68,6 +69,6 @@ T.Slider {
FluTooltip{ FluTooltip{
parent: control.handle parent: control.handle
visible: control.tooltipEnabled && (control.pressed || control.hovered) visible: control.tooltipEnabled && (control.pressed || control.hovered)
text:String(control.value) text:control.text
} }
} }

View File

@ -5,6 +5,7 @@ import FluentUI
T.Slider { T.Slider {
property bool tooltipEnabled: true property bool tooltipEnabled: true
property string text: String(control.value)
id: control id: control
to:100 to:100
stepSize:1 stepSize:1
@ -69,6 +70,6 @@ T.Slider {
FluTooltip{ FluTooltip{
parent: control.handle parent: control.handle
visible: control.tooltipEnabled && (control.pressed || control.hovered) visible: control.tooltipEnabled && (control.pressed || control.hovered)
text:String(control.value) text:control.text
} }
} }

View File

@ -14,8 +14,24 @@ public:
{ \ { \
return _##M; \ return _##M; \
} \ } \
\
private: \ private: \
TYPE _##M; 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 #endif // STDAFX_H