95 Q_UNUSED(src); |
95 Q_UNUSED(src); |
96 Q_UNUSED(dst); |
96 Q_UNUSED(dst); |
97 |
97 |
98 HbAnchor* anchor = new HbAnchor( srcId, srcEdge, dstId, dstEdge ); |
98 HbAnchor* anchor = new HbAnchor( srcId, srcEdge, dstId, dstEdge ); |
99 |
99 |
100 if ( minLength.mType != HbXmlLengthValue::None ) { |
100 if ( minLength.mValues.count() ) { |
101 qreal minVal(0); |
101 qreal minVal(0); |
102 if ( !toPixels(minLength, minVal) ) { |
102 if ( !toPixels(minLength, minVal) ) { |
103 delete anchor; |
103 delete anchor; |
104 return false; |
104 return false; |
105 } else { |
105 } else { |
106 anchor->setMinimumLength( minVal ); |
106 anchor->setMinimumLength( minVal ); |
107 } |
107 } |
108 } |
108 } |
109 |
109 |
110 if ( prefLength.mType != HbXmlLengthValue::None ) { |
110 if ( prefLength.mValues.count() ) { |
111 qreal prefVal(0); |
111 qreal prefVal(0); |
112 if ( !toPixels(prefLength, prefVal) ) { |
112 if ( !toPixels(prefLength, prefVal) ) { |
113 delete anchor; |
113 delete anchor; |
114 return false; |
114 return false; |
115 } else { |
115 } else { |
116 // if the expression resulted a negative result, we must reverse the direction |
116 // if the expression resulted a negative result, we must reverse the direction |
117 if ( prefLength.mType == HbXmlLengthValue::Expression && prefVal < 0 && dir ) { |
117 if ( prefVal < 0 && dir ) { |
118 *dir = (*dir==HbAnchor::Positive) ? HbAnchor::Negative : HbAnchor::Positive; |
118 *dir = (*dir==HbAnchor::Positive) ? HbAnchor::Negative : HbAnchor::Positive; |
119 } |
119 } |
120 anchor->setPreferredLength( qAbs(prefVal) ); |
120 anchor->setPreferredLength( qAbs(prefVal) ); |
121 } |
121 } |
122 } |
122 } |
123 |
123 |
124 if ( maxLength.mType != HbXmlLengthValue::None ) { |
124 if ( maxLength.mValues.count() ) { |
125 qreal maxVal(0); |
125 qreal maxVal(0); |
126 if ( !toPixels(maxLength, maxVal) ) { |
126 if ( !toPixels(maxLength, maxVal) ) { |
127 delete anchor; |
127 delete anchor; |
128 return false; |
128 return false; |
129 } else { |
129 } else { |
201 HbWidgetLoader::AnchorItem item(mLayoutDef->type); |
201 HbWidgetLoader::AnchorItem item(mLayoutDef->type); |
202 item.srcId = srcId; |
202 item.srcId = srcId; |
203 item.dstId = dstId; |
203 item.dstId = dstId; |
204 item.srcEdge = srcEdge; |
204 item.srcEdge = srcEdge; |
205 item.dstEdge = dstEdge; |
205 item.dstEdge = dstEdge; |
206 item.minType = minLength.mType; |
206 |
207 item.minVal = minLength.mValue; |
207 for (int i=0; i<minLength.mValues.count(); i++) { |
208 item.minHashValue = minLength.mHashValue; |
208 item.minVal.append(minLength.mValues.at(i)); |
209 item.minText = minLength.mString; |
209 } |
210 item.prefType = prefLength.mType; |
210 for (int j=0; j<prefLength.mValues.count(); j++) { |
211 item.prefVal = prefLength.mValue; |
211 item.prefVal.append(prefLength.mValues.at(j)); |
212 item.prefHashValue = prefLength.mHashValue; |
212 } |
213 item.prefText = prefLength.mString; |
213 for (int k=0; k<maxLength.mValues.count(); k++) { |
214 item.maxType = maxLength.mType; |
214 item.maxVal.append(maxLength.mValues.at(k)); |
215 item.maxVal = maxLength.mValue; |
215 } |
216 item.maxHashValue = maxLength.mHashValue; |
216 |
217 item.maxText = maxLength.mString; |
|
218 item.sizepolicy = policy ? *policy : -1; |
217 item.sizepolicy = policy ? *policy : -1; |
219 item.direction = dir ? *dir : -1; |
218 item.direction = dir ? *dir : -1; |
220 item.anchorId = anchorId; |
219 item.anchorId = anchorId; |
221 |
220 |
222 mLayoutDef->anchorItems.append(item); |
221 mLayoutDef->anchorItems.append(item); |