21#include <tqsizepolicy.h>
28#include "objecttree.h"
32#include "widgetlibrary.h"
36Spring::Spring(TQWidget *parent,
const char *name)
37 : TQWidget(parent, name)
40 m_orient =TQt::Horizontal;
41 setSizeType((SizeType)TQSizePolicy::Expanding);
45Spring::setOrientation(TQt::Orientation orient)
47 SizeType type = sizeType();
54Spring::sizeType()
const
56 if(m_orient ==TQt::Vertical)
57 return (SizeType)sizePolicy().verData();
59 return (SizeType)sizePolicy().horData();
63Spring::setSizeType(SizeType size)
65 if(m_orient ==TQt::Vertical)
66 setSizePolicy(TQSizePolicy::Minimum, (TQSizePolicy::SizeType)size);
68 setSizePolicy( (TQSizePolicy::SizeType)size, TQSizePolicy::Minimum);
72Spring::paintEvent(TQPaintEvent *ev)
79 p.eraseRect(0,0,width(), height());
80 p.setPen(TQPen(TQt::white, 1));
81 p.setRasterOp(TQt::XorROP);
83 if(m_orient ==TQt::Vertical) {
84 uint part = (height()+16) / 16;
89 for (uint i=0; i<4; i++, offset+=(part*4)) {
91 w/2,offset, w,offset+part, w,offset+part, w/2,offset+part*2);
92 p.drawCubicBezier(pa, 0);
94 w/2,offset+part*2, 0,offset+part*3, 0,offset+part*3, w/2,offset+part*4);
95 p.drawCubicBezier(pa, 0);
99 uint part = (width()+16) / 16;
104 for (uint i=0; i<4; i++, offset+=(part*4)) {
106 offset,h/2, offset+part,0, offset+part,0, offset+part*2,h/2);
107 p.drawCubicBezier(pa, 0);
109 offset+part*2,h/2, offset+part*3,h, offset+part*3,h, offset+part*4,h/2);
110 p.drawCubicBezier(pa, 0);
116Spring::isPropertyVisible(
const TQCString &name)
118 if((name ==
"name") || (name ==
"sizeType") || (name ==
"orientation") || (name ==
"geometry"))
128 TQDomElement tclass = domDoc.createElement(
"spacer");
129 parentNode.appendChild(tclass);
133 tclass.setAttribute(
"row", item->gridRow());
134 tclass.setAttribute(
"column", item->gridCol());
135 if(item->spanMultipleCells())
137 tclass.setAttribute(
"rowspan", item->gridRowSpan());
138 tclass.setAttribute(
"colspan", item->gridColSpan());
142 KFormDesigner::FormIO::savePropertyValue(tclass, domDoc,
"name", item->widget()->property(
"name"), item->widget());
144 if(parentNode.tagName() ==
"widget")
145 KFormDesigner::FormIO::savePropertyValue(tclass, domDoc,
"geometry", item->widget()->property(
"geometry"), item->widget());
147 if(!item->widget()->sizeHint().isValid())
148 KFormDesigner::FormIO::savePropertyValue(tclass, domDoc,
"sizeHint", item->widget()->property(
"size"), item->widget());
150 KFormDesigner::FormIO::savePropertyValue(tclass, domDoc,
"sizeHint", item->widget()->property(
"sizeHint"), item->widget());
152 KFormDesigner::FormIO::savePropertyValue(tclass, domDoc,
"orientation", item->widget()->property(
"orientation"), item->widget());
153 KFormDesigner::FormIO::savePropertyValue(tclass, domDoc,
"sizeType", item->widget()->property(
"sizeType"), item->widget());