mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Add possibility to adjust terminal text position
The bounding rectangle used to define the position of the terminal text can be edited. The y position and height can now be edited. The width is not editable because is always the width of the rectangle of the of the terminal.
This commit is contained in:
@@ -68,15 +68,10 @@ class TerminalStripLayoutPattern
|
|||||||
|
|
||||||
void setTerminalsTextAlignment(const QVector<Qt::Alignment> &alignment);
|
void setTerminalsTextAlignment(const QVector<Qt::Alignment> &alignment);
|
||||||
QVector<Qt::Alignment> terminalsTextAlignment() const;
|
QVector<Qt::Alignment> terminalsTextAlignment() const;
|
||||||
QVector<QTextOption> terminalsTextOption() const;
|
QVector<QTextOption> terminalsTextOption() const;
|
||||||
|
int m_terminals_text_height{50};
|
||||||
|
int m_terminals_text_y{35};
|
||||||
|
|
||||||
QVector<QRect> m_terminals_text_rect
|
|
||||||
{
|
|
||||||
QRect{0,35,20,50},
|
|
||||||
QRect{0,35,20,50},
|
|
||||||
QRect{0,35,20,50},
|
|
||||||
QRect{0,35,20,50}
|
|
||||||
};
|
|
||||||
QVector<Qt::Orientation> m_terminals_text_orientation
|
QVector<Qt::Orientation> m_terminals_text_orientation
|
||||||
{
|
{
|
||||||
Qt::Vertical,
|
Qt::Vertical,
|
||||||
|
|||||||
@@ -105,9 +105,10 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
|||||||
|
|
||||||
|
|
||||||
//Draw terminals
|
//Draw terminals
|
||||||
const auto terminals_text_rect{m_pattern->m_terminals_text_rect};
|
|
||||||
const auto terminals_text_orientation{m_pattern->m_terminals_text_orientation};
|
const auto terminals_text_orientation{m_pattern->m_terminals_text_orientation};
|
||||||
const auto terminals_text_option{m_pattern->terminalsTextOption()};
|
const auto terminals_text_option{m_pattern->terminalsTextOption()};
|
||||||
|
const auto terminals_text_height{m_pattern->m_terminals_text_height};
|
||||||
|
const auto terminals_text_y{m_pattern->m_terminals_text_y};
|
||||||
QRect terminal_rect;
|
QRect terminal_rect;
|
||||||
|
|
||||||
QHash<QUuid, QVector<QPointF>> bridges_anchor_points;
|
QHash<QUuid, QVector<QPointF>> bridges_anchor_points;
|
||||||
@@ -160,16 +161,12 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
|||||||
|
|
||||||
//Draw text
|
//Draw text
|
||||||
painter->save();
|
painter->save();
|
||||||
if (terminals_text_orientation[index_] == Qt::Horizontal)
|
text_rect.setRect(0, terminals_text_y, terminal_rect.width(), terminals_text_height);
|
||||||
|
if (terminals_text_orientation[index_] == Qt::Vertical)
|
||||||
{
|
{
|
||||||
text_rect = terminals_text_rect[index_];
|
painter->translate(text_rect.bottomLeft());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const auto rect_{terminals_text_rect[index_]};
|
|
||||||
painter->translate(rect_.bottomLeft());
|
|
||||||
painter->rotate(270);
|
painter->rotate(270);
|
||||||
text_rect.setRect(0, 0, rect_.height(), terminal_rect.width());
|
text_rect.setRect(0, 0, text_rect.height(), text_rect.width());
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto shared_real_terminal{real_terminal_vector[i]};
|
const auto shared_real_terminal{real_terminal_vector[i]};
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#include "terminalstriplayouteditor.h"
|
#include "terminalstriplayouteditor.h"
|
||||||
#include "ui_terminalstriplayouteditor.h"
|
#include "ui_terminalstriplayouteditor.h"
|
||||||
#include "../GraphicsItem/properties/terminalstriplayoutpattern.h"
|
#include "../GraphicsItem/properties/terminalstriplayoutpattern.h"
|
||||||
#include "../../utils/qetutils.h"
|
|
||||||
|
|
||||||
TerminalStripLayoutEditor::TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
|
TerminalStripLayoutEditor::TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
|
||||||
QWidget *parent) :
|
QWidget *parent) :
|
||||||
@@ -137,6 +136,9 @@ void TerminalStripLayoutEditor::valueEdited()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_layout.data()->m_terminals_text_y = ui->m_terminal_text_y_sb->value();
|
||||||
|
m_layout.data()->m_terminals_text_height = ui->m_terminal_text_height_sb->value();
|
||||||
|
|
||||||
updateUi();
|
updateUi();
|
||||||
m_preview_strip_item.update();
|
m_preview_strip_item.update();
|
||||||
}
|
}
|
||||||
@@ -219,6 +221,9 @@ void TerminalStripLayoutEditor::updateUi()
|
|||||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(2);
|
ui->m_terminal_text_alignment_cb->setCurrentIndex(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->m_terminal_text_y_sb->setValue(data->m_terminals_text_y);
|
||||||
|
ui->m_terminal_text_height_sb->setValue(data->m_terminals_text_height);
|
||||||
|
|
||||||
m_ui_updating = false;
|
m_ui_updating = false;
|
||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>892</width>
|
<width>683</width>
|
||||||
<height>555</height>
|
<height>589</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -144,6 +144,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Afficher l'aide</string>
|
<string>Afficher l'aide</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
@@ -210,7 +213,14 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="6" column="3">
|
<item row="8" column="4">
|
||||||
|
<widget class="QLabel" name="label_19">
|
||||||
|
<property name="text">
|
||||||
|
<string>Longueur maximal du texte de borne</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="3">
|
||||||
<widget class="QComboBox" name="m_header_text_orientation_cb">
|
<widget class="QComboBox" name="m_header_text_orientation_cb">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -224,42 +234,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="6" column="3">
|
||||||
<widget class="QLabel" name="label_14">
|
|
||||||
<property name="text">
|
|
||||||
<string>Orientation du texte d'en tête :</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="3">
|
|
||||||
<widget class="QComboBox" name="m_terminal_text_orientation_cb">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Horizontal</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Vertical</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="4">
|
|
||||||
<widget class="QLabel" name="label_15">
|
|
||||||
<property name="text">
|
|
||||||
<string>Alignement du texte d'en tête :</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="2">
|
|
||||||
<widget class="QLabel" name="label_16">
|
|
||||||
<property name="text">
|
|
||||||
<string>Orientation du texte de borne :</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="5">
|
|
||||||
<widget class="QComboBox" name="m_header_text_alignment_cb">
|
<widget class="QComboBox" name="m_header_text_alignment_cb">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -278,29 +253,38 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="5">
|
<item row="5" column="5">
|
||||||
<widget class="QComboBox" name="m_terminal_text_alignment_cb">
|
<widget class="QComboBox" name="m_terminal_text_orientation_cb">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Gauche</string>
|
<string>Horizontal</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Centre</string>
|
<string>Vertical</string>
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Droite</string>
|
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="4">
|
<item row="5" column="2">
|
||||||
<widget class="QLabel" name="label_17">
|
<widget class="QLabel" name="label_14">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Alignement du texte de borne :</string>
|
<string>Orientation du texte d'en tête :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="2">
|
||||||
|
<widget class="QLabel" name="label_15">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alignement du texte d'en tête :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="4">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Origine vertical du texte de borne :</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -359,6 +343,52 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="6" column="5">
|
||||||
|
<widget class="QComboBox" name="m_terminal_text_alignment_cb">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Gauche</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Centre</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Droite</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="5">
|
||||||
|
<widget class="QSpinBox" name="m_terminal_text_height_sb">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="4">
|
||||||
|
<widget class="QLabel" name="label_16">
|
||||||
|
<property name="text">
|
||||||
|
<string>Orientation du texte de borne :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="5">
|
||||||
|
<widget class="QSpinBox" name="m_terminal_text_y_sb"/>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="4">
|
||||||
|
<widget class="QLabel" name="label_17">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alignement du texte de borne :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -898,6 +928,38 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_terminal_text_y_sb</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>TerminalStripLayoutEditor</receiver>
|
||||||
|
<slot>valueEdited()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>207</x>
|
||||||
|
<y>383</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>445</x>
|
||||||
|
<y>277</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_terminal_text_height_sb</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>TerminalStripLayoutEditor</receiver>
|
||||||
|
<slot>valueEdited()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>430</x>
|
||||||
|
<y>383</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>445</x>
|
||||||
|
<y>277</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>valueEdited()</slot>
|
<slot>valueEdited()</slot>
|
||||||
|
|||||||
Reference in New Issue
Block a user