Fix code style

This commit is contained in:
Simon De Backer 2020-09-18 23:05:57 +02:00
parent 176dcd376b
commit b7c8ae88e2

View File

@ -23,6 +23,8 @@
// uncomment the line below to get more debug information
//#define TITLEBLOCK_TEMPLATE_DEBUG
#include <QRegularExpression>
#include <QRegularExpressionMatch>
/**
@brief TitleBlockTemplate::TitleBlockTemplate
Constructor
@ -1825,7 +1827,8 @@ void TitleBlockTemplate::renderTextCell(QPainter &painter,
@param h
@param color
*/
void TitleBlockTemplate::renderTextCellDxf(QString &file_path,
void TitleBlockTemplate::renderTextCellDxf(
QString &file_path,
const QString &text,
const TitleBlockCell &cell,
qreal x,
@ -1848,23 +1851,33 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path,
x2 = x; // default
if ( cell.alignment & Qt::AlignTop ) {
if ( cell.alignment & Qt::AlignTop )
{
vAlign = 3;
y1 = y + h - (textHeight*Createdxf::yScale / 8);
} else if ( cell.alignment & Qt::AlignVCenter ) {
}
else if ( cell.alignment & Qt::AlignVCenter )
{
vAlign = 2;
y1 = y + h/2;
} else if ( cell.alignment & Qt::AlignBottom ) {
}
else if ( cell.alignment & Qt::AlignBottom )
{
y1 = y + (textHeight*Createdxf::yScale / 8);
}
if ( cell.alignment & Qt::AlignRight ) {
if ( cell.alignment & Qt::AlignRight )
{
hAlign = 2;
x2 = x + w;
} else if ( cell.alignment & Qt::AlignHCenter ) {
}
else if ( cell.alignment & Qt::AlignHCenter )
{
hAlign = 1;
x2 = x + w/2;
} else if (cell.alignment & Qt::AlignJustify ) {
}
else if (cell.alignment & Qt::AlignJustify )
{
hAlign = 5;
vAlign = 0;
x2 = x + w;
@ -1874,7 +1887,8 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path,
//painter.setFont(text_font);
qreal ratio = 1.0;
if (cell.hadjust) {
if (cell.hadjust)
{
// Scale font width to fit string in cell width w
// As DXF font aspect ratio is implementation dependent we add a fudge-factor based on tests with AutoCAD
int len = text.length() * textHeight * Createdxf::xScale * 1.2;
@ -1884,7 +1898,8 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path,
}
// x offset value below currently set heuristically based on appearance...
Createdxf::drawTextAligned(file_path,
Createdxf::drawTextAligned(
file_path,
text,
x - 2*Createdxf::xScale,
y1,
@ -2019,7 +2034,8 @@ bool TitleBlockTemplate::checkCellSpan(TitleBlockCell *cell) {
@param cell :
Potentially spanning cell
*/
void TitleBlockTemplate::applyCellSpan(TitleBlockCell *cell) {
void TitleBlockTemplate::applyCellSpan(TitleBlockCell *cell)
{
if (!cell || (!cell -> row_span && !cell -> col_span)) return;
if (cell -> span_state == TitleBlockCell::Disabled) return;