mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Update number and name to the editor: Work now!
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2632 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -43,6 +43,7 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor, PartTerminal *term, QWi
|
||||
|
||||
qle_number = new QLineEdit();
|
||||
qle_name = new QLineEdit();
|
||||
qcheck_name_visible = new QCheckBox(tr("Visible"));
|
||||
|
||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||
main_layout -> addWidget(new QLabel(tr("Position : ")));
|
||||
@@ -59,11 +60,15 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor, PartTerminal *term, QWi
|
||||
ori -> addWidget(orientation );
|
||||
main_layout -> addLayout(ori);
|
||||
|
||||
QHBoxLayout *name = new QHBoxLayout();
|
||||
name -> addWidget(new QLabel(tr("Nom : ")));
|
||||
name -> addWidget(qle_name );
|
||||
name -> addWidget(qcheck_name_visible );
|
||||
main_layout -> addLayout(name);
|
||||
|
||||
QHBoxLayout *num = new QHBoxLayout();
|
||||
num -> addWidget(new QLabel(tr("Num\351ro : ")));
|
||||
num -> addWidget(qle_number );
|
||||
num -> addWidget(new QLabel(tr("Nom : ")));
|
||||
num -> addWidget(qle_name );
|
||||
main_layout -> addLayout(num);
|
||||
|
||||
main_layout -> addStretch();
|
||||
@@ -121,8 +126,10 @@ void TerminalEditor::updateTerminal() {
|
||||
);
|
||||
part -> setNumber( qle_number->text() );
|
||||
part -> setName ( qle_name->text() );
|
||||
part -> setNameHidden( !qcheck_name_visible ->isChecked() );
|
||||
}
|
||||
|
||||
/// WARNING!!!! on addChangePartCommand the prop accept only the simple string! (NOT /:;,?...)
|
||||
/// Met a jour l'abscisse de la position de la borne et cree un objet d'annulation
|
||||
void TerminalEditor::updateTerminalX() { addChangePartCommand(tr("abscisse"), part, "x", qle_x -> text().toDouble()); updateForm(); }
|
||||
/// Met a jour l'ordonnee de la position de la borne et cree un objet d'annulation
|
||||
@@ -130,9 +137,18 @@ void TerminalEditor::updateTerminalY() { addChangePartCommand(tr("ordonn\351e"),
|
||||
/// Met a jour l'orientation de la borne et cree un objet d'annulation
|
||||
void TerminalEditor::updateTerminalO() { addChangePartCommand(tr("orientation"), part, "orientation", orientation -> itemData(orientation -> currentIndex()).toInt()); }
|
||||
/// update Number and name, create cancel object
|
||||
void TerminalEditor::updateTerminalNum() { addChangePartCommand(tr("num\351ro: ")+qle_number -> text(), part, "num\351ro:", qle_number -> text()); updateForm(); }
|
||||
void TerminalEditor::updateTerminalName() { addChangePartCommand(tr("nom: ")+qle_name -> text(), part, "nom", qle_name -> text()); updateForm(); }
|
||||
|
||||
void TerminalEditor::updateTerminalNum() {
|
||||
addChangePartCommand(tr("num\351ro: ")+qle_number -> text(), part, "number", qle_number -> text());
|
||||
updateForm();
|
||||
}
|
||||
void TerminalEditor::updateTerminalName() {
|
||||
addChangePartCommand(tr("nom: ")+qle_name -> text(), part, "name", qle_name -> text());
|
||||
updateForm();
|
||||
}
|
||||
void TerminalEditor::updateTerminalNameVisible() {
|
||||
addChangePartCommand(tr("nom visible: ")+QString::number( qcheck_name_visible->isChecked()), part, "nameHidden", !qcheck_name_visible -> isChecked());
|
||||
updateForm();
|
||||
}
|
||||
/**
|
||||
Met a jour le formulaire d'edition
|
||||
*/
|
||||
@@ -144,6 +160,7 @@ void TerminalEditor::updateForm() {
|
||||
orientation -> setCurrentIndex(static_cast<int>(part -> orientation()));
|
||||
qle_number -> setText(part -> number() );
|
||||
qle_name -> setText(part -> nameOfTerminal() );
|
||||
qcheck_name_visible ->setChecked( !part -> nameIsHidden() );
|
||||
activeConnections(true);
|
||||
}
|
||||
|
||||
@@ -158,11 +175,13 @@ void TerminalEditor::activeConnections(bool active) {
|
||||
connect(orientation, SIGNAL(activated(int)), this, SLOT(updateTerminalO()));
|
||||
connect(qle_number, SIGNAL(editingFinished()), this, SLOT(updateTerminalNum()));
|
||||
connect(qle_name, SIGNAL(editingFinished()), this, SLOT(updateTerminalName()));
|
||||
connect(qcheck_name_visible, SIGNAL(stateChanged ( int)), this, SLOT(updateTerminalNameVisible()));
|
||||
} else {
|
||||
disconnect(qle_x, SIGNAL(editingFinished()), this, SLOT(updateTerminalX()));
|
||||
disconnect(qle_y, SIGNAL(editingFinished()), this, SLOT(updateTerminalY()));
|
||||
disconnect(orientation, SIGNAL(activated(int)), this, SLOT(updateTerminalO()));
|
||||
disconnect(qle_number, SIGNAL(editingFinished()), this, SLOT(updateTerminalNum()));
|
||||
disconnect(qle_name, SIGNAL(editingFinished()), this, SLOT(updateTerminalName()));
|
||||
disconnect(qcheck_name_visible, SIGNAL(stateChanged ( int)), this, SLOT(updateTerminalNameVisible()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user