mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Element editor : replace home made property by Q_PROPERTY for all primitive,
Add combo box for input to set the tagg (nothing or label, actually) Remove terminal text because unused. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3088 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -29,8 +29,8 @@ TextFieldEditor::TextFieldEditor(QETElementEditor *editor, PartTextField *textfi
|
||||
ElementItemEditor(editor, parent),
|
||||
part(textfield)
|
||||
{
|
||||
qle_x = new QLineEdit();
|
||||
qle_y = new QLineEdit();
|
||||
qle_x = new QDoubleSpinBox();
|
||||
qle_y = new QDoubleSpinBox();
|
||||
qle_text = new QLineEdit();
|
||||
font_size = new QSpinBox();
|
||||
font_size -> setRange(0, 144);
|
||||
@@ -40,8 +40,8 @@ TextFieldEditor::TextFieldEditor(QETElementEditor *editor, PartTextField *textfi
|
||||
rotation_angle_label -> setWordWrap(true);
|
||||
rotation_angle_ = QETApp::createTextOrientationSpinBoxWidget();
|
||||
|
||||
qle_x -> setValidator(new QDoubleValidator(qle_x));
|
||||
qle_y -> setValidator(new QDoubleValidator(qle_y));
|
||||
qle_x -> setRange (-1000, 1000);
|
||||
qle_y -> setRange (-1000, 1000);
|
||||
|
||||
QVBoxLayout *main_layout = new QVBoxLayout();
|
||||
main_layout -> addWidget(new QLabel(tr("Position : ")));
|
||||
@@ -62,6 +62,14 @@ TextFieldEditor::TextFieldEditor(QETElementEditor *editor, PartTextField *textfi
|
||||
t -> addWidget(new QLabel(tr("Texte par d\351faut : ")));
|
||||
t -> addWidget(qle_text);
|
||||
main_layout -> addLayout(t);
|
||||
|
||||
//add the tagg combobox
|
||||
QHBoxLayout *tagg_layout = new QHBoxLayout();
|
||||
tagg_layout -> addWidget(new QLabel(tr("tagg :")));
|
||||
tagg_layout -> addWidget(m_tagg_cb = new QComboBox());
|
||||
m_tagg_cb -> addItem(tr("Aucun"), QVariant("none"));
|
||||
m_tagg_cb -> addItem(tr("label"), QVariant("label"));
|
||||
main_layout -> addLayout(tagg_layout);
|
||||
|
||||
QHBoxLayout *rotation_angle_layout = new QHBoxLayout();
|
||||
rotation_angle_layout -> addWidget(rotation_angle_label);
|
||||
@@ -117,14 +125,15 @@ void TextFieldEditor::updateTextField() {
|
||||
if (!part) return;
|
||||
part -> setProperty("size", font_size -> value());
|
||||
part -> setPlainText(qle_text -> text());
|
||||
part -> setPos(qle_x -> text().toDouble(), qle_y -> text().toDouble());
|
||||
part -> setPos(qle_x->value(), qle_y->value());
|
||||
part -> setFollowParentRotations(!rotate -> isChecked());
|
||||
part -> setTagg(m_tagg_cb->itemData(m_tagg_cb->currentIndex()).toString());
|
||||
}
|
||||
|
||||
/// Met a jour l'abscisse de la position du champ de texte et cree un objet d'annulation
|
||||
void TextFieldEditor::updateTextFieldX() { addChangePartCommand(tr("abscisse"), part, "x", qle_x -> text().toDouble()); updateForm(); }
|
||||
void TextFieldEditor::updateTextFieldX() { addChangePartCommand(tr("abscisse"), part, "x", qle_x -> value()); }
|
||||
/// Met a jour l'ordonnee de la position du champ de texte et cree un objet d'annulation
|
||||
void TextFieldEditor::updateTextFieldY() { addChangePartCommand(tr("ordonn\351e"), part, "y", qle_y -> text().toDouble()); updateForm(); }
|
||||
void TextFieldEditor::updateTextFieldY() { addChangePartCommand(tr("ordonn\351e"), part, "y", qle_y -> value()); }
|
||||
/// Met a jour le texte du champ de texte et cree un objet d'annulation
|
||||
void TextFieldEditor::updateTextFieldT() { addChangePartCommand(tr("contenu"), part, "text", qle_text -> text()); }
|
||||
/// Met a jour la taille du champ de texte et cree un objet d'annulation
|
||||
@@ -132,7 +141,8 @@ void TextFieldEditor::updateTextFieldS() { addChangePartCommand(tr("taille"),
|
||||
/// Met a jour la taille du champ de texte et cree un objet d'annulation
|
||||
void TextFieldEditor::updateTextFieldR() { addChangePartCommand(tr("propri\351t\351"), part, "rotate", !rotate -> isChecked()); }
|
||||
/// Met a jour l'angle de rotation du champ de texte et cree un objet d'annulation
|
||||
void TextFieldEditor::updateTextFieldRotationAngle() { addChangePartCommand(tr("angle de rotation"), part, "rotation angle", rotation_angle_ -> value()); }
|
||||
void TextFieldEditor::updateTextFieldRotationAngle() { addChangePartCommand(tr("angle de rotation"), part, "rotation_angle", rotation_angle_ -> value()); }
|
||||
void TextFieldEditor::updateTagg() { addChangePartCommand(tr("tagg"), part, "tagg", m_tagg_cb->itemData(m_tagg_cb->currentIndex()).toString());}
|
||||
|
||||
/**
|
||||
Met a jour le formulaire d'edition
|
||||
@@ -140,12 +150,14 @@ void TextFieldEditor::updateTextFieldRotationAngle() { addChangePartCommand(tr("
|
||||
void TextFieldEditor::updateForm() {
|
||||
if (!part) return;
|
||||
activeConnections(false);
|
||||
qle_x -> setText(part -> property("x").toString());
|
||||
qle_y -> setText(part -> property("y").toString());
|
||||
qle_x -> setValue(part->property("x").toReal());
|
||||
qle_y -> setValue(part->property("y").toReal());
|
||||
qle_text -> setText(part -> property("text").toString());
|
||||
font_size -> setValue(part -> property("size").toInt());
|
||||
rotate -> setChecked(!part -> property("rotate").toBool());
|
||||
rotate -> setChecked(!part -> property("rotate").toBool());
|
||||
rotation_angle_ -> setValue(part -> property("rotation angle").toDouble());
|
||||
m_tagg_cb->setCurrentIndex(m_tagg_cb->findData(part->property("tagg")));
|
||||
|
||||
activeConnections(true);
|
||||
}
|
||||
|
||||
@@ -155,18 +167,20 @@ void TextFieldEditor::updateForm() {
|
||||
*/
|
||||
void TextFieldEditor::activeConnections(bool active) {
|
||||
if (active) {
|
||||
connect(qle_x, SIGNAL(editingFinished()), this, SLOT(updateTextFieldX()));
|
||||
connect(qle_y, SIGNAL(editingFinished()), this, SLOT(updateTextFieldY()));
|
||||
connect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextFieldT()));
|
||||
connect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextFieldS()));
|
||||
connect(rotate, SIGNAL(stateChanged(int)), this, SLOT(updateTextFieldR()));
|
||||
connect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextFieldRotationAngle()));
|
||||
connect(qle_x, SIGNAL(editingFinished()), this, SLOT(updateTextFieldX()));
|
||||
connect(qle_y, SIGNAL(editingFinished()), this, SLOT(updateTextFieldY()));
|
||||
connect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextFieldT()));
|
||||
connect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextFieldS()));
|
||||
connect(rotate, SIGNAL(stateChanged(int)), this, SLOT(updateTextFieldR()));
|
||||
connect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextFieldRotationAngle()));
|
||||
connect(m_tagg_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTagg()));
|
||||
} else {
|
||||
disconnect(qle_x, SIGNAL(editingFinished()), this, SLOT(updateTextFieldX()));
|
||||
disconnect(qle_y, SIGNAL(editingFinished()), this, SLOT(updateTextFieldY()));
|
||||
disconnect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextFieldT()));
|
||||
disconnect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextFieldS()));
|
||||
disconnect(rotate, SIGNAL(stateChanged(int)), this, SLOT(updateTextFieldR()));
|
||||
disconnect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextFieldRotationAngle()));
|
||||
disconnect(qle_x, SIGNAL(editingFinished()), this, SLOT(updateTextFieldX()));
|
||||
disconnect(qle_y, SIGNAL(editingFinished()), this, SLOT(updateTextFieldY()));
|
||||
disconnect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextFieldT()));
|
||||
disconnect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextFieldS()));
|
||||
disconnect(rotate, SIGNAL(stateChanged(int)), this, SLOT(updateTextFieldR()));
|
||||
disconnect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextFieldRotationAngle()));
|
||||
connect(m_tagg_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTagg()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user