20 #include "plinestyleedit.h" 22 #include <tqpainter.h> 24 #include <tqcombobox.h> 32 "................................................",
33 "................................................",
34 "................................................",
35 "................................................",
36 "................................................",
37 "................................................",
38 "................................................",
39 "................................................",
40 "................................................",
41 "................................................",
42 "................................................",
43 "................................................",
44 "................................................",
45 "................................................",
46 "................................................",
47 "................................................"};
52 "................................................",
53 "................................................",
54 "................................................",
55 "................................................",
56 "................................................",
57 "................................................",
58 "................................................",
59 ".###########################################....",
60 ".###########################################....",
61 "................................................",
62 "................................................",
63 "................................................",
64 "................................................",
65 "................................................",
66 "................................................",
67 "................................................"};
72 "................................................",
73 "................................................",
74 "................................................",
75 "................................................",
76 "................................................",
77 "................................................",
78 "................................................",
79 ".#########..#########..#########..##########....",
80 ".#########..#########..#########..##########....",
81 "................................................",
82 "................................................",
83 "................................................",
84 "................................................",
85 "................................................",
86 "................................................",
87 "................................................"};
88 const char *dashdot[]={
92 "................................................",
93 "................................................",
94 "................................................",
95 "................................................",
96 "................................................",
97 "................................................",
98 "................................................",
99 ".#########..##..#########..##..#########..##....",
100 ".#########..##..#########..##..#########..##....",
101 "................................................",
102 "................................................",
103 "................................................",
104 "................................................",
105 "................................................",
106 "................................................",
107 "................................................"};
108 const char *dashdotdot[]={
112 "................................................",
113 "................................................",
114 "................................................",
115 "................................................",
116 "................................................",
117 "................................................",
118 "................................................",
119 ".#########..##..##..#########..##..##..#####....",
120 ".#########..##..##..#########..##..##..#####....",
121 "................................................",
122 "................................................",
123 "................................................",
124 "................................................",
125 "................................................",
126 "................................................",
127 "................................................"};
130 PLineStyleEdit::PLineStyleEdit(MultiProperty* property, TQWidget* parent,
const char* name): PropertyWidget(property, parent, name)
132 TQHBoxLayout *l =
new TQHBoxLayout(
this, 0, 0);
133 m_edit =
new TQComboBox(
this);
134 m_edit->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding);
135 l->addWidget(m_edit);
137 m_edit->insertItem(TQPixmap(nopen));
138 m_edit->insertItem(TQPixmap(solid));
139 m_edit->insertItem(TQPixmap(dash));
140 m_edit->insertItem(TQPixmap(dashdot));
141 m_edit->insertItem(TQPixmap(dashdotdot));
143 connect(m_edit, TQT_SIGNAL(activated(
int)),
this, TQT_SLOT(updateProperty(
int)));
148 return m_edit->currentItem();
153 p->setPen(TQt::NoPen);
154 p->setBrush(cg.background());
157 if (!value.canCast(TQVariant::Int))
158 if ((value.toInt() > 5) || (value.toInt() < 0))
161 switch (value.toInt()) {
163 p->drawPixmap(r, TQPixmap(nopen));
166 p->drawPixmap(r, TQPixmap(solid));
169 p->drawPixmap(r, TQPixmap(dash));
172 p->drawPixmap(r, TQPixmap(dashdot));
175 p->drawPixmap(r, TQPixmap(dashdot));
178 p->drawPixmap(r, TQPixmap(dashdotdot));
185 if (!value.canCast(TQVariant::Int))
187 if ((value.toInt() > 5) || (value.toInt() < 0))
189 disconnect(m_edit, TQT_SIGNAL(activated(
int)),
this, TQT_SLOT(updateProperty(
int)));
190 m_edit->setCurrentItem(value.toInt());
191 connect(m_edit, TQT_SIGNAL(activated(
int)),
this, TQT_SLOT(updateProperty(
int)));
196 void PLineStyleEdit::updateProperty(
int val)
204 #include "plinestyleedit.moc" virtual TQVariant value() const
Namespace which contain property editing classes.
virtual TQVariant value() const
virtual void drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value)
Function to draw a property viewer when the editor isn't shown.
virtual void setValue(const TQVariant &value, bool emitChange)
Sets the value shown in the editor widget.