mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-03 04:00:00 +01:00
User can edit the label of terminal inside the terminal strip editor
This commit is contained in:
@@ -442,6 +442,7 @@ void TerminalStripEditor::on_m_dialog_button_box_clicked(QAbstractButton *button
|
||||
current_data.setTerminalType(modified_data.type_);
|
||||
current_data.setTerminalFunction(modified_data.function_);
|
||||
current_data.setTerminalLED(modified_data.led_);
|
||||
current_data.m_informations.addValue(QStringLiteral("label"), modified_data.label_);
|
||||
|
||||
m_project->undoStack()->push(new ChangeElementDataCommand(element, current_data));
|
||||
}
|
||||
|
||||
@@ -154,6 +154,13 @@ bool TerminalStripModel::setData(const QModelIndex &index, const QVariant &value
|
||||
modified_ = true;
|
||||
modified_cell = FUNCTION_CELL;
|
||||
}
|
||||
else if (column_ == LABEL_CELL &&
|
||||
role == Qt::EditRole)
|
||||
{
|
||||
rtd.label_ = value.toString();
|
||||
modified_ = true;
|
||||
modified_cell = LABEL_CELL;
|
||||
}
|
||||
|
||||
//Set the modification to the terminal data
|
||||
if (modified_)
|
||||
@@ -384,5 +391,8 @@ void TerminalStripModelDelegate::setModelData(QWidget *editor, QAbstractItemMode
|
||||
model->setData(index, qcb->currentData(), Qt::EditRole);
|
||||
}
|
||||
}
|
||||
else {
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user