20 #include "childproperty.h" 25 #include <tqsizepolicy.h> 32 const TQString &description,
const TQVariant &value,
bool save,
bool readOnly)
33 :
Property(type, name, description, value, save, readOnly), m_parent(parent), m_childType(childType)
38 const TQMap<TQString, TQVariant> &v_valueList,
const TQString &
description,
40 :
Property(name, v_valueList, description, value, save, readOnly), m_parent(parent), m_childType(childType)
47 tqWarning(
"ChildProperty::setValue");
48 if (!m_parent->
valid())
50 switch (m_parent->
type())
54 tqWarning(
"ChildProperty::setValue for TQSize");
55 TQSize v = m_parent->
value().toSize();
56 if (m_childType == Size_Height)
57 v.setHeight(value.toInt());
58 else if (m_childType == Size_Width)
59 v.setWidth(value.toInt());
65 tqWarning(
"ChildProperty::setValue for TQPoint");
66 TQPoint v = m_parent->
value().toPoint();
67 if (m_childType == Point_X)
68 v.setX(value.toInt());
69 else if (m_childType == Point_Y)
70 v.setY(value.toInt());
76 tqWarning(
"ChildProperty::setValue for TQRect");
77 TQRect v = m_parent->
value().toRect();
78 if (m_childType == Rect_X)
79 v.setX(value.toInt());
80 else if (m_childType == Rect_Y)
81 v.setY(value.toInt());
82 else if (m_childType == Rect_Width)
83 v.setWidth(value.toInt());
84 else if (m_childType == Rect_Height)
85 v.setHeight(value.toInt());
91 tqWarning(
"ChildProperty::setValue for TQSizePolicy");
92 TQSizePolicy v = m_parent->
value().toSizePolicy();
93 if (m_childType == SizePolicy_HorData)
94 v.setHorData(TQSizePolicy::SizeType(value.toInt()));
95 else if (m_childType == SizePolicy_VerData)
96 v.setVerData(TQSizePolicy::SizeType(value.toInt()));
97 else if (m_childType == SizePolicy_HorStretch)
98 v.setHorStretch(value.toInt());
99 else if (m_childType == SizePolicy_VerStretch)
100 v.setVerStretch(value.toInt());
109 if (!m_parent->
valid())
111 switch (m_parent->
type())
114 if (m_childType == Size_Height)
115 return m_parent->
value().toSize().height();
116 else if (m_childType == Size_Width)
117 return m_parent->
value().toSize().width();
119 if (m_childType == Point_X)
120 return m_parent->
value().toPoint().x();
121 else if (m_childType == Point_Y)
122 return m_parent->
value().toPoint().y();
124 if (m_childType == Rect_X)
125 return m_parent->
value().toRect().x();
126 else if (m_childType == Rect_Y)
127 return m_parent->
value().toRect().y();
128 else if (m_childType == Rect_Width)
129 return m_parent->
value().toRect().width();
130 else if (m_childType == Rect_Height)
131 return m_parent->
value().toRect().height();
133 if (m_childType == SizePolicy_HorData)
134 return m_parent->
value().toSizePolicy().horData();
135 else if (m_childType == SizePolicy_VerData)
136 return m_parent->
value().toSizePolicy().verData();
137 else if (m_childType == SizePolicy_HorStretch)
138 return m_parent->
value().toSizePolicy().horStretch();
139 else if (m_childType == SizePolicy_VerStretch)
140 return m_parent->
value().toSizePolicy().verStretch();
size policy (horizontal, vertical)
virtual TQString description() const
Namespace which contain property editing classes.
bool valid() const
Returns true if the multiproperty has no properties in the list (i.e.
int type() const
Returns the type of a property.
Contains PropertyLib::MultiProperty class.
virtual bool readOnly() const
Tells if the property is read only.
TQVariant value() const
Returns the value of a property.
void setValue(const TQVariant &value)
Sets the value of a property.
virtual TQString name() const
ChildProperty()
Constructs empty property.
Holds a list of properties with the same name and type.
virtual TQVariant value() const
rectangle (x,y, width, height)
virtual void setValue(const TQVariant &value, bool rememberOldValue=true)
Sets the value of the property.