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

@ -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

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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