29 #define MIN_COLUMN_COUNT 3 30 #define MIN_ROW_COUNT 3 31 #define MIN_COLUMN_WIDTH 5.0 32 #define MIN_ROW_HEIGHT 5.0 47 if (!QRegExp(
"4\\.[0-7]\\.").exactMatch(qVersion())) {
75 if (
m_edge == Qt::BottomEdge)
93 if (
m_edge == Qt::BottomEdge)
160 return QRectF (left, top, width, height);
187 xml_elmt.setAttribute(
"colsize", QString(
"%1").arg(
columnsWidth()));
190 xml_elmt.setAttribute(
"rows",
rowsCount());
191 xml_elmt.setAttribute(
"rowsize", QString(
"%1").arg(
rowsHeight()));
192 xml_elmt.setAttribute(
"displayrows",
rowsAreDisplayed() ?
"true" :
"false");
195 xml_elmt.setAttribute(
"height", QString(
"%1").arg(
diagramHeight()));
205 int cols_count = xml_elmt.attribute(
"cols").toInt(&ok);
209 double cols_width = xml_elmt.attribute(
"colsize").toDouble(&ok);
213 if (xml_elmt.hasAttribute(
"rows") && xml_elmt.hasAttribute(
"rowsize")) {
215 int rows_count = xml_elmt.attribute(
"rows").toInt(&ok);
219 double rows_size = xml_elmt.attribute(
"rowsize").toDouble(&ok);
223 double height = xml_elmt.attribute(
"height").toDouble(&ok);
229 displayRows(xml_elmt.attribute(
"displayrows") !=
"false");
336 return((tbt_name ==
"default") ?
"" : tbt_name);
436 pen.setCosmetic(
true);
437 painter -> setPen(pen);
438 painter -> setBrush(Qt::NoBrush);
450 QRectF first_rectangle(
456 painter -> drawRect(first_rectangle);
462 QRectF numbered_rectangle = QRectF(
468 painter -> drawRect(numbered_rectangle);
469 if (settings.value(
"border-columns_0",
true).toBool()){
470 painter -> drawText(numbered_rectangle, Qt::AlignVCenter | Qt::AlignCenter, QString(
"%1").arg(i - 1));
472 painter -> drawText(numbered_rectangle, Qt::AlignVCenter | Qt::AlignCenter, QString(
"%1").arg(i));
479 QString row_string(
"A");
481 QRectF lettered_rectangle = QRectF(
487 painter -> drawRect(lettered_rectangle);
488 painter -> drawText(lettered_rectangle, Qt::AlignVCenter | Qt::AlignCenter, row_string);
496 if (
m_edge == Qt::BottomEdge)
498 painter -> translate(tbt_rect.topLeft());
500 painter -> translate(-tbt_rect.topLeft());
504 painter->translate(tbt_rect.topLeft());
505 painter->rotate(-90);
508 painter -> translate(-tbt_rect.topLeft());
512 painter -> restore();
516 Q_UNUSED (width); Q_UNUSED (height); Q_UNUSED (keep_aspect_ratio);
552 if (settings.value(
"border-columns_0",
true).toBool()){
554 yCoord + recHeight*0.5, recHeight*0.7, 0, 0, 1, 2, xCoord+recWidth/2, color, 0);
557 yCoord + recHeight*0.5, recHeight*0.7, 0, 0, 1, 2, xCoord+recWidth/2, color, 0);
565 QString row_string(
"A");
575 yCoord + recHeight*0.5, recWidth*0.7, 0, 0, 1, 2, xCoord+recWidth/2, color, 0);
689 int row_number = int(ceil(relative_pos.x() /
columnsWidth()));
690 int column_number = int(ceil(relative_pos.y() /
rowsHeight()));
692 QString letter =
"A";
693 for (
int i = 1 ; i < column_number ; ++ i)
772 if (
string.isEmpty()) {
776 QString first_digits(
string.left(
string.count() - 1));
777 QChar last_digit(
string.at(
string.count() - 1));
778 if (last_digit !=
'Z') {
780 last_digit = last_digit.toLatin1() + 1;
781 return(first_digits + QString(last_digit));
794 if (index < 1 || total < 1 || index > total)
return;
QString autoPageNum() const
TitleBlockTemplateRenderer * titleblock_template_renderer_
void displayColumns(bool)
QString locmach
Location(displayed by the default template)
QRectF columnsRect() const
BorderTitleBlock::columnsRect.
static TitleBlockTemplate * defaultTitleBlockTemplate()
void setFolioData(int, int, const QString &=nullptr, const DiagramContext &=DiagramContext())
void updateDiagramContextForTitleBlock(const DiagramContext &=DiagramContext())
DiagramContext additional_fields_
From an embedded collection (a project for exemple)
DiagramPosition convertPosition(const QPointF &)
BorderTitleBlock::convertPosition Convert a Point in cartesian coordinate (x : 12.5, 56.9) to a point in grid coordinate (ex : B2)
QString plant
Plant (displayed by the default template)
void setColumnsHeaderHeight(const qreal &)
QRectF outsideBorderRect() const
BorderTitleBlock::outsideBorderRect.
Qt::Edge display_at
Edge to display the titleblock.
static const qreal margin
margin around the diagram
qreal diagramHeight() const
static void drawRectangle(const QString &filepath, double, double, double, double, const int &colorcode)
void drawDxf(int, int, bool, QString &, int)
QRectF insideBorderRect() const
BorderTitleBlock::insideBorderRect.
void setTitle(const QString &title)
BorderTitleBlock::setTitle.
void setFileName(const QString &filename)
BorderTitleBlock::setFileName.
void borderFromXml(const QDomElement &)
TitleBlockProperties exportTitleBlock()
const TitleBlockTemplate * titleBlockTemplate()
QRectF rowsRect() const
BorderTitleBlock::rowsRect.
const QString displayedVersion
QElectroTech displayed version.
static const double sheetHeight
void toXml(QDomElement &) const
QRectF borderAndTitleBlockRect() const
BorderTitleBlock::borderAndTitleBlockRect.
void displayTitleBlock(bool)
QString incrementLetters(const QString &)
QDate date
Date (displayed by the default template)
qreal rowsHeaderWidth() const
void setColumnsWidth(const qreal &)
void diagramTitleChanged(const QString &)
void setAuthor(const QString &author)
BorderTitleBlock::setAuthor.
void titleBlockFolioChanged(const QString &)
titleBlockFolioChanged Signal emitted after Folio has changed
void draw(QPainter *painter)
BorderTitleBlock::draw Draw the border and the titleblock.
bool addValue(const QString &, const QVariant &, bool show=true)
QRectF titleBlockRectForQPainter() const
BorderTitleBlock::titleBlockRectForQPainter.
void needTitleBlockTemplate(const QString &)
QString filename
Filename (displayed by the default template)
QString m_previous_folio_num
void setColumnsCount(int)
qreal columnsWidth() const
const QString version
QElectroTech version (as string, used to mark projects and elements XML documents) ...
QList< QString > keys(KeyOrder=None) const
DiagramContext context
Container for the additional, user-defined fields.
void fromXml(const QDomElement &)
void importTitleBlock(const TitleBlockProperties &)
BorderTitleBlock::importTitleBlock.
bool rowsAreDisplayed() const
qreal columns_width
Columns width.
QString version
Version (displayed by the default template)
void setDiagramHeight(const qreal &)
void borderToXml(QDomElement &)
void updateRectangles()
BorderTitleBlock::updateRectangles This method update the diagram rect according to the value of rows...
void setDate(const QDate &date)
BorderTitleBlock::setDate.
void slot_setAutoPageNum(QString)
BorderTitleBlock::slot_setAutoPageNum.
~BorderTitleBlock() override
bool columnsAreDisplayed() const
QRectF titleBlockRect() const
BorderTitleBlock::titleBlockRect.
qreal columns_header_height_
qreal columns_header_height
Column headers height.
qreal columnsHeaderHeight() const
void setNextFolioNum(const QString &next)
BorderTitleBlock::setNextFolioNum.
BorderProperties exportBorder()
QString btb_auto_page_num_
void setPreviousFolioNum(const QString &previous)
BorderTitleBlock::setPreviousFolioNum.
void setRowsHeight(const qreal &)
void titleBlockTemplateChanged(const QString &)
BorderTitleBlock(QObject *=nullptr)
void setFolio(const QString &folio)
BorderTitleBlock::setFolio.
void setContext(const DiagramContext &context)
TitleBlockTemplateRenderer::setContext.
QString author
Author of the diagram/folio (displayed by the default template)
void setVersion(const QString &version)
BorderTitleBlock::setVersion.
void setIndicerev(const QString &indexrev)
BorderTitleBlock::setIndicerev.
QString indexrev
Revision Index (displayed by the default template)
void setTitleBlockTemplate(const TitleBlockTemplate *)
void titleBlockFromXml(const QDomElement &)
static QFont diagramTextsFont(qreal=-1.0)
QETApp::diagramTextsFont The font to use By default the font is "sans Serif" and size 9...
qreal rows_height
Rows height.
DiagramContext context() const
TitleBlockTemplateRenderer::context.
void importBorder(const BorderProperties &)
static void drawTextAligned(const QString &fileName, const QString &text, double x, double y, double height, double rotation, double oblique, int hAlign, int vAlign, double xAlign, int colour, bool leftAlign=false, float scale=0)
int columns_count
Columns count.
qreal diagramWidth() const
QET::QetCollection collection
Specify the location of the title block.
void setLocMach(const QString &locmach)
BorderTitleBlock::setLocMach.
QString folio
Folio information (displayed by the default template)
void borderChanged(QRectF old_border, QRectF new_border)
void setAutoPageNum(const QString &auto_page_num)
BorderTitleBlock::setAutoPageNum.
bool display_rows
Whether to display row headers.
void setPlant(const QString &plant)
BorderTitleBlock::setPlant.
void titleBlockToXml(QDomElement &)
QString title
Folio title (displayed by the default template)
QString titleBlockTemplateName() const
qreal rows_header_width
Row headers width.
int rows_count
Rows count.
QString template_name
Name of the template used to render the title block - an empty string means "the default template pro...
void setRowsHeaderWidth(const qreal &)
bool display_columns
Whether to display column headers.
void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate *=nullptr)