mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Terminal strip graphic item can display Xref of terminal
This commit is contained in:
@@ -38,9 +38,10 @@ namespace TerminalStripDrawer
|
|||||||
class DemoRealTerminal : public AbstractRealTerminalInterface
|
class DemoRealTerminal : public AbstractRealTerminalInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DemoRealTerminal(const QString &label, const QUuid &bridge) :
|
DemoRealTerminal(const QString &label, const QString &xref, const QUuid &bridge) :
|
||||||
m_label { label },
|
m_label { label },
|
||||||
m_bridge { bridge }
|
m_xref{ xref },
|
||||||
|
m_bridge { bridge }
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QString label() const override {
|
QString label() const override {
|
||||||
@@ -55,8 +56,12 @@ namespace TerminalStripDrawer
|
|||||||
return new DemoBridge { m_bridge };
|
return new DemoBridge { m_bridge };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString xref() const override {
|
||||||
|
return m_xref;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_label;
|
QString m_label, m_xref;
|
||||||
QUuid m_bridge;
|
QUuid m_bridge;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -101,52 +106,65 @@ namespace TerminalStripDrawer
|
|||||||
|
|
||||||
QVector <QSharedPointer<AbstractRealTerminalInterface>> real_terminals_vector;
|
QVector <QSharedPointer<AbstractRealTerminalInterface>> real_terminals_vector;
|
||||||
|
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
new DemoRealTerminal( QStringLiteral("24vdc"),
|
new DemoRealTerminal( QStringLiteral("24vdc"),
|
||||||
lvl_1)};
|
QStringLiteral("1_A1"),
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
lvl_1)};
|
||||||
new DemoRealTerminal( QStringLiteral("0vdc"),
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
lvl_2)};
|
new DemoRealTerminal( QStringLiteral("0vdc"),
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
QStringLiteral("1_A2"),
|
||||||
new DemoRealTerminal( QStringLiteral("signal"),
|
lvl_2)};
|
||||||
lvl_3)};
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
new DemoRealTerminal( QStringLiteral("signal"),
|
||||||
new DemoRealTerminal( QStringLiteral("teach"),
|
QStringLiteral("1_A3"),
|
||||||
lvl_4)};
|
lvl_3)};
|
||||||
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
new DemoPhysicalTerminal {real_terminals_vector}};
|
new DemoRealTerminal( QStringLiteral("teach"),
|
||||||
|
QStringLiteral("1_A4"),
|
||||||
|
lvl_4)};
|
||||||
|
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
||||||
|
new DemoPhysicalTerminal {real_terminals_vector}};
|
||||||
|
|
||||||
real_terminals_vector.clear();
|
real_terminals_vector.clear();
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
new DemoRealTerminal( QStringLiteral("24vdc"),
|
new DemoRealTerminal( QStringLiteral("24vdc"),
|
||||||
lvl_1)};
|
QStringLiteral("2_A1"),
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
lvl_1)};
|
||||||
new DemoRealTerminal( QStringLiteral("0vdc"),
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
lvl_2)};
|
new DemoRealTerminal( QStringLiteral("0vdc"),
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
QStringLiteral("2_A2"),
|
||||||
new DemoRealTerminal( QStringLiteral("signal"),
|
lvl_2)};
|
||||||
lvl_3)};
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
new DemoRealTerminal( QStringLiteral("signal"),
|
||||||
new DemoRealTerminal( QStringLiteral("teach"),
|
QStringLiteral("2_A3"),
|
||||||
lvl_4)};
|
lvl_3)};
|
||||||
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
new DemoPhysicalTerminal {real_terminals_vector}};
|
new DemoRealTerminal( QStringLiteral("teach"),
|
||||||
|
QStringLiteral("2_A4"),
|
||||||
|
lvl_4)};
|
||||||
|
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
||||||
|
new DemoPhysicalTerminal {real_terminals_vector}};
|
||||||
|
|
||||||
|
|
||||||
real_terminals_vector.clear();
|
real_terminals_vector.clear();
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
new DemoRealTerminal( QStringLiteral("24vdc"),
|
new DemoRealTerminal( QStringLiteral("24vdc"),
|
||||||
lvl_1)};
|
QStringLiteral("3_A1"),
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
lvl_1)};
|
||||||
new DemoRealTerminal( QStringLiteral("0vdc"),
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
lvl_2)};
|
new DemoRealTerminal( QStringLiteral("0vdc"),
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
QStringLiteral("3_A2"),
|
||||||
new DemoRealTerminal( QStringLiteral("signal"),
|
lvl_2)};
|
||||||
lvl_3)};
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
new DemoRealTerminal( QStringLiteral("signal"),
|
||||||
new DemoRealTerminal( QStringLiteral("teach"),
|
QStringLiteral("3_A3"),
|
||||||
lvl_4)};
|
lvl_3)};
|
||||||
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
real_terminals_vector << QSharedPointer<AbstractRealTerminalInterface> {
|
||||||
new DemoPhysicalTerminal {real_terminals_vector}};
|
new DemoRealTerminal( QStringLiteral("teach"),
|
||||||
|
QStringLiteral("3_A4"),
|
||||||
|
lvl_4)};
|
||||||
|
m_physical_terminal << QSharedPointer<AbstractPhysicalTerminalInterface> {
|
||||||
|
new DemoPhysicalTerminal {real_terminals_vector}};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "terminalstriplayoutpattern.h"
|
#include "terminalstriplayoutpattern.h"
|
||||||
#include "../../../utils/qetutils.h"
|
#include "../../../utils/qetutils.h"
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
TerminalStripLayoutPattern::TerminalStripLayoutPattern()
|
TerminalStripLayoutPattern::TerminalStripLayoutPattern()
|
||||||
{
|
{
|
||||||
@@ -80,6 +79,29 @@ QTextOption TerminalStripLayoutPattern::terminalsTextOption() const
|
|||||||
return m_terminals_text_option;
|
return m_terminals_text_option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TerminalStripLayoutPattern::setXrefTextAlignment
|
||||||
|
* Set text alignment to @param alignment. If alignment have no
|
||||||
|
* flag this function do nothing
|
||||||
|
* @param alignment
|
||||||
|
*/
|
||||||
|
void TerminalStripLayoutPattern::setXrefTextAlignment(const Qt::Alignment &alignment)
|
||||||
|
{
|
||||||
|
if (!alignment) return;
|
||||||
|
m_xref_text_alignment = alignment;
|
||||||
|
updateTerminalsTextOption();
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::Alignment TerminalStripLayoutPattern::xrefTextAlignment() const
|
||||||
|
{
|
||||||
|
return m_xref_text_alignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextOption TerminalStripLayoutPattern::xrefTextOption() const
|
||||||
|
{
|
||||||
|
return m_xref_text_option;
|
||||||
|
}
|
||||||
|
|
||||||
void TerminalStripLayoutPattern::updateHeaderTextOption()
|
void TerminalStripLayoutPattern::updateHeaderTextOption()
|
||||||
{
|
{
|
||||||
m_header_text_option.setAlignment(m_header_text_alignment);
|
m_header_text_option.setAlignment(m_header_text_alignment);
|
||||||
@@ -90,4 +112,7 @@ void TerminalStripLayoutPattern::updateTerminalsTextOption()
|
|||||||
{
|
{
|
||||||
m_terminals_text_option.setAlignment(m_terminals_text_alignment);
|
m_terminals_text_option.setAlignment(m_terminals_text_alignment);
|
||||||
m_terminals_text_option.setWrapMode(QTextOption::WordWrap);
|
m_terminals_text_option.setWrapMode(QTextOption::WordWrap);
|
||||||
|
|
||||||
|
m_xref_text_option.setAlignment(m_xref_text_alignment);
|
||||||
|
m_xref_text_option.setWrapMode(QTextOption::WordWrap);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,14 @@ class TerminalStripLayoutPattern
|
|||||||
qreal m_terminals_text_y{35};
|
qreal m_terminals_text_y{35};
|
||||||
Qt::Orientation m_terminals_text_orientation {Qt::Vertical};
|
Qt::Orientation m_terminals_text_orientation {Qt::Vertical};
|
||||||
|
|
||||||
|
//Xref text
|
||||||
|
void setXrefTextAlignment(const Qt::Alignment &alignment);
|
||||||
|
Qt::Alignment xrefTextAlignment() const;
|
||||||
|
QTextOption xrefTextOption() const;
|
||||||
|
qreal m_xref_text_height{60};
|
||||||
|
qreal m_xref_text_y{95};
|
||||||
|
Qt::Orientation m_xref_text_orientation {Qt::Vertical};
|
||||||
|
|
||||||
qreal m_bridge_point_d{5};
|
qreal m_bridge_point_d{5};
|
||||||
QVector<qreal> m_bridge_point_y_offset{50,70,90,110};
|
QVector<qreal> m_bridge_point_y_offset{50,70,90,110};
|
||||||
|
|
||||||
@@ -89,8 +97,12 @@ class TerminalStripLayoutPattern
|
|||||||
Qt::Alignment m_header_text_alignment{Qt::AlignCenter};
|
Qt::Alignment m_header_text_alignment{Qt::AlignCenter};
|
||||||
QTextOption m_header_text_option;
|
QTextOption m_header_text_option;
|
||||||
|
|
||||||
Qt::Alignment m_terminals_text_alignment {Qt::AlignRight | Qt::AlignVCenter};
|
Qt::Alignment
|
||||||
QTextOption m_terminals_text_option{QTextOption()};
|
m_terminals_text_alignment {Qt::AlignRight | Qt::AlignVCenter},
|
||||||
|
m_xref_text_alignment {Qt::AlignLeft | Qt::AlignVCenter};
|
||||||
|
QTextOption
|
||||||
|
m_terminals_text_option{QTextOption()},
|
||||||
|
m_xref_text_option{QTextOption()};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TERMINALSTRIPLAYOUTPATTERN_H
|
#endif // TERMINALSTRIPLAYOUTPATTERN_H
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "terminalstripdrawer.h"
|
#include "terminalstripdrawer.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
namespace TerminalStripDrawer {
|
namespace TerminalStripDrawer {
|
||||||
@@ -111,6 +112,12 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
|||||||
const auto terminals_text_y{m_pattern->m_terminals_text_y};
|
const auto terminals_text_y{m_pattern->m_terminals_text_y};
|
||||||
QRectF terminal_rect;
|
QRectF terminal_rect;
|
||||||
|
|
||||||
|
const auto xref_text_orientation{m_pattern->m_xref_text_orientation};
|
||||||
|
const auto xref_text_option{m_pattern->xrefTextOption()};
|
||||||
|
const auto xref_text_height{m_pattern->m_xref_text_height};
|
||||||
|
const auto xref_text_y{m_pattern->m_xref_text_y};
|
||||||
|
QRectF xref_rect;
|
||||||
|
|
||||||
QHash<QUuid, QVector<QPointF>> bridges_anchor_points;
|
QHash<QUuid, QVector<QPointF>> bridges_anchor_points;
|
||||||
|
|
||||||
//Loop over physical terminals
|
//Loop over physical terminals
|
||||||
@@ -170,9 +177,9 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto shared_real_terminal{real_terminal_vector[i]};
|
const auto shared_real_terminal{real_terminal_vector[i]};
|
||||||
painter->drawText(text_rect,
|
painter->drawText(text_rect,
|
||||||
shared_real_terminal ? shared_real_terminal->label() : QLatin1String(),
|
shared_real_terminal ? shared_real_terminal->label() : QLatin1String(),
|
||||||
terminals_text_option);
|
terminals_text_option);
|
||||||
|
|
||||||
if (m_preview_draw)
|
if (m_preview_draw)
|
||||||
{
|
{
|
||||||
@@ -182,6 +189,25 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
|||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
||||||
|
//Draw xref
|
||||||
|
auto xref_string = shared_real_terminal->xref();
|
||||||
|
painter->save();
|
||||||
|
xref_rect.setRect(0, xref_text_y, terminal_rect.width(), xref_text_height);
|
||||||
|
if (xref_text_orientation == Qt::Vertical)
|
||||||
|
{
|
||||||
|
painter->translate(xref_rect.bottomLeft());
|
||||||
|
painter->rotate(270);
|
||||||
|
xref_rect.setRect(0, 0, xref_rect.height(), xref_rect.width());
|
||||||
|
}
|
||||||
|
painter->drawText(xref_rect, xref_string, xref_text_option);
|
||||||
|
|
||||||
|
if (m_preview_draw)
|
||||||
|
{
|
||||||
|
painter->setPen(Qt::blue);
|
||||||
|
painter->drawRect(xref_rect);
|
||||||
|
}
|
||||||
|
painter->restore();
|
||||||
|
|
||||||
//Add bridge anchor
|
//Add bridge anchor
|
||||||
if (shared_real_terminal->isBridged())
|
if (shared_real_terminal->isBridged())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace TerminalStripDrawer
|
|||||||
virtual QString label() const = 0;
|
virtual QString label() const = 0;
|
||||||
virtual bool isBridged() const = 0;
|
virtual bool isBridged() const = 0;
|
||||||
virtual AbstractBridgeInterface* bridge() const = 0;
|
virtual AbstractBridgeInterface* bridge() const = 0;
|
||||||
|
virtual QString xref() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AbstractPhysicalTerminalInterface
|
class AbstractPhysicalTerminalInterface
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "../realterminal.h"
|
#include "../realterminal.h"
|
||||||
#include "../terminalstrip.h"
|
#include "../terminalstrip.h"
|
||||||
#include "../terminalstripbridge.h"
|
#include "../terminalstripbridge.h"
|
||||||
|
#include "../../autoNum/assignvariables.h"
|
||||||
|
|
||||||
#include "terminalstripdrawer.h"
|
#include "terminalstripdrawer.h"
|
||||||
|
|
||||||
@@ -118,6 +119,15 @@ namespace TerminalStripDrawer
|
|||||||
return new TrueBridge(m_real->bridge());
|
return new TrueBridge(m_real->bridge());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString TrueRealTerminal::xref() const
|
||||||
|
{
|
||||||
|
if (m_real && m_real->isElement()) {
|
||||||
|
return autonum::AssignVariables::genericXref(m_real->element());
|
||||||
|
} else {
|
||||||
|
return QString{};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TrueBridge::TrueBridge(QSharedPointer<TerminalStripBridge> bridge) :
|
TrueBridge::TrueBridge(QSharedPointer<TerminalStripBridge> bridge) :
|
||||||
m_bridge { bridge }
|
m_bridge { bridge }
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ namespace TerminalStripDrawer
|
|||||||
QString label() const override;
|
QString label() const override;
|
||||||
bool isBridged() const override;
|
bool isBridged() const override;
|
||||||
AbstractBridgeInterface* bridge() const override;
|
AbstractBridgeInterface* bridge() const override;
|
||||||
|
QString xref() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedPointer<RealTerminal> m_real;
|
QSharedPointer<RealTerminal> m_real;
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ void TerminalStripLayoutEditor::valueEdited()
|
|||||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignRight | Qt::AlignVCenter); break;
|
m_layout.data()->setHeaderTextAlignment(Qt::AlignRight | Qt::AlignVCenter); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Terminal text
|
||||||
m_layout.data()->m_terminals_text_orientation = ui->m_terminal_text_orientation_cb->currentIndex() == 0 ?
|
m_layout.data()->m_terminals_text_orientation = ui->m_terminal_text_orientation_cb->currentIndex() == 0 ?
|
||||||
Qt::Horizontal :
|
Qt::Horizontal :
|
||||||
Qt::Vertical;
|
Qt::Vertical;
|
||||||
@@ -127,6 +128,26 @@ void TerminalStripLayoutEditor::valueEdited()
|
|||||||
m_layout.data()->m_terminals_text_y = ui->m_terminal_text_y_sb->value();
|
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();
|
m_layout.data()->m_terminals_text_height = ui->m_terminal_text_height_sb->value();
|
||||||
|
|
||||||
|
//Xref text
|
||||||
|
m_layout.data()->m_xref_text_orientation = ui->m_xref_orientation_cb->currentIndex() == 0 ?
|
||||||
|
Qt::Horizontal :
|
||||||
|
Qt::Vertical;
|
||||||
|
|
||||||
|
switch (ui->m_xref_alignment_cb->currentIndex()) {
|
||||||
|
case 0:
|
||||||
|
m_layout.data()->setXrefTextAlignment(Qt::Alignment {Qt::AlignLeft | Qt::AlignVCenter});
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
m_layout.data()->setXrefTextAlignment(Qt::Alignment { Qt::AlignHCenter | Qt::AlignVCenter});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_layout.data()->setXrefTextAlignment(Qt::Alignment { Qt::AlignRight | Qt::AlignVCenter});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_layout.data()->m_xref_text_y = ui->m_xref_y_sb->value();
|
||||||
|
m_layout.data()->m_xref_text_height = ui->m_xref_height_sb->value();
|
||||||
|
|
||||||
updateUi();
|
updateUi();
|
||||||
m_preview_strip_item.update();
|
m_preview_strip_item.update();
|
||||||
}
|
}
|
||||||
@@ -200,6 +221,7 @@ void TerminalStripLayoutEditor::updateUi()
|
|||||||
ui->m_header_text_alignment_cb->setCurrentIndex(2);
|
ui->m_header_text_alignment_cb->setCurrentIndex(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Terminal text
|
||||||
const auto terminal_alignment = data->terminalsTextAlignment();
|
const auto terminal_alignment = data->terminalsTextAlignment();
|
||||||
if (terminal_alignment &Qt::AlignLeft) {
|
if (terminal_alignment &Qt::AlignLeft) {
|
||||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(0);
|
ui->m_terminal_text_alignment_cb->setCurrentIndex(0);
|
||||||
@@ -212,6 +234,25 @@ void TerminalStripLayoutEditor::updateUi()
|
|||||||
ui->m_terminal_text_y_sb->setValue(data->m_terminals_text_y);
|
ui->m_terminal_text_y_sb->setValue(data->m_terminals_text_y);
|
||||||
ui->m_terminal_text_height_sb->setValue(data->m_terminals_text_height);
|
ui->m_terminal_text_height_sb->setValue(data->m_terminals_text_height);
|
||||||
|
|
||||||
|
//Xref text
|
||||||
|
if (data->m_xref_text_orientation == Qt::Horizontal) {
|
||||||
|
ui->m_xref_orientation_cb->setCurrentIndex(0);
|
||||||
|
} else {
|
||||||
|
ui->m_xref_orientation_cb->setCurrentIndex(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto xref_alignment = data->xrefTextAlignment();
|
||||||
|
if (xref_alignment &Qt::AlignLeft) {
|
||||||
|
ui->m_xref_alignment_cb->setCurrentIndex(0);
|
||||||
|
} else if (xref_alignment &Qt::AlignHCenter) {
|
||||||
|
ui->m_xref_alignment_cb->setCurrentIndex(1);
|
||||||
|
} else if (xref_alignment &Qt::AlignRight) {
|
||||||
|
ui->m_xref_alignment_cb->setCurrentIndex(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->m_xref_y_sb->setValue(data->m_xref_text_y);
|
||||||
|
ui->m_xref_height_sb->setValue(data->m_xref_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>683</width>
|
<width>961</width>
|
||||||
<height>589</height>
|
<height>624</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SizeConstraint::SetMaximumSize</enum>
|
<enum>QLayout::SetMaximumSize</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="4" column="2">
|
<item row="4" column="2">
|
||||||
<widget class="QSpinBox" name="m_width_terminal_0_sb">
|
<widget class="QSpinBox" name="m_width_terminal_0_sb">
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<item row="3" column="0" colspan="4">
|
<item row="3" column="0" colspan="4">
|
||||||
<widget class="Line" name="line">
|
<widget class="Line" name="line">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
<item row="11" column="0" colspan="5">
|
<item row="11" column="0" colspan="5">
|
||||||
<widget class="Line" name="line_2">
|
<widget class="Line" name="line_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -213,13 +213,6 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<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">
|
<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>
|
||||||
@@ -253,38 +246,17 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="5">
|
|
||||||
<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="5" column="2">
|
<item row="5" column="2">
|
||||||
<widget class="QLabel" name="label_14">
|
<widget class="QLabel" name="label_14">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Orientation du texte d'en tête :</string>
|
<string>Orientation</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="6" column="2">
|
||||||
<widget class="QLabel" name="label_15">
|
<widget class="QLabel" name="label_15">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Alignement du texte d'en tête :</string>
|
<string>Alignement</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>
|
||||||
@@ -330,7 +302,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@@ -343,7 +315,48 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="5">
|
<item row="2" column="3">
|
||||||
|
<widget class="QLabel" name="label_20">
|
||||||
|
<property name="text">
|
||||||
|
<string>Texte d'en tête</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="2">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Origine vertical</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="2">
|
||||||
|
<widget class="QLabel" name="label_19">
|
||||||
|
<property name="text">
|
||||||
|
<string>Longueur maximal</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="4">
|
||||||
|
<widget class="QSpinBox" name="m_terminal_text_y_sb">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="4">
|
||||||
|
<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="6" column="4">
|
||||||
<widget class="QComboBox" name="m_terminal_text_alignment_cb">
|
<widget class="QComboBox" name="m_terminal_text_alignment_cb">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -362,30 +375,87 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="5">
|
<item row="5" column="4">
|
||||||
<widget class="QSpinBox" name="m_terminal_text_height_sb">
|
<widget class="QComboBox" name="m_terminal_text_orientation_cb">
|
||||||
<property name="minimum">
|
<item>
|
||||||
<number>30</number>
|
<property name="text">
|
||||||
|
<string>Horizontal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Vertical</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="4">
|
||||||
|
<widget class="QLabel" name="label_21">
|
||||||
|
<property name="text">
|
||||||
|
<string>Texte borne</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="5">
|
||||||
|
<widget class="QLabel" name="label_22">
|
||||||
|
<property name="text">
|
||||||
|
<string>Référence croisée</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="5">
|
||||||
|
<widget class="QComboBox" name="m_xref_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="5">
|
||||||
|
<widget class="QComboBox" name="m_xref_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="7" column="5">
|
||||||
|
<widget class="QSpinBox" name="m_xref_y_sb">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>1000</number>
|
<number>1000</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="4">
|
<item row="8" column="5">
|
||||||
<widget class="QLabel" name="label_16">
|
<widget class="QSpinBox" name="m_xref_height_sb">
|
||||||
<property name="text">
|
<property name="minimum">
|
||||||
<string>Orientation du texte de borne :</string>
|
<number>30</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="maximum">
|
||||||
</item>
|
<number>1000</number>
|
||||||
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -430,7 +500,7 @@
|
|||||||
<item row="9" column="0" colspan="5">
|
<item row="9" column="0" colspan="5">
|
||||||
<widget class="Line" name="line_5">
|
<widget class="Line" name="line_5">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -960,6 +1030,70 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_xref_alignment_cb</sender>
|
||||||
|
<signal>currentIndexChanged(int)</signal>
|
||||||
|
<receiver>TerminalStripLayoutEditor</receiver>
|
||||||
|
<slot>valueEdited()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>836</x>
|
||||||
|
<y>365</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>480</x>
|
||||||
|
<y>311</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_xref_height_sb</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>TerminalStripLayoutEditor</receiver>
|
||||||
|
<slot>valueEdited()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>836</x>
|
||||||
|
<y>431</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>480</x>
|
||||||
|
<y>311</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_xref_orientation_cb</sender>
|
||||||
|
<signal>currentIndexChanged(int)</signal>
|
||||||
|
<receiver>TerminalStripLayoutEditor</receiver>
|
||||||
|
<slot>valueEdited()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>836</x>
|
||||||
|
<y>333</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>480</x>
|
||||||
|
<y>311</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_xref_y_sb</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>TerminalStripLayoutEditor</receiver>
|
||||||
|
<slot>valueEdited()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>836</x>
|
||||||
|
<y>398</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>480</x>
|
||||||
|
<y>311</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>valueEdited()</slot>
|
<slot>valueEdited()</slot>
|
||||||
|
|||||||
@@ -117,6 +117,13 @@ QDomElement TerminalStripLayoutPatternXml::toXml(const QSharedPointer<TerminalSt
|
|||||||
QETSVG::heightToAttribute(pattern->m_terminals_text_height, terminals_text_xml);
|
QETSVG::heightToAttribute(pattern->m_terminals_text_height, terminals_text_xml);
|
||||||
terminals_xml.appendChild(terminals_text_xml);
|
terminals_xml.appendChild(terminals_text_xml);
|
||||||
|
|
||||||
|
auto xref_text_xml = document.createElement(QStringLiteral("xref"));
|
||||||
|
QETXML::orientationToAttribute(pattern->m_xref_text_orientation, xref_text_xml);
|
||||||
|
QETXML::alignmentToAttribute(pattern->xrefTextAlignment(),xref_text_xml);
|
||||||
|
QETSVG::yToAttribute(pattern->m_xref_text_y, xref_text_xml);
|
||||||
|
QETSVG::heightToAttribute(pattern->m_xref_text_height, xref_text_xml);
|
||||||
|
terminals_xml.appendChild(xref_text_xml);
|
||||||
|
|
||||||
auto bridge_xml = document.createElement(QStringLiteral("bridges"));
|
auto bridge_xml = document.createElement(QStringLiteral("bridges"));
|
||||||
QETSVG::rToAttribute(pattern->m_bridge_point_d/2, bridge_xml);
|
QETSVG::rToAttribute(pattern->m_bridge_point_d/2, bridge_xml);
|
||||||
QVector<QPointF> points_vector;
|
QVector<QPointF> points_vector;
|
||||||
@@ -176,6 +183,14 @@ void TerminalStripLayoutPatternXml::fromXml(QSharedPointer<TerminalStripLayoutPa
|
|||||||
layout->m_terminals_text_height = QETSVG::heightFromAttribute(terminals_text_xml);
|
layout->m_terminals_text_height = QETSVG::heightFromAttribute(terminals_text_xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (const auto xref_text_xml = terminals_xml.firstChildElement(QStringLiteral("xref"));
|
||||||
|
!xref_text_xml.isNull()) {
|
||||||
|
layout->m_xref_text_orientation = QETXML::orientationFromAttribute(xref_text_xml, layout->m_xref_text_orientation);
|
||||||
|
layout->setXrefTextAlignment(QETXML::alignmentFromAttribute(xref_text_xml));
|
||||||
|
layout->m_xref_text_y = QETSVG::yFromAttribute(xref_text_xml);
|
||||||
|
layout->m_xref_text_height = QETSVG::heightFromAttribute(xref_text_xml);
|
||||||
|
}
|
||||||
|
|
||||||
if (const auto bridge_xml = terminals_xml.firstChildElement(QStringLiteral("bridges"));
|
if (const auto bridge_xml = terminals_xml.firstChildElement(QStringLiteral("bridges"));
|
||||||
!bridge_xml.isNull()) {
|
!bridge_xml.isNull()) {
|
||||||
layout->m_bridge_point_d = QETSVG::rFromAttribute(bridge_xml, 2.5)*2;
|
layout->m_bridge_point_d = QETSVG::rFromAttribute(bridge_xml, 2.5)*2;
|
||||||
|
|||||||
Reference in New Issue
Block a user