mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-17 23:59:58 +01:00
Change some int to qreal
Made this change to be more compliant with svg
This commit is contained in:
@@ -44,38 +44,38 @@ class TerminalStripLayoutPattern
|
||||
TerminalStripLayoutPattern();
|
||||
|
||||
//Header of terminal strip
|
||||
QRect m_header_rect{0,30,50,130};
|
||||
QRectF m_header_rect{0,30,50,130};
|
||||
Qt::Orientation m_header_text_orientation{Qt::Horizontal};
|
||||
void setHeaderTextAlignment(const Qt::Alignment &alignment);
|
||||
Qt::Alignment headerTextAlignment() const;
|
||||
QTextOption headerTextOption() const;
|
||||
|
||||
//Spacer between the header and the terminals
|
||||
QRect m_spacer_rect{0, 50, 10, 90};
|
||||
QRectF m_spacer_rect{0, 50, 10, 90};
|
||||
|
||||
//Font
|
||||
QFont font() const;
|
||||
void setFont (const QFont &font);
|
||||
|
||||
//Terminals
|
||||
QVector<QRect> m_terminal_rect
|
||||
QVector<QRectF> m_terminal_rect
|
||||
{
|
||||
QRect{0, 0, 20, 190},
|
||||
QRect{0, 10, 20, 170},
|
||||
QRect{0, 20, 20, 150},
|
||||
QRect{0, 30, 20, 130}
|
||||
QRectF{0, 0, 20, 190},
|
||||
QRectF{0, 10, 20, 170},
|
||||
QRectF{0, 20, 20, 150},
|
||||
QRectF{0, 30, 20, 130}
|
||||
};
|
||||
|
||||
//Terminal text
|
||||
void setTerminalsTextAlignment(const Qt::Alignment &alignment);
|
||||
Qt::Alignment terminalsTextAlignment() const;
|
||||
QTextOption terminalsTextOption() const;
|
||||
int m_terminals_text_height{50};
|
||||
int m_terminals_text_y{35};
|
||||
qreal m_terminals_text_height{50};
|
||||
qreal m_terminals_text_y{35};
|
||||
Qt::Orientation m_terminals_text_orientation {Qt::Vertical};
|
||||
|
||||
int m_bridge_point_d{5};
|
||||
QVector<int> m_bridge_point_y_offset{50,70,90,110};
|
||||
qreal m_bridge_point_d{5};
|
||||
QVector<qreal> m_bridge_point_y_offset{50,70,90,110};
|
||||
|
||||
QUuid m_uuid{QUuid::createUuid()};
|
||||
QString m_name;
|
||||
|
||||
@@ -95,7 +95,7 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
//Move painter pos to next drawing
|
||||
painter->translate(m_pattern->m_header_rect.width(),0);
|
||||
|
||||
int x_offset{m_pattern->m_header_rect.width()};
|
||||
qreal x_offset{m_pattern->m_header_rect.width()};
|
||||
|
||||
//Draw spacer
|
||||
painter->drawRect(m_pattern->m_spacer_rect);
|
||||
@@ -109,7 +109,7 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
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;
|
||||
QRectF terminal_rect;
|
||||
|
||||
QHash<QUuid, QVector<QPointF>> bridges_anchor_points;
|
||||
|
||||
@@ -145,7 +145,7 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
//We can't use terminal_rect.bottomLeft for p2 because
|
||||
//the returned value deviate from the true value
|
||||
//(see Qt documentation about QRect)
|
||||
const QPoint p2 { p1.x(), p1.y() + terminal_rect.height() };
|
||||
const QPointF p2 { p1.x(), p1.y() + terminal_rect.height() };
|
||||
painter->drawLine(p1, p2);
|
||||
painter->restore();
|
||||
}
|
||||
@@ -154,8 +154,8 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen(Qt::yellow);
|
||||
painter->drawLine(QPoint{terminal_rect.x(), terminal_rect.y() + terminal_rect.height()/2},
|
||||
QPoint{terminal_rect.width(), terminal_rect.y() + terminal_rect.height()/2});
|
||||
painter->drawLine(QPointF{terminal_rect.x(), terminal_rect.y() + terminal_rect.height()/2},
|
||||
QPointF{terminal_rect.width(), terminal_rect.y() + terminal_rect.height()/2});
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
|
||||
QRectF TerminalStripDrawer::boundingRect() const
|
||||
{
|
||||
return QRect{0, 0, width(), height()};;
|
||||
return QRectF{0, 0, width(), height()};;
|
||||
}
|
||||
|
||||
void TerminalStripDrawer::setLayout(QSharedPointer<TerminalStripLayoutPattern> layout)
|
||||
@@ -243,7 +243,7 @@ void TerminalStripDrawer::setPreviewDraw(bool draw) {
|
||||
m_preview_draw = draw;
|
||||
}
|
||||
|
||||
int TerminalStripDrawer::height() const
|
||||
qreal TerminalStripDrawer::height() const
|
||||
{
|
||||
if (m_pattern)
|
||||
{
|
||||
@@ -261,11 +261,11 @@ int TerminalStripDrawer::height() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TerminalStripDrawer::width() const
|
||||
qreal TerminalStripDrawer::width() const
|
||||
{
|
||||
if (m_pattern)
|
||||
{
|
||||
int width_{m_pattern->m_header_rect.width() + m_pattern->m_spacer_rect.width()};
|
||||
qreal width_{m_pattern->m_header_rect.width() + m_pattern->m_spacer_rect.width()};
|
||||
|
||||
if (m_strip)
|
||||
{
|
||||
|
||||
@@ -80,8 +80,8 @@ namespace TerminalStripDrawer
|
||||
void setPreviewDraw(bool draw = true);
|
||||
|
||||
private:
|
||||
int height() const;
|
||||
int width() const;
|
||||
qreal height() const;
|
||||
qreal width() const;
|
||||
|
||||
private:
|
||||
QSharedPointer <AbstractTerminalStripInterface> m_strip;
|
||||
|
||||
Reference in New Issue
Block a user