This commit is contained in:
Martin Marmsoler
2020-05-28 19:05:44 +02:00
committed by Laurent Trinques
parent a6137ed0d0
commit 37cc326a46
2 changed files with 12 additions and 35 deletions

View File

@@ -160,7 +160,8 @@ void TerminalEditor::updateTerminalO()
m_locked = true;
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"))
{
QPropertyUndoCommand *undo = new QPropertyUndoCommand(term, "orientation", term->property("orientation"), var);
@@ -176,8 +177,8 @@ void TerminalEditor::updateXPos() {
m_locked = true;
QPointF new_pos(qle_x->value(), 0);
int i=0;
for (PartTerminal* term: m_terminals) {
for (int i=0; i < m_terminals.length(); i++) {
PartTerminal* term = m_terminals[i];
new_pos.setY(term->pos().y()); // change only x value
if (term->pos() != new_pos) {
QPropertyUndoCommand *undo = new QPropertyUndoCommand(term, "pos", term->property("pos"), new_pos);
@@ -194,7 +195,8 @@ void TerminalEditor::updateYPos() {
m_locked = true;
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());
if (term->pos() != new_pos) {
QPropertyUndoCommand *undo = new QPropertyUndoCommand(term, "pos", term->property("pos"), new_pos);

View File

@@ -176,7 +176,8 @@ void TextEditor::setUpEditConnection()
m_edit_connection << connect(ui->m_line_edit, &QLineEdit::textEdited, [this]()
{
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())
{
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]()
{
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());
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]()
{
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());
if (pos != partText->pos())
{
@@ -212,25 +215,11 @@ void TextEditor::setUpEditConnection()
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->setAnimated(true, false);
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());
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_);
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->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"));
undoStack().push(undo);
}
@@ -269,13 +251,6 @@ void TextEditor::on_m_font_pb_clicked()
/**
* @brief TextEditor::on_m_color_pb_changed
* @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"));
undoStack().push(undo);
}