QElectroTech  0.8-dev
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
TitleBlockTemplate Class Reference

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.

Collaboration diagram for TitleBlockTemplate:
Collaboration graph

Public Member Functions

 TitleBlockTemplate (QObject *=nullptr)
 TitleBlockTemplate::TitleBlockTemplate Constructor. More...
 
 ~TitleBlockTemplate () override
 TitleBlockTemplate::~TitleBlockTemplate Destructor. More...
 
TitleBlockCellcreateCell (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. More...
 
bool loadFromXmlFile (const QString &)
 TitleBlockTemplate::loadFromXmlFile Load a titleblock template from an XML file. More...
 
bool loadFromXmlElement (const QDomElement &)
 TitleBlockTemplate::loadFromXmlElement. More...
 
bool saveToXmlFile (const QString &)
 TitleBlockTemplate::saveToXmlFile Save the title block template into an XML file. More...
 
bool saveToXmlElement (QDomElement &) const
 TitleBlockTemplate::saveToXmlElement Save the title block template as XML. More...
 
void exportCellToXml (TitleBlockCell *, QDomElement &) const
 TitleBlockTemplate::exportCellToXml. More...
 
TitleBlockTemplateclone () const
 TitleBlockTemplate::clone. More...
 
QString name () const
 TitleBlockTemplate::name. More...
 
QString information () const
 TitleBlockTemplate::information. More...
 
void setInformation (const QString &)
 TitleBlockTemplate::setInformation. More...
 
int rowDimension (int)
 TitleBlockTemplate::rowDimension. More...
 
void setRowDimension (int, const TitleBlockDimension &)
 TitleBlockTemplate::setRowDimension Set the height of a row. More...
 
TitleBlockDimension columnDimension (int)
 TitleBlockTemplate::columnDimension. More...
 
void setColumnDimension (int, const TitleBlockDimension &)
 TitleBlockTemplate::setColumnDimension Set the width of a column. More...
 
int columnsCount () const
 TitleBlockTemplate::columnsCount. More...
 
int rowsCount () const
 TitleBlockTemplate::rowsCount. More...
 
QList< int > columnsWidth (int) const
 TitleBlockTemplate::columnsWidth. More...
 
QList< int > rowsHeights () const
 TitleBlockTemplate::rowsHeights. More...
 
int columnTypeCount (QET::TitleBlockColumnLength)
 TitleBlockTemplate::columnTypeCount. More...
 
int columnTypeTotal (QET::TitleBlockColumnLength)
 TitleBlockTemplate::columnTypeTotal. More...
 
int minimumWidth ()
 
int maximumWidth ()
 TitleBlockTemplate::maximumWidth. More...
 
int width (int)
 TitleBlockTemplate::width. More...
 
int height () const
 TitleBlockTemplate::height. More...
 
bool moveRow (int, int)
 TitleBlockTemplate::moveRow Move a row within this template. More...
 
void addRow (int=-1)
 TitleBlockTemplate::addRow Add a new 25px-wide row at the provided index. More...
 
bool insertRow (int, const QList< TitleBlockCell * > &, int=-1)
 TitleBlockTemplate::insertRow. More...
 
QList< TitleBlockCell * > takeRow (int)
 TitleBlockTemplate::takeRow Removes the row at index i. More...
 
QList< TitleBlockCell * > createRow ()
 TitleBlockTemplate::createRow. More...
 
bool moveColumn (int, int)
 TitleBlockTemplate::moveColumn Move the column at index "from" to index "to". More...
 
void addColumn (int=-1)
 TitleBlockTemplate::addColumn Add a new 50px-wide column at the provided index. More...
 
bool insertColumn (const TitleBlockDimension &, const QList< TitleBlockCell * > &, int=-1)
 TitleBlockTemplate::insertColumn. More...
 
QList< TitleBlockCell * > takeColumn (int)
 TitleBlockTemplate::takeColumn Removes the column at index i. More...
 
QList< TitleBlockCell * > createColumn ()
 TitleBlockTemplate::createColumn. More...
 
TitleBlockCellcell (int, int) const
 TitleBlockTemplate::cell. More...
 
QSet< TitleBlockCell * > spannedCells (const TitleBlockCell *, bool=false) const
 TitleBlockTemplate::spannedCells. More...
 
QHash< TitleBlockCell *, QPair< int, int > > getAllSpans () const
 TitleBlockTemplate::getAllSpans Export the span parameters of all cell in the current grid. More...
 
void setAllSpans (const QHash< TitleBlockCell *, QPair< int, int > > &)
 TitleBlockTemplate::setAllSpans Restore a set of span parameters. More...
 
bool addLogo (const QString &, QByteArray *, const QString &="svg", const QString &="xml")
 TitleBlockTemplate::addLogo. More...
 
bool addLogoFromFile (const QString &, const QString &=QString())
 TitleBlockTemplate::addLogoFromFile. More...
 
bool saveLogoToFile (const QString &, const QString &)
 TitleBlockTemplate::saveLogoToFile. More...
 
bool removeLogo (const QString &)
 TitleBlockTemplate::removeLogo. More...
 
bool renameLogo (const QString &, const QString &)
 TitleBlockTemplate::renameLogo Rename the logo_name logo to new_name. More...
 
void setLogoStorage (const QString &, const QString &)
 TitleBlockTemplate::setLogoStorage Set the kind of storage for the logo_name logo. More...
 
QList< QString > logos () const
 TitleBlockTemplate::logos. More...
 
QString logoType (const QString &) const
 TitleBlockTemplate::logoType. More...
 
QSvgRenderer * vectorLogo (const QString &) const
 TitleBlockTemplate::vectorLogo. More...
 
QPixmap bitmapLogo (const QString &) const
 TitleBlockTemplate::bitmapLogo. More...
 
void render (QPainter &, const DiagramContext &, int) const
 TitleBlockTemplate::render Render the titleblock. More...
 
void renderDxf (QRectF &, const DiagramContext &, int, QString &, int) const
 TitleBlockTemplate::renderDxf Render the titleblock in DXF. More...
 
void renderCell (QPainter &, const TitleBlockCell &, const DiagramContext &, const QRect &) const
 TitleBlockTemplate::renderCell Render a titleblock cell. More...
 
void applyCellSpans ()
 TitleBlockTemplate::applyCellSpans Forget any previously applied span, then apply again all spans defined by existing cells. More...
 
void forgetSpanning ()
 TitleBlockTemplate::forgetSpanning Set the spanner_cell attribute of every cell to 0. More...
 
void forgetSpanning (TitleBlockCell *, bool=true)
 TitleBlockTemplate::forgetSpanning Set the spanner_cell attribute of every cell spanned by spanning_cell to 0. More...
 
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. More...
 
void applyCellSpan (TitleBlockCell *)
 TitleBlockTemplate::applyCellSpan Ensure the spans of the provided cell are applied within the grid structure. More...
 
void applyRowColNums ()
 TitleBlockTemplate::applyRowColNums Ensure all cells have the right col+row numbers. More...
 
void rowColsChanged ()
 TitleBlockTemplate::rowColsChanged Take care of consistency and span-related problematics when adding/moving/deleting rows and columns. More...
 
QStringList listOfVariables ()
 TitleBlockTemplate::listOfVariables Get list of variables. More...
 

Static Public Member Functions

static QFont fontForCell (const TitleBlockCell &)
 TitleBlockTemplate::fontForCell. More...
 

Protected Member Functions

void loadInformation (const QDomElement &)
 TitleBlockTemplate::loadInformation Import text informations from a given XML title block template. More...
 
bool loadLogos (const QDomElement &, bool=false)
 TitleBlockTemplate::loadLogos Import the logos from a given XML titleblock template. More...
 
bool loadLogo (const QDomElement &)
 TitleBlockTemplate::loadLogo Import the logo from a given XML logo description. More...
 
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. More...
 
void loadCell (const QDomElement &)
 TitleBlockTemplate::loadCell Load a cell into this template. More...
 
void saveInformation (QDomElement &) const
 TitleBlockTemplate::saveInformation Export this template's extra information. More...
 
void saveLogos (QDomElement &) const
 TitleBlockTemplate::saveLogos Export this template's logos as XML. More...
 
void saveLogo (const QString &, QDomElement &) const
 TitleBlockTemplate::saveLogo Export a specific logo as XML. More...
 
void saveGrid (QDomElement &) const
 TitleBlockTemplate::saveGrid Export this template's cells grid as XML. More...
 
void saveCells (QDomElement &) const
 TitleBlockTemplate::saveCells Export this template's cells as XML (without the grid-related information, usch as rows and cols) More...
 
void saveCell (TitleBlockCell *, QDomElement &, bool=false) const
 TitleBlockTemplate::saveCell Export a specific cell as XML. More...
 
QList< TitleBlockCell * > createCellsList (int)
 TitleBlockTemplate::createCellsList. More...
 

Private Member Functions

 TitleBlockTemplate (const TitleBlockTemplate &)
 
void parseRows (const QString &)
 TitleBlockTemplate::parseRows Parse the rows heights. More...
 
void parseColumns (const QString &)
 TitleBlockTemplate::parseColumns Parse the columns widths. More...
 
bool checkCell (const QDomElement &, TitleBlockCell **=nullptr)
 TitleBlockTemplate::checkCell Load the essential attributes of a cell: row and column indices and spans. More...
 
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. More...
 
int lengthRange (int, int, const QList< int > &) const
 TitleBlockTemplate::lengthRange. More...
 
QString finalTextForCell (const TitleBlockCell &, const DiagramContext &) const
 TitleBlockTemplate::finalTextForCell. More...
 
QString interpreteVariables (const QString &, const DiagramContext &) const
 TitleBlockTemplate::interpreteVariables. More...
 
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. More...
 
void renderTextCellDxf (QString &, const QString &, const TitleBlockCell &, qreal, qreal, qreal, qreal, int) const
 TitleBlockTemplate::renderTextCellDxf. More...
 

Private Attributes

QString name_
 name_ : name identifying the Title Block Template within its parent collection More...
 
QString information_
 
QHash< QString, QByteArray > data_logos_
 data_logos_ : Logos raw data More...
 
QHash< QString, QString > storage_logos_
 storage_logos_ : Logos applied storage type (e.g. "xml" or "base64") More...
 
QHash< QString, QString > type_logos_
 type_logos_ : Logos types (e.g. "png", "jpeg", "svg") More...
 
QHash< QString, QSvgRenderer * > vector_logos_
 vector_logos_ : Rendered objects for vector logos More...
 
QHash< QString, QPixmap > bitmap_logos_
 bitmap_logos_ : Pixmaps for bitmap logos More...
 
QList< int > rows_heights_
 rows heights – simple integers More...
 
QList< TitleBlockDimensioncolumns_width_
 columns_width_ : columns widths – More...
 
QList< TitleBlockCell * > registered_cells_
 registered_cells_ : Cells objects created rattached to this template, but not mandatorily used More...
 
QList< QList< TitleBlockCell * > > cells_
 Cells grid. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TitleBlockTemplate() [1/2]

TitleBlockTemplate::TitleBlockTemplate ( QObject *  parent = nullptr)

TitleBlockTemplate::TitleBlockTemplate Constructor.

Parameters
parentparent QObject
Here is the caller graph for this function:

◆ ~TitleBlockTemplate()

TitleBlockTemplate::~TitleBlockTemplate ( )
override

TitleBlockTemplate::~TitleBlockTemplate Destructor.

Here is the call graph for this function:

◆ TitleBlockTemplate() [2/2]

TitleBlockTemplate::TitleBlockTemplate ( const TitleBlockTemplate )
private

Member Function Documentation

◆ addColumn()

void TitleBlockTemplate::addColumn ( int  i = -1)

TitleBlockTemplate::addColumn Add a new 50px-wide column at the provided index.

Parameters
i: Index of the added column, -1 meaning "last position"
Here is the call graph for this function:

◆ addLogo()

bool TitleBlockTemplate::addLogo ( const QString &  logo_name,
QByteArray *  logo_data,
const QString &  logo_type = "svg",
const QString &  logo_storage = "xml" 
)

TitleBlockTemplate::addLogo.

Parameters
logo_name: Logo name to be added / replaced
logo_data: Logo data
logo_type:
logo_storage:
Returns
true or false
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addLogoFromFile()

bool TitleBlockTemplate::addLogoFromFile ( const QString &  filepath,
const QString &  name = QString() 
)

TitleBlockTemplate::addLogoFromFile.

Parameters
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.
Returns
true if the logo could be deleted, false otherwise
Here is the call graph for this function:

◆ addRow()

void TitleBlockTemplate::addRow ( int  i = -1)

TitleBlockTemplate::addRow Add a new 25px-wide row at the provided index.

Parameters
i: Index of the added row, -1 meaning "last position"
Here is the call graph for this function:

◆ applyCellSpan()

void TitleBlockTemplate::applyCellSpan ( TitleBlockCell cell)

TitleBlockTemplate::applyCellSpan Ensure the spans of the provided cell are applied within the grid structure.

Note
: this function does not check whether the spans of the provided cell make sense.
Parameters
cell: Potentially spanning cell
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyCellSpans()

void TitleBlockTemplate::applyCellSpans ( )

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyRowColNums()

void TitleBlockTemplate::applyRowColNums ( )

TitleBlockTemplate::applyRowColNums Ensure all cells have the right col+row numbers.

Here is the caller graph for this function:

◆ bitmapLogo()

QPixmap TitleBlockTemplate::bitmapLogo ( const QString &  logo_name) const

TitleBlockTemplate::bitmapLogo.

Parameters
logo_name: Name of a logo embedded within this title block template.
Returns
the pixmap for the required bitmap logo, or a null pixmap if no such bitmap logo was found in this template.

◆ cell()

TitleBlockCell * TitleBlockTemplate::cell ( int  row,
int  col 
) const

TitleBlockTemplate::cell.

Parameters
row: A row number (starting from 0)
col: A column number (starting from 0)
Returns
the cell located at (row, col)
Here is the caller graph for this function:

◆ checkCell()

bool TitleBlockTemplate::checkCell ( const QDomElement &  xml_element,
TitleBlockCell **  titleblock_cell_ptr = nullptr 
)
private

TitleBlockTemplate::checkCell Load the essential attributes of a cell: row and column indices and spans.

Parameters
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
Returns
TRUE if the cell appears to be ok, FALSE otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkCellSpan()

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.

Parameters
cell: Cell we want to check
Returns
false if no check could be performed, true otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clone()

TitleBlockTemplate * TitleBlockTemplate::clone ( ) const

TitleBlockTemplate::clone.

Returns
a deep copy of the current title block template (i.e. title block cells are duplicated too and associated with their parent template).
Here is the call graph for this function:

◆ columnDimension()

TitleBlockDimension TitleBlockTemplate::columnDimension ( int  i)

TitleBlockTemplate::columnDimension.

Parameters
i: column index
Returns
the width of the column at index i

◆ columnsCount()

int TitleBlockTemplate::columnsCount ( ) const

TitleBlockTemplate::columnsCount.

Returns
the number of columns in this template
Here is the caller graph for this function:

◆ columnsWidth()

QList< int > TitleBlockTemplate::columnsWidth ( int  total_width) const

TitleBlockTemplate::columnsWidth.

Parameters
total_width: The total width of the titleblock to render
Returns
the list of the columns widths for this rendering
Here is the caller graph for this function:

◆ columnTypeCount()

int TitleBlockTemplate::columnTypeCount ( QET::TitleBlockColumnLength  type)

TitleBlockTemplate::columnTypeCount.

Parameters
type: a column type
Returns
the count of type columns
Here is the caller graph for this function:

◆ columnTypeTotal()

int TitleBlockTemplate::columnTypeTotal ( QET::TitleBlockColumnLength  type)

TitleBlockTemplate::columnTypeTotal.

Parameters
type: a column type
Returns
the sum of values attached to type columns
Here is the caller graph for this function:

◆ createCell()

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.

Parameters
existing_cell(optional) An existing cell that will be copied
Returns
A pointer to the newly created cell
Here is the caller graph for this function:

◆ createCellsList()

QList< TitleBlockCell * > TitleBlockTemplate::createCellsList ( int  count)
protected

TitleBlockTemplate::createCellsList.

Parameters
count: Number of cells expected in the list
Returns
a list containing count newly created (and registered) cells
See also
createCell()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createColumn()

QList< TitleBlockCell * > TitleBlockTemplate::createColumn ( )

TitleBlockTemplate::createColumn.

Returns
a new column that fits the current grid
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createRow()

QList< TitleBlockCell * > TitleBlockTemplate::createRow ( )

TitleBlockTemplate::createRow.

Returns
a new row that fits the current grid
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportCellToXml()

void TitleBlockTemplate::exportCellToXml ( TitleBlockCell cell,
QDomElement &  xml_element 
) const

TitleBlockTemplate::exportCellToXml.

Parameters
cell: Cell to export
xml_element: Parent XML element to be used when exporting cell
Here is the call graph for this function:

◆ finalTextForCell()

QString TitleBlockTemplate::finalTextForCell ( const TitleBlockCell cell,
const DiagramContext diagram_context 
) const
private

TitleBlockTemplate::finalTextForCell.

Parameters
cell: A cell from this template
diagram_context: Diagram context to use to generate the final text for the given cell
Returns
the final text that has to be drawn in the given cell
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flushCells()

void TitleBlockTemplate::flushCells ( )
private

◆ fontForCell()

QFont TitleBlockTemplate::fontForCell ( const TitleBlockCell cell)
static

TitleBlockTemplate::fontForCell.

Parameters
cell: An existing cell
Returns
The font that should be used to render this cell according to its properties.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ forgetSpanning() [1/2]

void TitleBlockTemplate::forgetSpanning ( )

TitleBlockTemplate::forgetSpanning Set the spanner_cell attribute of every cell to 0.

Here is the caller graph for this function:

◆ forgetSpanning() [2/2]

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.

Parameters
spanning_cell:
modify_cell: (Optional, defaults to true) Whether to set row_span and col_span of spanning_cell to 0.
Here is the call graph for this function:

◆ getAllSpans()

QHash< TitleBlockCell *, QPair< int, int > > TitleBlockTemplate::getAllSpans ( ) const

TitleBlockTemplate::getAllSpans Export the span parameters of all cell in the current grid.

Returns

◆ height()

int TitleBlockTemplate::height ( ) const

TitleBlockTemplate::height.

Returns
the total height of this template
Here is the caller graph for this function:

◆ information()

QString TitleBlockTemplate::information ( ) const

TitleBlockTemplate::information.

Returns
the information field attached to this template
Here is the caller graph for this function:

◆ initCells()

void TitleBlockTemplate::initCells ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertColumn()

bool TitleBlockTemplate::insertColumn ( const TitleBlockDimension dimension,
const QList< TitleBlockCell * > &  column,
int  i = -1 
)

TitleBlockTemplate::insertColumn.

Parameters
dimension: Size of the column to be added
column: Column to be added
i: Index of the column after insertion, -1 meaning "last position"
Returns
true
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertRow()

bool TitleBlockTemplate::insertRow ( int  dimension,
const QList< TitleBlockCell * > &  row,
int  i = -1 
)

TitleBlockTemplate::insertRow.

Parameters
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"
Returns
true
Here is the call graph for this function:
Here is the caller graph for this function:

◆ interpreteVariables()

QString TitleBlockTemplate::interpreteVariables ( const QString &  string,
const DiagramContext diagram_context 
) const
private

TitleBlockTemplate::interpreteVariables.

Parameters
string: A text containing 0 to n variables, e.g. "%var" or "%{var}"
diagram_context: Diagram context to use to interprete variables
Returns
the provided string with variables replaced by the values from the diagram context
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lengthRange()

int TitleBlockTemplate::lengthRange ( int  start,
int  end,
const QList< int > &  lengths_list 
) const
private

TitleBlockTemplate::lengthRange.

Parameters
start: start border number
end: end border number
lengths_list:
Returns
the width between two borders
Here is the caller graph for this function:

◆ listOfVariables()

QStringList TitleBlockTemplate::listOfVariables ( )

TitleBlockTemplate::listOfVariables Get list of variables.

Returns
The list of string with variables

◆ loadCell()

void TitleBlockTemplate::loadCell ( const QDomElement &  cell_element)
protected

TitleBlockTemplate::loadCell Load a cell into this template.

Parameters
cell_element: XML element describing a cell within a title block template
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadCells()

bool TitleBlockTemplate::loadCells ( const QDomElement &  xml_element)
protected

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

Parameters
xml_elementXML element to analyze
Returns
systematically true
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFromXmlElement()

bool TitleBlockTemplate::loadFromXmlElement ( const QDomElement &  xml_element)

TitleBlockTemplate::loadFromXmlElement.

Parameters
xml_element: An XML document to read the template from.
Returns
true if the reading succeeds, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFromXmlFile()

bool TitleBlockTemplate::loadFromXmlFile ( const QString &  filepath)

TitleBlockTemplate::loadFromXmlFile Load a titleblock template from an XML file.

Parameters
filepath: A file path to read the template from.
Returns
true if the reading succeeds, false otherwise.
Here is the call graph for this function:

◆ loadGrid()

bool TitleBlockTemplate::loadGrid ( const QDomElement &  xml_element)
protected

Import the grid from a given XML titleblock template.

Parameters
xml_elementAn XML element representing an titleblock template.
Returns
true if the reading succeeds, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadInformation()

void TitleBlockTemplate::loadInformation ( const QDomElement &  xml_element)
protected

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

Parameters
xml_element
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadLogo()

bool TitleBlockTemplate::loadLogo ( const QDomElement &  xml_element)
protected

TitleBlockTemplate::loadLogo Import the logo from a given XML logo description.

Parameters
xml_element: An XML element representing a logo within an titleblock template.
Returns
true if the reading succeeds, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadLogos()

bool TitleBlockTemplate::loadLogos ( const QDomElement &  xml_element,
bool  reset = false 
)
protected

TitleBlockTemplate::loadLogos Import the logos from a given XML titleblock template.

Parameters
xml_element: An XML element representing an titleblock template.
reset: true to delete all previously known logos before, false otherwise.
Returns
true if the reading succeeds, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ logos()

QList< QString > TitleBlockTemplate::logos ( ) const

TitleBlockTemplate::logos.

Returns
The names of logos embedded within this title block template.

◆ logoType()

QString TitleBlockTemplate::logoType ( const QString &  logo_name) const

TitleBlockTemplate::logoType.

Parameters
logo_name: Name of a logo embedded within this title block template.
Returns
the kind of storage used for the required logo, or a null QString if no such logo was found in this template.

◆ maximumWidth()

int TitleBlockTemplate::maximumWidth ( )

TitleBlockTemplate::maximumWidth.

Returns
the maximum width for this template, or -1 if it does not have any.
Here is the call graph for this function:

◆ minimumWidth()

int TitleBlockTemplate::minimumWidth ( )
Returns
the minimum width for this template
Here is the call graph for this function:

◆ moveColumn()

bool TitleBlockTemplate::moveColumn ( int  from,
int  to 
)

TitleBlockTemplate::moveColumn Move the column at index "from" to index "to".

Parameters
from: Source index of the moved column
to: Target index of the moved column
Returns
true or false
Here is the call graph for this function:

◆ moveRow()

bool TitleBlockTemplate::moveRow ( int  from,
int  to 
)

TitleBlockTemplate::moveRow Move a row within this template.

Parameters
from: Index of the moved row
to: Arrival index of the moved row
Returns
true on row Changed or false
Here is the call graph for this function:

◆ name()

QString TitleBlockTemplate::name ( ) const

TitleBlockTemplate::name.

Returns
the name of this template
Here is the caller graph for this function:

◆ parseColumns()

void TitleBlockTemplate::parseColumns ( const QString &  cols_string)
private

TitleBlockTemplate::parseColumns Parse the columns widths.

Parameters
cols_string: A string describing the columns widths of the titleblock
Here is the caller graph for this function:

◆ parseRows()

void TitleBlockTemplate::parseRows ( const QString &  rows_string)
private

TitleBlockTemplate::parseRows Parse the rows heights.

Parameters
rows_string: A string describing the rows heights of the titleblock
Here is the caller graph for this function:

◆ removeLogo()

bool TitleBlockTemplate::removeLogo ( const QString &  logo_name)

TitleBlockTemplate::removeLogo.

Parameters
logo_name: Name of the logo to remove
Returns
true if the logo could be deleted, false otherwise

TODO check existing cells using this logo.

Here is the caller graph for this function:

◆ renameLogo()

bool TitleBlockTemplate::renameLogo ( const QString &  logo_name,
const QString &  new_name 
)

TitleBlockTemplate::renameLogo Rename the logo_name logo to new_name.

Parameters
logo_name: Name of the logo to be renamed
new_name: New name of the renamed logo
Returns

TODO check existing cells using this logo.

◆ render()

void TitleBlockTemplate::render ( QPainter &  painter,
const DiagramContext diagram_context,
int  titleblock_width 
) const

TitleBlockTemplate::render Render the titleblock.

Parameters
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderCell()

void TitleBlockTemplate::renderCell ( QPainter &  painter,
const TitleBlockCell cell,
const DiagramContext diagram_context,
const QRect &  cell_rect 
) const

TitleBlockTemplate::renderCell Render a titleblock cell.

Parameters
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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderDxf()

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.

Parameters
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:
Here is the call graph for this function:

◆ renderTextCell()

void TitleBlockTemplate::renderTextCell ( QPainter &  painter,
const QString &  text,
const TitleBlockCell cell,
const QRectF &  cell_rect 
) const
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.

Parameters
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderTextCellDxf()

void TitleBlockTemplate::renderTextCellDxf ( QString &  file_path,
const QString &  text,
const TitleBlockCell cell,
qreal  x,
qreal  y,
qreal  w,
qreal  h,
int  color 
) const
private

TitleBlockTemplate::renderTextCellDxf.

Parameters
file_path
text
cell
x
y
w
h
color
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rowColsChanged()

void TitleBlockTemplate::rowColsChanged ( )

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rowDimension()

int TitleBlockTemplate::rowDimension ( int  i)

TitleBlockTemplate::rowDimension.

Parameters
i: row index
Returns
the height of the row at index i

◆ rowsCount()

int TitleBlockTemplate::rowsCount ( ) const

TitleBlockTemplate::rowsCount.

Returns
the number of rows in this template
Here is the caller graph for this function:

◆ rowsHeights()

QList< int > TitleBlockTemplate::rowsHeights ( ) const

TitleBlockTemplate::rowsHeights.

Returns
the heights of all the rows in this template

◆ saveCell()

void TitleBlockTemplate::saveCell ( TitleBlockCell cell,
QDomElement &  xml_element,
bool  save_empty = false 
) const
protected

TitleBlockTemplate::saveCell Export a specific cell as XML.

Parameters
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveCells()

void TitleBlockTemplate::saveCells ( QDomElement &  xml_element) const
protected

TitleBlockTemplate::saveCells Export this template's cells as XML (without the grid-related information, usch as rows and cols)

Parameters
xml_element: XML element under which the <cell> elements will be attached
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveGrid()

void TitleBlockTemplate::saveGrid ( QDomElement &  xml_element) const
protected

TitleBlockTemplate::saveGrid Export this template's cells grid as XML.

Parameters
xml_element: XML element under which the <grid> element will be attached
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveInformation()

void TitleBlockTemplate::saveInformation ( QDomElement &  xml_element) const
protected

TitleBlockTemplate::saveInformation Export this template's extra information.

Parameters
xml_element: XML element under which extra informations will be attached
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveLogo()

void TitleBlockTemplate::saveLogo ( const QString &  logo_name,
QDomElement &  xml_element 
) const
protected

TitleBlockTemplate::saveLogo Export a specific logo as XML.

Parameters
logo_name: Name of the logo to be exported
xml_element: XML element in which the logo will be exported
Here is the caller graph for this function:

◆ saveLogos()

void TitleBlockTemplate::saveLogos ( QDomElement &  xml_element) const
protected

TitleBlockTemplate::saveLogos Export this template's logos as XML.

Parameters
xml_element: XML Element under which the <logos> element will be attached
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveLogoToFile()

bool TitleBlockTemplate::saveLogoToFile ( const QString &  logo_name,
const QString &  filepath 
)

TitleBlockTemplate::saveLogoToFile.

Parameters
logo_name: Name used to store the logo
filepath: Path the logo will be saved as
Returns
true if the logo could be exported, false otherwise

◆ saveToXmlElement()

bool TitleBlockTemplate::saveToXmlElement ( QDomElement &  xml_element) const

TitleBlockTemplate::saveToXmlElement Save the title block template as XML.

Parameters
xml_element: The XML element this title block template should be saved to.
Returns
true if the export succeeds, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveToXmlFile()

bool TitleBlockTemplate::saveToXmlFile ( const QString &  filepath)

TitleBlockTemplate::saveToXmlFile Save the title block template into an XML file.

Parameters
filepath: The file path this title block template should be saved to.
Returns
true if the operation succeeds, false otherwise
Here is the call graph for this function:

◆ setAllSpans()

void TitleBlockTemplate::setAllSpans ( const QHash< TitleBlockCell *, QPair< int, int > > &  spans)

TitleBlockTemplate::setAllSpans Restore a set of span parameters.

Parameters
spans:
Here is the call graph for this function:

◆ setColumnDimension()

void TitleBlockTemplate::setColumnDimension ( int  i,
const TitleBlockDimension dimension 
)

TitleBlockTemplate::setColumnDimension Set the width of a column.

Parameters
i: column index
dimension: New width of the column at index i

◆ setInformation()

void TitleBlockTemplate::setInformation ( const QString &  info)

TitleBlockTemplate::setInformation.

Parameters
infoinformation to be attached to this template
Here is the caller graph for this function:

◆ setLogoStorage()

void TitleBlockTemplate::setLogoStorage ( const QString &  logo_name,
const QString &  storage 
)

TitleBlockTemplate::setLogoStorage Set the kind of storage for the logo_name logo.

Parameters
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".

◆ setRowDimension()

void TitleBlockTemplate::setRowDimension ( int  i,
const TitleBlockDimension dimension 
)

TitleBlockTemplate::setRowDimension Set the height of a row.

Parameters
i: row index
dimension: New height of the row at index i

◆ spannedCells()

QSet< TitleBlockCell * > TitleBlockTemplate::spannedCells ( const TitleBlockCell given_cell,
bool  ignore_span_state = false 
) const

TitleBlockTemplate::spannedCells.

Parameters
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.
Returns
the set of cells spanned by the provided cell Note the returned set does not include the spanning, provided cell
Here is the call graph for this function:
Here is the caller graph for this function:

◆ takeColumn()

QList< TitleBlockCell * > TitleBlockTemplate::takeColumn ( int  i)

TitleBlockTemplate::takeColumn Removes the column at index i.

Parameters
i: Index of the column to be removed
Returns
the removed column
Here is the call graph for this function:

◆ takeRow()

QList< TitleBlockCell * > TitleBlockTemplate::takeRow ( int  i)

TitleBlockTemplate::takeRow Removes the row at index i.

Parameters
i: Index of the column to be removed
Returns
the removed column
Here is the call graph for this function:

◆ vectorLogo()

QSvgRenderer * TitleBlockTemplate::vectorLogo ( const QString &  logo_name) const

TitleBlockTemplate::vectorLogo.

Parameters
logo_name: Name of a vector logo embedded within this title block template.
Returns
the rendering object for the required vector logo, or 0 if no such vector logo was found in this template.

◆ width()

int TitleBlockTemplate::width ( int  total_width)

TitleBlockTemplate::width.

Parameters
total_width: The total width initially planned for the rendering
Returns
the total effective width of this template
Here is the call graph for this function:

Member Data Documentation

◆ bitmap_logos_

QHash<QString, QPixmap> TitleBlockTemplate::bitmap_logos_
private

bitmap_logos_ : Pixmaps for bitmap logos

◆ cells_

QList< QList<TitleBlockCell *> > TitleBlockTemplate::cells_
private

Cells grid.

◆ columns_width_

QList<TitleBlockDimension> TitleBlockTemplate::columns_width_
private

columns_width_ : columns widths –

See also
TitleBlockColDimension

◆ data_logos_

QHash<QString, QByteArray > TitleBlockTemplate::data_logos_
private

data_logos_ : Logos raw data

◆ information_

QString TitleBlockTemplate::information_
private

◆ name_

QString TitleBlockTemplate::name_
private

name_ : name identifying the Title Block Template within its parent collection

◆ registered_cells_

QList<TitleBlockCell *> TitleBlockTemplate::registered_cells_
private

registered_cells_ : Cells objects created rattached to this template, but not mandatorily used

◆ rows_heights_

QList<int> TitleBlockTemplate::rows_heights_
private

rows heights – simple integers

◆ storage_logos_

QHash<QString, QString> TitleBlockTemplate::storage_logos_
private

storage_logos_ : Logos applied storage type (e.g. "xml" or "base64")

◆ type_logos_

QHash<QString, QString> TitleBlockTemplate::type_logos_
private

type_logos_ : Logos types (e.g. "png", "jpeg", "svg")

◆ vector_logos_

QHash<QString, QSvgRenderer *> TitleBlockTemplate::vector_logos_
private

vector_logos_ : Rendered objects for vector logos


The documentation for this class was generated from the following files: