mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
ElementEditor: texteditor.cpp surround arrows and more braces
This commit is contained in:
committed by
Laurent Trinques
parent
216374d27c
commit
b3a74a8315
@@ -100,17 +100,14 @@ void TextEditor::disconnectEditConnection() {
|
|||||||
* @param part : part to edit
|
* @param part : part to edit
|
||||||
* @return : return if @part is a partext or nullptr, else return false
|
* @return : return if @part is a partext or nullptr, else return false
|
||||||
*/
|
*/
|
||||||
bool TextEditor::setPart(CustomElementPart *part)
|
bool TextEditor::setPart(CustomElementPart *part) {
|
||||||
{
|
if (!part) {
|
||||||
if (!part)
|
|
||||||
{
|
|
||||||
m_text = nullptr;
|
m_text = nullptr;
|
||||||
disconnectChangeConnection();
|
disconnectChangeConnection();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PartText *part_text = static_cast<PartText *>(part))
|
if (PartText *part_text = static_cast<PartText *>(part)) {
|
||||||
{
|
|
||||||
if (part_text == m_text) {
|
if (part_text == m_text) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -139,8 +136,9 @@ bool TextEditor::setParts(QList <CustomElementPart *> parts) {
|
|||||||
m_text = part;
|
m_text = part;
|
||||||
m_parts.clear();
|
m_parts.clear();
|
||||||
m_parts.append(part);
|
m_parts.append(part);
|
||||||
for (int i=1; i < parts.length(); i++)
|
for (int i=1; i < parts.length(); i++) {
|
||||||
m_parts.append(static_cast<PartText*>(parts[i]));
|
m_parts.append(static_cast<PartText*>(parts[i]));
|
||||||
|
}
|
||||||
setUpChangeConnection(m_text);
|
setUpChangeConnection(m_text);
|
||||||
updateForm();
|
updateForm();
|
||||||
return true;
|
return true;
|
||||||
@@ -169,8 +167,7 @@ QList<CustomElementPart*> TextEditor::currentParts() const {
|
|||||||
* Setup the connection between the widgets of this editor and the undo command
|
* Setup the connection between the widgets of this editor and the undo command
|
||||||
* use to apply the change to the edited text.
|
* use to apply the change to the edited text.
|
||||||
*/
|
*/
|
||||||
void TextEditor::setUpEditConnection()
|
void TextEditor::setUpEditConnection() {
|
||||||
{
|
|
||||||
disconnectEditConnection();
|
disconnectEditConnection();
|
||||||
|
|
||||||
m_edit_connection << connect(ui -> m_line_edit, &QLineEdit::textEdited, [this]() {
|
m_edit_connection << connect(ui -> m_line_edit, &QLineEdit::textEdited, [this]() {
|
||||||
@@ -214,7 +211,8 @@ void TextEditor::setUpEditConnection()
|
|||||||
for (int i=0; i < m_parts.length(); i++) {
|
for (int i=0; i < m_parts.length(); i++) {
|
||||||
PartText* partText = m_parts[i];
|
PartText* partText = m_parts[i];
|
||||||
if (ui -> m_rotation_sb -> value() != partText -> rotation()) {
|
if (ui -> m_rotation_sb -> value() != partText -> rotation()) {
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "rotation", partText->rotation(), ui->m_rotation_sb->value());
|
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);
|
||||||
@@ -268,7 +266,8 @@ void TextEditor::on_m_color_pb_changed(const QColor &newColor) {
|
|||||||
for (int i=0; i < m_parts.length(); i++) {
|
for (int i=0; i < m_parts.length(); i++) {
|
||||||
PartText* partText = m_parts[i];
|
PartText* partText = m_parts[i];
|
||||||
if (newColor != partText -> defaultTextColor()) {
|
if (newColor != partText -> defaultTextColor()) {
|
||||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "color", partText->defaultTextColor(), newColor);
|
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