mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
solves #7
This commit is contained in:
committed by
Laurent Trinques
parent
8ffe50715d
commit
35896d5771
@@ -160,7 +160,8 @@ void TerminalEditor::updateTerminalO()
|
|||||||
m_locked = true;
|
m_locked = true;
|
||||||
QVariant var(orientation -> itemData(orientation -> currentIndex()));
|
QVariant var(orientation -> itemData(orientation -> currentIndex()));
|
||||||
|
|
||||||
for (auto term: m_terminals) {
|
for (int i=0; i < m_terminals.length(); i++) {
|
||||||
|
PartTerminal* term = m_terminals[i];
|
||||||
if (var != term->property("orientation"))
|
if (var != term->property("orientation"))
|
||||||
{
|
{
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(term, "orientation", term->property("orientation"), var);
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(term, "orientation", term->property("orientation"), var);
|
||||||
@@ -176,8 +177,8 @@ void TerminalEditor::updateXPos() {
|
|||||||
m_locked = true;
|
m_locked = true;
|
||||||
QPointF new_pos(qle_x->value(), 0);
|
QPointF new_pos(qle_x->value(), 0);
|
||||||
|
|
||||||
int i=0;
|
for (int i=0; i < m_terminals.length(); i++) {
|
||||||
for (PartTerminal* term: m_terminals) {
|
PartTerminal* term = m_terminals[i];
|
||||||
new_pos.setY(term->pos().y()); // change only x value
|
new_pos.setY(term->pos().y()); // change only x value
|
||||||
if (term->pos() != new_pos) {
|
if (term->pos() != new_pos) {
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(term, "pos", term->property("pos"), new_pos);
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(term, "pos", term->property("pos"), new_pos);
|
||||||
@@ -194,7 +195,8 @@ void TerminalEditor::updateYPos() {
|
|||||||
m_locked = true;
|
m_locked = true;
|
||||||
QPointF new_pos(0, qle_y->value()); // change only y value
|
QPointF new_pos(0, qle_y->value()); // change only y value
|
||||||
|
|
||||||
for (auto term: m_terminals) {
|
for (int i=0; i < m_terminals.length(); i++) {
|
||||||
|
PartTerminal* term = m_terminals[i];
|
||||||
new_pos.setX(term->pos().x());
|
new_pos.setX(term->pos().x());
|
||||||
if (term->pos() != new_pos) {
|
if (term->pos() != new_pos) {
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(term, "pos", term->property("pos"), new_pos);
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(term, "pos", term->property("pos"), new_pos);
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ void TextEditor::setUpEditConnection()
|
|||||||
m_edit_connection << connect(ui->m_line_edit, &QLineEdit::textEdited, [this]()
|
m_edit_connection << connect(ui->m_line_edit, &QLineEdit::textEdited, [this]()
|
||||||
{
|
{
|
||||||
QString text_ = ui->m_line_edit->text();
|
QString text_ = ui->m_line_edit->text();
|
||||||
for (auto partText: m_parts) {
|
for (int i=0; i < m_parts.length(); i++) {
|
||||||
|
PartText* partText = m_parts[i];
|
||||||
if (text_ != partText->toPlainText())
|
if (text_ != partText->toPlainText())
|
||||||
{
|
{
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "text", partText->toPlainText(), text_);
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "text", partText->toPlainText(), text_);
|
||||||
@@ -188,7 +189,8 @@ void TextEditor::setUpEditConnection()
|
|||||||
m_edit_connection << connect(ui->m_x_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
|
m_edit_connection << connect(ui->m_x_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
|
||||||
{
|
{
|
||||||
QPointF pos(ui->m_x_sb->value(), 0);
|
QPointF pos(ui->m_x_sb->value(), 0);
|
||||||
for (auto partText: m_parts) {
|
for (int i=0; i < m_parts.length(); i++) {
|
||||||
|
PartText* partText = m_parts[i];
|
||||||
pos.setY(partText->pos().y());
|
pos.setY(partText->pos().y());
|
||||||
if (pos != partText->pos())
|
if (pos != partText->pos())
|
||||||
{
|
{
|
||||||
@@ -202,7 +204,8 @@ void TextEditor::setUpEditConnection()
|
|||||||
m_edit_connection << connect(ui->m_y_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
|
m_edit_connection << connect(ui->m_y_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
|
||||||
{
|
{
|
||||||
QPointF pos(0, ui->m_y_sb->value());
|
QPointF pos(0, ui->m_y_sb->value());
|
||||||
for (auto partText: m_parts) {
|
for (int i=0; i < m_parts.length(); i++) {
|
||||||
|
PartText* partText = m_parts[i];
|
||||||
pos.setX(partText->pos().x());
|
pos.setX(partText->pos().x());
|
||||||
if (pos != partText->pos())
|
if (pos != partText->pos())
|
||||||
{
|
{
|
||||||
@@ -212,25 +215,11 @@ void TextEditor::setUpEditConnection()
|
|||||||
undoStack().push(undo);
|
undoStack().push(undo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
m_edit_connection << connect(ui->m_rotation_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
|
|
||||||
{
|
|
||||||
for (auto partText: m_parts) {
|
|
||||||
if (ui->m_rotation_sb->value() != partText->rotation())
|
|
||||||
{
|
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "rotation", partText->rotation(), ui->m_rotation_sb->value());
|
|
||||||
undo->setText(tr("Pivoter un champ texte"));
|
undo->setText(tr("Pivoter un champ texte"));
|
||||||
undo->setAnimated(true, false);
|
undo->setAnimated(true, false);
|
||||||
undoStack().push(undo);
|
undoStack().push(undo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
m_edit_connection << connect(ui->m_size_sb, QOverload<int>::of(&QSpinBox::valueChanged), [this]()
|
|
||||||
{
|
|
||||||
for (auto partText: m_parts) {
|
|
||||||
if (partText->font().pointSize() != ui->m_size_sb->value())
|
|
||||||
{
|
|
||||||
QFont font_ = partText->font();
|
|
||||||
font_.setPointSize(ui->m_size_sb->value());
|
font_.setPointSize(ui->m_size_sb->value());
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_);
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_);
|
||||||
undo->setText(tr("Modifier la police d'un texte"));
|
undo->setText(tr("Modifier la police d'un texte"));
|
||||||
@@ -253,13 +242,6 @@ void TextEditor::on_m_font_pb_clicked()
|
|||||||
ui->m_size_sb->setValue(font_.pointSize());
|
ui->m_size_sb->setValue(font_.pointSize());
|
||||||
ui->m_size_sb->blockSignals(false);
|
ui->m_size_sb->blockSignals(false);
|
||||||
|
|
||||||
ui->m_font_pb->setText(font_.family());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto partText: m_parts) {
|
|
||||||
if (ok && font_ != partText->font())
|
|
||||||
{
|
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_);
|
|
||||||
undo->setText(tr("Modifier la police d'un texte"));
|
undo->setText(tr("Modifier la police d'un texte"));
|
||||||
undoStack().push(undo);
|
undoStack().push(undo);
|
||||||
}
|
}
|
||||||
@@ -269,13 +251,6 @@ void TextEditor::on_m_font_pb_clicked()
|
|||||||
/**
|
/**
|
||||||
* @brief TextEditor::on_m_color_pb_changed
|
* @brief TextEditor::on_m_color_pb_changed
|
||||||
* @param newColor
|
* @param newColor
|
||||||
*/
|
|
||||||
void TextEditor::on_m_color_pb_changed(const QColor &newColor)
|
|
||||||
{
|
|
||||||
for (auto partText: m_parts) {
|
|
||||||
if (newColor != partText->defaultTextColor())
|
|
||||||
{
|
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "color", partText->defaultTextColor(), newColor);
|
|
||||||
undo->setText(tr("Modifier la couleur d'un texte"));
|
undo->setText(tr("Modifier la couleur d'un texte"));
|
||||||
undoStack().push(undo);
|
undoStack().push(undo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user