28 #include <Q3VGroupBox>
30 #include <QPushButton>
31 #include <QMessageBox>
33 #include <Q3VBoxLayout>
39 setCaption(tr(
"Edit Subcircuit Properties"));
41 v =
new Q3VBoxLayout(
this);
45 Q3HBox *h0 =
new Q3HBox(
this);
49 Expr.setPattern(
"[A-Za-z][A-Za-z0-9_]*");
51 new QLabel(tr(
"Prefix:"), h0);
52 Prefix =
new QLineEdit(h0);
57 Q3VGroupBox *ParamBox =
new Q3VGroupBox(tr(
"Parameters"),
this);
58 v->addWidget(ParamBox);
70 pp->
display ? tr(
"yes") : tr(
"no"), pp->
Name.section(
'=', 0,0),
73 connect(
ParamList, SIGNAL(selectionChanged(Q3ListViewItem*)),
76 showCheck =
new QCheckBox(tr(
"display in schematic"), ParamBox);
80 Q3HBox *h1 =
new Q3HBox(ParamBox);
81 Q3VBox *v1 =
new Q3VBox(h1);
82 new QLabel(tr(
"Name:"), v1);
83 new QLabel(tr(
"Default Value:"), v1);
84 new QLabel(tr(
"Description:"), v1);
85 new QLabel(tr(
"Type:"), v1);
87 Q3VBox *v2 =
new Q3VBox(h1);
89 Expr.setPattern(
"[\\w_]+");
96 Expr.setPattern(
"[^\"=]*");
100 connect(
ValueEdit, SIGNAL(textChanged(
const QString&)),
103 Expr.setPattern(
"[^\"=\\x005B\\x005D]*");
110 Expr.setPattern(
"[\\w_]+");
114 connect(
TypeEdit, SIGNAL(textChanged(
const QString&)),
117 Q3HBox *h2 =
new Q3HBox(ParamBox);
118 h2->setStretchFactor(
new QWidget(h2), 10);
119 QPushButton *ButtAdd =
new QPushButton(tr(
"Add"), h2);
121 QPushButton *ButtRemove =
new QPushButton(tr(
"Remove"), h2);
124 Q3HBox *h3 =
new Q3HBox(
this);
128 QPushButton *ButtOK =
new QPushButton(tr(
"OK"),h3);
129 connect(ButtOK, SIGNAL(clicked()), SLOT(
slotOk()));
130 QPushButton *ButtCancel =
new QPushButton(tr(
"Cancel"),h3);
131 connect(ButtCancel, SIGNAL(clicked()), SLOT(reject()));
159 showCheck->setChecked(Item->text(0) == tr(
"yes"));
173 QMessageBox::critical(
this, tr(
"Error"),
174 tr(
"Parameter must not be named \"File\"!"));
178 Q3ListViewItem *item, *lastItem=0;
179 for(item =
ParamList->firstChild(); item!=0; item = item->itemBelow()) {
181 QMessageBox::critical(
this, tr(
"Error"),
182 tr(
"Parameter \"%1\" already in list!").arg(
ParamNameEdit->text()));
200 Q3ListViewItem *nextItem = 0;
202 Q3ListViewItem *Item =
ParamList->selectedItem();
204 nextItem = Item->itemBelow();
205 if(nextItem == 0) nextItem = Item->itemAbove();
216 Q3ListViewItem *Item =
ParamList->selectedItem();
217 if(Item == 0)
return;
219 Item->setText(0, On ? tr(
"yes") : tr(
"no"));
225 Q3ListViewItem *Item =
ParamList->selectedItem();
226 if(Item == 0)
return;
228 Item->setText(1, text);
234 Q3ListViewItem *Item =
ParamList->selectedItem();
235 if(Item == 0)
return;
237 Item->setText(2, text);
243 Q3ListViewItem *Item =
ParamList->selectedItem();
244 if(Item == 0)
return;
246 Item->setText(3, text);
252 Q3ListViewItem *Item =
ParamList->selectedItem();
253 if(Item == 0)
return;
255 Item->setText(4, text);
261 bool changed =
false;
263 if(!
Prefix->text().isEmpty())
270 Q3ListViewItem *item;
272 for(item =
ParamList->firstChild(); item != 0; item = item->itemBelow()) {
273 s = item->text(1) +
"=" + item->text(2);
276 if(pp->
display != (item->text(0) == tr(
"yes"))) {
277 pp->
display = (item->text(0) == tr(
"yes"));
288 if(pp->
Type != item->text(4)) {
289 pp->
Type = item->text(4);
295 (item->text(0) == tr(
"yes")) ?
true :
false, s, item->text(3),
312 if(changed) accept();
QRegExpValidator * TypeVal
QRegExpValidator * NameVal
void slotEditParameter(Q3ListViewItem *)
QLineEdit * DescriptionEdit
void slotRemoveParameter()
QRegExpValidator * ValueVal
void slotNameChanged(const QString &)
void slotDescrChanged(const QString &)
QRegExpValidator * SubVal
void slotValueChanged(const QString &)
QLineEdit * ParamNameEdit
void slotTypeChanged(const QString &)
Q3PtrList< SubParameter > Parameter
QRegExpValidator * DescrVal
void slotToggleShow(bool)