![]() |
QElectroTech 0.200.1-dev
|
The TitleBlockTemplate class This class represents an title block template for an electric diagram. It can read from an XML document the layout of the table that graphically represents the title block, and can produce a graphical rendering of it from a diagram context (object embedding the informations of the diagram we want to represent the title block. More...
#include <titleblocktemplate.h>
Inherits QObject.

Public Types | |
| enum class | WidthConstraintCase : int { Unconstrained = -1 , RelativeWidthExceeds100Percent = -2 , AbsoluteColumnsExceedRemainingWidth = -3 } |
| The TitleBlockTemplate::WidthConstraintCase enum Distinguishes the possible outcomes of minimumWidth() or maximumWidth() for a template's column layout: either a genuine finite pixel width, or one of the cases below where no single finite width applies – some of which are perfectly ordinary (Unconstrained), and some of which indicate the template's columns cannot be laid out at any width. More... | |
Public Member Functions | |
| TitleBlockTemplate (QObject *=nullptr) | |
| TitleBlockTemplate::TitleBlockTemplate Constructor. | |
| ~TitleBlockTemplate () override | |
| TitleBlockTemplate::~TitleBlockTemplate Destructor. | |
| TitleBlockCell * | createCell (const TitleBlockCell *=nullptr) |
| TitleBlockTemplate::createCell Create a new cell and associate it with this template, which means that it will be deleted when this template is destroyed. | |
| bool | loadFromXmlFile (const QString &) |
| TitleBlockTemplate::loadFromXmlFile Load a titleblock template from an XML file. | |
| bool | loadFromXmlElement (const QDomElement &) |
| TitleBlockTemplate::loadFromXmlElement. | |
| bool | saveToXmlFile (const QString &) |
| TitleBlockTemplate::saveToXmlFile Save the title block template into an XML file. | |
| bool | saveToXmlElement (QDomElement &) const |
| TitleBlockTemplate::saveToXmlElement Save the title block template as XML. | |
| void | exportCellToXml (TitleBlockCell *, QDomElement &) const |
| TitleBlockTemplate::exportCellToXml. | |
| TitleBlockTemplate * | clone () const |
| TitleBlockTemplate::clone. | |
| QString | name () const |
| TitleBlockTemplate::name. | |
| QString | information () const |
| TitleBlockTemplate::information. | |
| void | setInformation (const QString &) |
| TitleBlockTemplate::setInformation. | |
| int | rowDimension (int) |
| TitleBlockTemplate::rowDimension. | |
| void | setRowDimension (int, const TitleBlockDimension &) |
| TitleBlockTemplate::setRowDimension Set the height of a row. | |
| TitleBlockDimension | columnDimension (int) |
| TitleBlockTemplate::columnDimension. | |
| void | setColumnDimension (int, const TitleBlockDimension &) |
| TitleBlockTemplate::setColumnDimension Set the width of a column. | |
| int | columnsCount () const |
| TitleBlockTemplate::columnsCount. | |
| int | rowsCount () const |
| TitleBlockTemplate::rowsCount. | |
| QList< int > | columnsWidth (int) const |
| TitleBlockTemplate::columnsWidth. | |
| QList< int > | rowsHeights () const |
| TitleBlockTemplate::rowsHeights. | |
| int | columnTypeCount (QET::TitleBlockColumnLength) |
| TitleBlockTemplate::columnTypeCount. | |
| int | columnTypeTotal (QET::TitleBlockColumnLength) |
| TitleBlockTemplate::columnTypeTotal. | |
| int | minimumWidth () |
| TitleBlockTemplate::minimumWidth. | |
| int | maximumWidth () |
| TitleBlockTemplate::maximumWidth. | |
| int | width (int) |
| TitleBlockTemplate::width. | |
| int | height () const |
| TitleBlockTemplate::height. | |
| bool | moveRow (int, int) |
| TitleBlockTemplate::moveRow Move a row within this template. | |
| void | addRow (int=-1) |
| TitleBlockTemplate::addRow Add a new 25px-wide row at the provided index. | |
| bool | insertRow (int, const QList< TitleBlockCell * > &, int=-1) |
| TitleBlockTemplate::insertRow. | |
| QList< TitleBlockCell * > | takeRow (int) |
| TitleBlockTemplate::takeRow Removes the row at index i. | |
| QList< TitleBlockCell * > | createRow () |
| TitleBlockTemplate::createRow. | |
| bool | moveColumn (int, int) |
| TitleBlockTemplate::moveColumn Move the column at index "from" to index "to". | |
| void | addColumn (int=-1) |
| TitleBlockTemplate::addColumn Add a new 50px-wide column at the provided index. | |
| bool | insertColumn (const TitleBlockDimension &, const QList< TitleBlockCell * > &, int=-1) |
| TitleBlockTemplate::insertColumn. | |
| QList< TitleBlockCell * > | takeColumn (int) |
| TitleBlockTemplate::takeColumn Removes the column at index i. | |
| QList< TitleBlockCell * > | createColumn () |
| TitleBlockTemplate::createColumn. | |
| TitleBlockCell * | cell (int, int) const |
| TitleBlockTemplate::cell. | |
| QSet< TitleBlockCell * > | spannedCells (const TitleBlockCell *, bool=false) const |
| TitleBlockTemplate::spannedCells. | |
| QHash< TitleBlockCell *, QPair< int, int > > | getAllSpans () const |
| TitleBlockTemplate::getAllSpans Export the span parameters of all cell in the current grid. | |
| void | setAllSpans (const QHash< TitleBlockCell *, QPair< int, int > > &) |
| TitleBlockTemplate::setAllSpans Restore a set of span parameters. | |
| bool | addLogo (const QString &, QByteArray *, const QString &="svg", const QString &="xml") |
| TitleBlockTemplate::addLogo. | |
| bool | addLogoFromFile (const QString &, const QString &=QString()) |
| TitleBlockTemplate::addLogoFromFile. | |
| bool | saveLogoToFile (const QString &, const QString &) |
| TitleBlockTemplate::saveLogoToFile. | |
| bool | removeLogo (const QString &) |
| TitleBlockTemplate::removeLogo. | |
| bool | renameLogo (const QString &, const QString &) |
| TitleBlockTemplate::renameLogo Rename the logo_name logo to new_name. | |
| void | setLogoStorage (const QString &, const QString &) |
| TitleBlockTemplate::setLogoStorage Set the kind of storage for the logo_name logo. | |
| QList< QString > | logos () const |
| TitleBlockTemplate::logos. | |
| QString | logoType (const QString &) const |
| TitleBlockTemplate::logoType. | |
| QSvgRenderer * | vectorLogo (const QString &) const |
| TitleBlockTemplate::vectorLogo. | |
| QPixmap | bitmapLogo (const QString &) const |
| TitleBlockTemplate::bitmapLogo. | |
| void | render (QPainter &, const DiagramContext &, int) const |
| TitleBlockTemplate::render Render the titleblock. | |
| void | renderDxf (QRectF &, const DiagramContext &, int, QString &, int) const |
| TitleBlockTemplate::renderDxf Render the titleblock in DXF. | |
| void | renderCell (QPainter &, const TitleBlockCell &, const DiagramContext &, const QRect &) const |
| TitleBlockTemplate::renderCell Render a titleblock cell. | |
| void | applyCellSpans () |
| TitleBlockTemplate::applyCellSpans Forget any previously applied span, then apply again all spans defined by existing cells. | |
| void | forgetSpanning () |
| TitleBlockTemplate::forgetSpanning Set the spanner_cell attribute of every cell to 0. | |
| void | forgetSpanning (TitleBlockCell *, bool=true) |
| TitleBlockTemplate::forgetSpanning Set the spanner_cell attribute of every cell spanned by spanning_cell to 0. | |
| bool | checkCellSpan (TitleBlockCell *) |
| TitleBlockTemplate::checkCellSpan Check whether a given cell can be spanned according to its row_span and col_span attributes. the following attributes of cell are updated according to what is really possible: applied_col_span applied_row_span span_state. | |
| void | applyCellSpan (TitleBlockCell *) |
| TitleBlockTemplate::applyCellSpan Ensure the spans of the provided cell are applied within the grid structure. | |
| void | applyRowColNums () |
| TitleBlockTemplate::applyRowColNums Ensure all cells have the right col+row numbers. | |
| void | rowColsChanged () |
| TitleBlockTemplate::rowColsChanged Take care of consistency and span-related problematics when adding/moving/deleting rows and columns. | |
| QStringList | listOfVariables () |
| TitleBlockTemplate::listOfVariables Get list of variables. | |
Static Public Member Functions | |
| static QFont | fontForCell (const TitleBlockCell &) |
| TitleBlockTemplate::fontForCell. | |
Protected Member Functions | |
| void | loadInformation (const QDomElement &) |
| TitleBlockTemplate::loadInformation Import text informations from a given XML title block template. | |
| bool | loadLogos (const QDomElement &, bool=false) |
| TitleBlockTemplate::loadLogos Import the logos from a given XML titleblock template. | |
| bool | loadLogo (const QDomElement &) |
| TitleBlockTemplate::loadLogo Import the logo from a given XML logo description. | |
| bool | loadGrid (const QDomElement &) |
| bool | loadCells (const QDomElement &) |
| TitleBlockTemplate::loadCells Analyze an XML element, looking for grid cells. The grid cells are checked and stored in this object. | |
| void | loadCell (const QDomElement &) |
| TitleBlockTemplate::loadCell Load a cell into this template. | |
| void | saveInformation (QDomElement &) const |
| TitleBlockTemplate::saveInformation Export this template's extra information. | |
| void | saveLogos (QDomElement &) const |
| TitleBlockTemplate::saveLogos Export this template's logos as XML. | |
| void | saveLogo (const QString &, QDomElement &) const |
| TitleBlockTemplate::saveLogo Export a specific logo as XML. | |
| void | saveGrid (QDomElement &) const |
| TitleBlockTemplate::saveGrid Export this template's cells grid as XML. | |
| void | saveCells (QDomElement &) const |
| TitleBlockTemplate::saveCells Export this template's cells as XML (without the grid-related information, usch as rows and cols). | |
| void | saveCell (TitleBlockCell *, QDomElement &, bool=false) const |
| TitleBlockTemplate::saveCell Export a specific cell as XML. | |
| QList< TitleBlockCell * > | createCellsList (int) |
| TitleBlockTemplate::createCellsList. | |
Private Member Functions | |
| TitleBlockTemplate (const TitleBlockTemplate &) | |
| void | parseRows (const QString &) |
| TitleBlockTemplate::parseRows Parse the rows heights. | |
| void | parseColumns (const QString &) |
| TitleBlockTemplate::parseColumns Parse the columns widths. | |
| bool | checkCell (const QDomElement &, TitleBlockCell **=nullptr) |
| TitleBlockTemplate::checkCell Load the essential attributes of a cell: row and column indices and spans. | |
| void | flushCells () |
| void | initCells () |
| TitleBlockTemplate::initCells Initialize the internal cells grid with the row and column counts. Note that this method does nothing if one of the internal lists columns_width_ and rows_heights_ is empty. | |
| std::optional< WidthConstraintCase > | classifyWidthConstraint (int &abs_total, qreal &remaining_width_fraction) |
| TitleBlockTemplate::classifyWidthConstraint Classifies this template's absolute-width (ABS) and relative-to-total-length (RTT) columns, independently of whether a minimum or a maximum width is being computed – see minimumWidth() for the derivation this is based on. | |
| int | lengthRange (int, int, const QList< int > &) const |
| TitleBlockTemplate::lengthRange. | |
| QString | finalTextForCell (const TitleBlockCell &, const DiagramContext &) const |
| TitleBlockTemplate::finalTextForCell. | |
| QString | interpreteVariables (const QString &, const DiagramContext &) const |
| TitleBlockTemplate::interpreteVariables. | |
| void | renderTextCell (QPainter &, const QString &, const TitleBlockCell &, const QRectF &) const |
| TitleBlockTemplate::renderTextCell This method uses a painter to render the text of a cell into the cell_rect rectangle. The alignment, font_size and other cell parameters are taken into account when rendering. | |
| void | renderTextCellDxf (QString &, const QString &, const TitleBlockCell &, qreal, qreal, qreal, qreal, int) const |
| TitleBlockTemplate::renderTextCellDxf. | |
Private Attributes | |
| QString | name_ |
| name_ : name identifying the Title Block Template within its parent collection | |
| QString | information_ |
| QHash< QString, QByteArray > | data_logos_ |
| data_logos_ : Logos raw data | |
| QHash< QString, QString > | storage_logos_ |
| storage_logos_ : Logos applied storage type (e.g. "xml" or "base64") | |
| QHash< QString, QString > | type_logos_ |
| type_logos_ : Logos types (e.g. "png", "jpeg", "svg") | |
| QHash< QString, QSvgRenderer * > | vector_logos_ |
| vector_logos_ : Rendered objects for vector logos | |
| QHash< QString, QPixmap > | bitmap_logos_ |
| bitmap_logos_ : Pixmaps for bitmap logos | |
| QList< int > | rows_heights_ |
| rows heights – simple integers | |
| QList< TitleBlockDimension > | columns_width_ |
| columns_width_ : columns widths – | |
| QList< TitleBlockCell * > | registered_cells_ |
| registered_cells_ : Cells objects created rattached to this template, but not mandatorily used | |
| QList< QList< TitleBlockCell * > > | cells_ |
| Cells grid. | |
The TitleBlockTemplate class This class represents an title block template for an electric diagram. It can read from an XML document the layout of the table that graphically represents the title block, and can produce a graphical rendering of it from a diagram context (object embedding the informations of the diagram we want to represent the title block.
|
strong |
The TitleBlockTemplate::WidthConstraintCase enum Distinguishes the possible outcomes of minimumWidth() or maximumWidth() for a template's column layout: either a genuine finite pixel width, or one of the cases below where no single finite width applies – some of which are perfectly ordinary (Unconstrained), and some of which indicate the template's columns cannot be laid out at any width.
Both functions return one of the non-Bounded* cases below, cast to int, in place of a genuine width whenever no finite width applies. (*minimumWidth()/maximumWidth() never return a literal "Bounded" value – when a finite width exists, they return that width directly. Bounded only appears as a concept in classifyWidthConstraint()'s std::nullopt return.) The int-based encoding exists because this project currently targets C++17.
| Enumerator | |
|---|---|
| Unconstrained | There is no finite width constraint in this direction: any width is valid. This is a perfectly ordinary case, not a problem with the template – for minimumWidth(), it happens when the relative-to-total-length (RTT) columns account for exactly 100% of the total width and there are no absolute-width (ABS) columns competing for space – every term in the minimum-width inequality vanishes (0 >= 0), which holds for any width. For maximumWidth(), it happens whenever at least one column scales with the total width, so nothing caps how wide the template may grow – the common case for most templates. |
| RelativeWidthExceeds100Percent | The RTT columns alone already exceed 100% of the total width (sum(RTT) > 100), independently of whether any ABS columns exist. The minimum-width inequality then only holds for a non-positive width, which cannot represent a real template: this indicates a genuinely misconfigured template that cannot be laid out at any width. |
| AbsoluteColumnsExceedRemainingWidth | The RTT columns account for exactly 100% of the total width, but at least one ABS column also needs a nonzero, fixed amount of space on top of that. The minimum-width inequality reduces to "0 >= (a positive number)", which never holds: this also indicates a genuinely misconfigured template that cannot be laid out at any width. |
| TitleBlockTemplate::TitleBlockTemplate | ( | QObject * | parent = nullptr | ) |
TitleBlockTemplate::TitleBlockTemplate Constructor.
| parent | parent QObject |

|
override |
|
private |

| void TitleBlockTemplate::addColumn | ( | int | i = -1 | ) |
TitleBlockTemplate::addColumn Add a new 50px-wide column at the provided index.
| i | : Index of the added column, -1 meaning "last position" |

| bool TitleBlockTemplate::addLogo | ( | const QString & | logo_name, |
| QByteArray * | logo_data, | ||
| const QString & | logo_type = "svg", | ||
| const QString & | logo_storage = "xml" ) |
| logo_name | : Logo name to be added / replaced |
| logo_data | : Logo data |
| logo_type | : |
| logo_storage | : |


| bool TitleBlockTemplate::addLogoFromFile | ( | const QString & | filepath, |
| const QString & | name = QString() ) |
TitleBlockTemplate::addLogoFromFile.
| filepath | : Path of the image file to add as a logo |
| name | : Name used to store the logo; if none is provided, the basename of the first argument is used. |

| void TitleBlockTemplate::addRow | ( | int | i = -1 | ) |
TitleBlockTemplate::addRow Add a new 25px-wide row at the provided index.
| i | : Index of the added row, -1 meaning "last position" |

| void TitleBlockTemplate::applyCellSpan | ( | TitleBlockCell * | cell | ) |
TitleBlockTemplate::applyCellSpan Ensure the spans of the provided cell are applied within the grid structure.
| cell | : Potentially spanning cell |


| void TitleBlockTemplate::applyCellSpans | ( | ) |
TitleBlockTemplate::applyCellSpans Forget any previously applied span, then apply again all spans defined by existing cells.


| void TitleBlockTemplate::applyRowColNums | ( | ) |
TitleBlockTemplate::applyRowColNums Ensure all cells have the right col+row numbers.

| QPixmap TitleBlockTemplate::bitmapLogo | ( | const QString & | logo_name | ) | const |
TitleBlockTemplate::bitmapLogo.
| logo_name | : Name of a logo embedded within this title block template. |
| TitleBlockCell * TitleBlockTemplate::cell | ( | int | row, |
| int | col ) const |
| row | : A row number (starting from 0) |
| col | : A column number (starting from 0) |

|
private |
TitleBlockTemplate::checkCell Load the essential attributes of a cell: row and column indices and spans.
| xml_element | : XML element representing a cell, i.e. either an titleblock logo or an titleblock field. |
| titleblock_cell_ptr | : Pointer to a TitleBlockCell object pointer - if non-zero and if this method returns true, will be filled with the created TitleBlockCell |


| bool TitleBlockTemplate::checkCellSpan | ( | TitleBlockCell * | cell | ) |
TitleBlockTemplate::checkCellSpan Check whether a given cell can be spanned according to its row_span and col_span attributes. the following attributes of cell are updated according to what is really possible: applied_col_span applied_row_span span_state.
| cell | : Cell we want to check |


|
private |
TitleBlockTemplate::classifyWidthConstraint Classifies this template's absolute-width (ABS) and relative-to-total-length (RTT) columns, independently of whether a minimum or a maximum width is being computed – see minimumWidth() for the derivation this is based on.
TitleBlockTemplate::classifyWidthConstraint Classifies this template's absolute-width (ABS) and relative-to-total-length (RTT) columns, independently of whether a minimum or a maximum width is being computed.
| [out] | abs_total | set to columnTypeTotal(QET::Absolute). |
| [out] | remaining_width_fraction | set to the fraction of the total template width left over once the RTT columns have taken their share: (100.0 - sum(RTT)) / 100.0. Zero means the RTT columns claim the entire width, leaving nothing for ABS columns; negative means they claim more than the entire width, which is unsatisfiable regardless of any ABS columns. Only meaningful when this function returns std::nullopt. |
The classification is derived from the same inequality minimumWidth() solves for a minimum width:
Regardless of TOT, the RTT term above scales linearly with TOT. If sum(RTT) alone already accounts for 100% or more of TOT, no choice of TOT – however large – can make room for it (and for any ABS columns on top of it): making the template wider grows the RTT columns' pixel footprint by the same proportion, so the shortfall never resolves. This function exists so both minimumWidth() and maximumWidth() report that consistently, instead of maximumWidth() incorrectly treating a misconfigured template as "no upper bound".
| [out] | abs_total | set to columnTypeTotal(QET::Absolute). |
| [out] | remaining_width_fraction | set to the fraction of the total template width left over once the RTT columns have taken their share: (100.0 - sum(RTT)) / 100.0. Zero means the RTT columns claim the entire width, leaving nothing for ABS columns; negative means they claim more than the entire width, which is unsatisfiable regardless of any ABS columns. Only meaningful when this function returns std::nullopt. |


| TitleBlockTemplate * TitleBlockTemplate::clone | ( | ) | const |

| TitleBlockDimension TitleBlockTemplate::columnDimension | ( | int | i | ) |
TitleBlockTemplate::columnDimension.
| i | : column index |
| int TitleBlockTemplate::columnsCount | ( | ) | const |
TitleBlockTemplate::columnsCount.

| QList< int > TitleBlockTemplate::columnsWidth | ( | int | total_width | ) | const |
TitleBlockTemplate::columnsWidth.
| total_width | : The total width of the titleblock to render |

| int TitleBlockTemplate::columnTypeCount | ( | QET::TitleBlockColumnLength | type | ) |
TitleBlockTemplate::columnTypeCount.
| type | : a column type |

| int TitleBlockTemplate::columnTypeTotal | ( | QET::TitleBlockColumnLength | type | ) |
TitleBlockTemplate::columnTypeTotal.
| type | : a column type |

| TitleBlockCell * TitleBlockTemplate::createCell | ( | const TitleBlockCell * | existing_cell = nullptr | ) |
TitleBlockTemplate::createCell Create a new cell and associate it with this template, which means that it will be deleted when this template is destroyed.
| existing_cell | (optional) An existing cell that will be copied |

|
protected |
TitleBlockTemplate::createCellsList.
| count | : Number of cells expected in the list |


| QList< TitleBlockCell * > TitleBlockTemplate::createColumn | ( | ) |
TitleBlockTemplate::createColumn.


| QList< TitleBlockCell * > TitleBlockTemplate::createRow | ( | ) |
TitleBlockTemplate::createRow.


| void TitleBlockTemplate::exportCellToXml | ( | TitleBlockCell * | cell, |
| QDomElement & | xml_element ) const |
TitleBlockTemplate::exportCellToXml.
| cell | : Cell to export |
| xml_element | : Parent XML element to be used when exporting cell |

|
private |
TitleBlockTemplate::finalTextForCell.
| cell | : A cell from this template |
| diagram_context | : Diagram context to use to generate the final text for the given cell |


|
private |
|
static |
TitleBlockTemplate::fontForCell.
| cell | : An existing cell |


| void TitleBlockTemplate::forgetSpanning | ( | ) |
TitleBlockTemplate::forgetSpanning Set the spanner_cell attribute of every cell to 0.

| void TitleBlockTemplate::forgetSpanning | ( | TitleBlockCell * | spanning_cell, |
| bool | modify_cell = true ) |
TitleBlockTemplate::forgetSpanning Set the spanner_cell attribute of every cell spanned by spanning_cell to 0.
| spanning_cell | : |
| modify_cell | : (Optional, defaults to true) Whether to set row_span and col_span of spanning_cell to 0. |

| QHash< TitleBlockCell *, QPair< int, int > > TitleBlockTemplate::getAllSpans | ( | ) | const |
TitleBlockTemplate::getAllSpans Export the span parameters of all cell in the current grid.
| int TitleBlockTemplate::height | ( | ) | const |


| QString TitleBlockTemplate::information | ( | ) | const |
TitleBlockTemplate::information.

|
private |
TitleBlockTemplate::initCells Initialize the internal cells grid with the row and column counts. Note that this method does nothing if one of the internal lists columns_width_ and rows_heights_ is empty.


| bool TitleBlockTemplate::insertColumn | ( | const TitleBlockDimension & | dimension, |
| const QList< TitleBlockCell * > & | column, | ||
| int | i = -1 ) |
TitleBlockTemplate::insertColumn.
| dimension | : Size of the column to be added |
| column | : Column to be added |
| i | : Index of the column after insertion, -1 meaning "last position" |


| bool TitleBlockTemplate::insertRow | ( | int | dimension, |
| const QList< TitleBlockCell * > & | row, | ||
| int | i = -1 ) |
TitleBlockTemplate::insertRow.
| dimension | : dimension Size of the row to be added (always absolute, in pixels) |
| row | : column Row to be added |
| i | : Index of the column after insertion, -1 meaning "last position" |


|
private |
TitleBlockTemplate::interpreteVariables.
| string | : A text containing 0 to n variables, e.g. "%var" or "%{var}" |
| diagram_context | : Diagram context to use to interprete variables |


|
private |
TitleBlockTemplate::lengthRange.
| start | : start border number |
| end | : end border number |
| lengths_list | : |

| QStringList TitleBlockTemplate::listOfVariables | ( | ) |
TitleBlockTemplate::listOfVariables Get list of variables.

|
protected |
TitleBlockTemplate::loadCell Load a cell into this template.
| cell_element | : XML element describing a cell within a title block template |


|
protected |
TitleBlockTemplate::loadCells Analyze an XML element, looking for grid cells. The grid cells are checked and stored in this object.
| xml_element | XML element to analyze |


| bool TitleBlockTemplate::loadFromXmlElement | ( | const QDomElement & | xml_element | ) |
TitleBlockTemplate::loadFromXmlElement.
| xml_element | : An XML document to read the template from. |


| bool TitleBlockTemplate::loadFromXmlFile | ( | const QString & | filepath | ) |
TitleBlockTemplate::loadFromXmlFile Load a titleblock template from an XML file.
| filepath | : A file path to read the template from. |

|
protected |
Import the grid from a given XML titleblock template.
| xml_element | An XML element representing an titleblock template. |


|
protected |
TitleBlockTemplate::loadInformation Import text informations from a given XML title block template.
| xml_element |


|
protected |
TitleBlockTemplate::loadLogo Import the logo from a given XML logo description.
| xml_element | : An XML element representing a logo within an titleblock template. |


|
protected |
TitleBlockTemplate::loadLogos Import the logos from a given XML titleblock template.
| xml_element | : An XML element representing an titleblock template. |
| reset | : true to delete all previously known logos before, false otherwise. |


| QList< QString > TitleBlockTemplate::logos | ( | ) | const |
| QString TitleBlockTemplate::logoType | ( | const QString & | logo_name | ) | const |
| logo_name | : Name of a logo embedded within this title block template. |
| int TitleBlockTemplate::maximumWidth | ( | ) |
TitleBlockTemplate::maximumWidth.
If this template is composed entirely of absolute-width (ABS) columns, the maximum is fixed: the template cannot extend beyond their sum, since nothing in it scales with the template's total width. Otherwise, at least one column scales with the total width (relative-to-total-length or relative-to-remaining-length), so there is ordinarily no upper bound: returns WidthConstraintCase::Unconstrained (cast to int) – the common case for most templates.
The exception is when this template's columns cannot be satisfied by any width at all (see classifyWidthConstraint()) – in that case there is no width, however large, that works, and this returns WidthConstraintCase::RelativeWidthExceeds100Percent or WidthConstraintCase::AbsoluteColumnsExceedRemainingWidth (cast to int) instead of Unconstrained, matching minimumWidth()'s handling of the same cases.

| int TitleBlockTemplate::minimumWidth | ( | ) |
TitleBlockTemplate::minimumWidth.
Derivation: writing TOT for the (variable) total template width, the minimum size enforced by the ABS and RTT columns is:
relative-to-remaining-length (RTR) columns do not constrain the minimum width, since by definition they only ever claim a share of whatever space is left over after the ABS and RTT columns are laid out.
If no finite minimum width applies, returns one of WidthConstraintCase::Unconstrained, WidthConstraintCase::RelativeWidthExceeds100Percent, or WidthConstraintCase::AbsoluteColumnsExceedRemainingWidth (cast to int) instead – see classifyWidthConstraint() and that enum's documentation for when each case applies.

| bool TitleBlockTemplate::moveColumn | ( | int | from, |
| int | to ) |
TitleBlockTemplate::moveColumn Move the column at index "from" to index "to".
| from | : Source index of the moved column |
| to | : Target index of the moved column |

| bool TitleBlockTemplate::moveRow | ( | int | from, |
| int | to ) |
TitleBlockTemplate::moveRow Move a row within this template.
| from | : Index of the moved row |
| to | : Arrival index of the moved row |

| QString TitleBlockTemplate::name | ( | ) | const |

|
private |
TitleBlockTemplate::parseColumns Parse the columns widths.
| cols_string | : A string describing the columns widths of the titleblock |

|
private |
TitleBlockTemplate::parseRows Parse the rows heights.
| rows_string | : A string describing the rows heights of the titleblock |

| bool TitleBlockTemplate::removeLogo | ( | const QString & | logo_name | ) |
TitleBlockTemplate::removeLogo.
| logo_name | : Name of the logo to remove |
TODO check existing cells using this logo.

| bool TitleBlockTemplate::renameLogo | ( | const QString & | logo_name, |
| const QString & | new_name ) |
TitleBlockTemplate::renameLogo Rename the logo_name logo to new_name.
| logo_name | : Name of the logo to be renamed |
| new_name | : New name of the renamed logo |
TODO check existing cells using this logo.
| void TitleBlockTemplate::render | ( | QPainter & | painter, |
| const DiagramContext & | diagram_context, | ||
| int | titleblock_width ) const |
TitleBlockTemplate::render Render the titleblock.
| painter | : Painter to use to render the titleblock |
| diagram_context | : Diagram context to use to generate the titleblock strings |
| titleblock_width | : Width of the titleblock to render |


| void TitleBlockTemplate::renderCell | ( | QPainter & | painter, |
| const TitleBlockCell & | cell, | ||
| const DiagramContext & | diagram_context, | ||
| const QRect & | cell_rect ) const |
TitleBlockTemplate::renderCell Render a titleblock cell.
| painter | : Painter to use to render the titleblock |
| cell | : |
| diagram_context | : Diagram context to use to generate the titleblock strings |
| cell_rect | : Rectangle the cell must be rendered into. |


| void TitleBlockTemplate::renderDxf | ( | QRectF & | title_block_rect, |
| const DiagramContext & | diagram_context, | ||
| int | titleblock_width, | ||
| QString & | file_path, | ||
| int | color ) const |
TitleBlockTemplate::renderDxf Render the titleblock in DXF.
| title_block_rect | : |
| diagram_context | : Diagram context to use to generate the titleblock strings |
| titleblock_width | : Width of the titleblock to render |
| file_path | : |
| color | : |

|
private |
TitleBlockTemplate::renderTextCell This method uses a painter to render the text of a cell into the cell_rect rectangle. The alignment, font_size and other cell parameters are taken into account when rendering.
| painter | : QPainter used to render the text |
| text | : Text to render |
| cell | : Cell the rendered text is rattached to |
| cell_rect | : Rectangle delimiting the cell area |


|
private |
TitleBlockTemplate::renderTextCellDxf.
| file_path | |
| text | |
| cell | |
| x | |
| y | |
| w | |
| h | |
| color |


| void TitleBlockTemplate::rowColsChanged | ( | ) |
TitleBlockTemplate::rowColsChanged Take care of consistency and span-related problematics when adding/moving/deleting rows and columns.


| int TitleBlockTemplate::rowDimension | ( | int | i | ) |
| int TitleBlockTemplate::rowsCount | ( | ) | const |
TitleBlockTemplate::rowsCount.

| QList< int > TitleBlockTemplate::rowsHeights | ( | ) | const |
TitleBlockTemplate::rowsHeights.
|
protected |
TitleBlockTemplate::saveCell Export a specific cell as XML.
| cell | : Cell to be exported as XML |
| xml_element | : XML element under which the <cell> element will be attached |
| save_empty | : If true, the cell will be saved even if it is an empty one |


|
protected |
TitleBlockTemplate::saveCells Export this template's cells as XML (without the grid-related information, usch as rows and cols).
| xml_element | : XML element under which the <cell> elements will be attached |


|
protected |
TitleBlockTemplate::saveGrid Export this template's cells grid as XML.
| xml_element | : XML element under which the <grid> element will be attached |


|
protected |
TitleBlockTemplate::saveInformation Export this template's extra information.
| xml_element | : XML element under which extra informations will be attached |


|
protected |
TitleBlockTemplate::saveLogo Export a specific logo as XML.
| logo_name | : Name of the logo to be exported |
| xml_element | : XML element in which the logo will be exported |

|
protected |
TitleBlockTemplate::saveLogos Export this template's logos as XML.
| xml_element | : XML Element under which the <logos> element will be attached |


| bool TitleBlockTemplate::saveLogoToFile | ( | const QString & | logo_name, |
| const QString & | filepath ) |
TitleBlockTemplate::saveLogoToFile.
| logo_name | : Name used to store the logo |
| filepath | : Path the logo will be saved as |
| bool TitleBlockTemplate::saveToXmlElement | ( | QDomElement & | xml_element | ) | const |
TitleBlockTemplate::saveToXmlElement Save the title block template as XML.
| xml_element | : The XML element this title block template should be saved to. |


| bool TitleBlockTemplate::saveToXmlFile | ( | const QString & | filepath | ) |
TitleBlockTemplate::saveToXmlFile Save the title block template into an XML file.
| filepath | : The file path this title block template should be saved to. |

| void TitleBlockTemplate::setAllSpans | ( | const QHash< TitleBlockCell *, QPair< int, int > > & | spans | ) |
TitleBlockTemplate::setAllSpans Restore a set of span parameters.
| spans | : |

| void TitleBlockTemplate::setColumnDimension | ( | int | i, |
| const TitleBlockDimension & | dimension ) |
TitleBlockTemplate::setColumnDimension Set the width of a column.
| i | : column index |
| dimension | : New width of the column at index i |
| void TitleBlockTemplate::setInformation | ( | const QString & | info | ) |
TitleBlockTemplate::setInformation.
| info | information to be attached to this template |

| void TitleBlockTemplate::setLogoStorage | ( | const QString & | logo_name, |
| const QString & | storage ) |
TitleBlockTemplate::setLogoStorage Set the kind of storage for the logo_name logo.
| logo_name | : Name of the logo which kind of storage is to be changed |
| storage | : The kind of storage to use for the logo, e.g. "xml" or "base64". |
| void TitleBlockTemplate::setRowDimension | ( | int | i, |
| const TitleBlockDimension & | dimension ) |
TitleBlockTemplate::setRowDimension Set the height of a row.
| i | : row index |
| dimension | : New height of the row at index i |
| QSet< TitleBlockCell * > TitleBlockTemplate::spannedCells | ( | const TitleBlockCell * | given_cell, |
| bool | ignore_span_state = false ) const |
TitleBlockTemplate::spannedCells.
| given_cell | : cell A cell belonging to this title block template |
| ignore_span_state | : (Optional, defaults to false) If true, will consider cells theoretically spanned (i.e. row_span and col_span attributes). Otherwise, will take span_state attribute into account. |


| QList< TitleBlockCell * > TitleBlockTemplate::takeColumn | ( | int | i | ) |
TitleBlockTemplate::takeColumn Removes the column at index i.
| i | : Index of the column to be removed |

| QList< TitleBlockCell * > TitleBlockTemplate::takeRow | ( | int | i | ) |
TitleBlockTemplate::takeRow Removes the row at index i.
| i | : Index of the column to be removed |

| QSvgRenderer * TitleBlockTemplate::vectorLogo | ( | const QString & | logo_name | ) | const |
TitleBlockTemplate::vectorLogo.
| logo_name | : Name of a vector logo embedded within this title block template. |
| int TitleBlockTemplate::width | ( | int | total_width | ) |
| total_width | : The total width initially planned for the rendering |


|
private |
bitmap_logos_ : Pixmaps for bitmap logos
|
private |
Cells grid.
|
private |
columns_width_ : columns widths –
|
private |
data_logos_ : Logos raw data
|
private |
|
private |
name_ : name identifying the Title Block Template within its parent collection
|
private |
registered_cells_ : Cells objects created rattached to this template, but not mandatorily used
|
private |
rows heights – simple integers
|
private |
storage_logos_ : Logos applied storage type (e.g. "xml" or "base64")
|
private |
type_logos_ : Logos types (e.g. "png", "jpeg", "svg")
|
private |
vector_logos_ : Rendered objects for vector logos