41 : m_propertyName( propertyName )
45 inline const T& resolveValue()
const
50 void setResolveValue(
const T& value )
55 bool visitDown( QObject*
object )
override final
57 if (
auto control = qobject_cast< QskControl* >(
object ) )
58 return setImplicitValue( control, m_value );
60 if (
auto window = qobject_cast< QskWindow* >(
object ) )
61 return setImplicitValue( window, m_value );
63 return !setProperty(
object, m_propertyName.constData(), m_value );
66 bool visitUp(
const QObject*
object )
override final
68 if ( isRoot(
object ) )
71 if (
auto control = qobject_cast< const QskControl* >(
object ) )
73 m_value = value( control );
77 if (
auto window = qobject_cast< const QskWindow* >(
object ) )
79 m_value = value( window );
83 return getProperty(
object, m_propertyName, m_value );
87 inline bool getProperty(
const QObject*
object,
88 const char* name, T& value )
const
90 if ( !m_propertyName.isEmpty() )
92 const QVariant v =
object->property( name );
93 if ( v.canConvert< T >() )
95 value = qvariant_cast< T >( v );
103 inline bool setProperty( QObject*
object,
104 const char* name,
const T& value )
const
107 if ( !getProperty(
object, name, oldValue ) || oldValue == value )
110 object->setProperty( name, value );
114 virtual bool setImplicitValue(
QskControl*,
const T& ) = 0;
115 virtual bool setImplicitValue(
QskWindow*,
const T& ) = 0;
117 virtual T value(
const QskControl* )
const = 0;
118 virtual T value(
const QskWindow* )
const = 0;
121 const QByteArray m_propertyName;