QElectroTech  0.70
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TitleBlockTemplateRenderer Class Reference

#include <titleblocktemplaterenderer.h>

Public Member Functions

 TitleBlockTemplateRenderer (QObject *=nullptr)
 
 ~TitleBlockTemplateRenderer () override
 
const TitleBlockTemplatetitleBlockTemplate () const
 
void setTitleBlockTemplate (const TitleBlockTemplate *)
 
void setContext (const DiagramContext &context)
 TitleBlockTemplateRenderer::setContext. More...
 
DiagramContext context () const
 TitleBlockTemplateRenderer::context. More...
 
int height () const
 
void render (QPainter *, int)
 
void renderDxf (QRectF &, int, QString &, int)
 
void invalidateRenderedTemplate ()
 
void setUseCache (bool)
 
bool useCache () const
 

Private Member Functions

void renderToQPicture (int)
 

Private Attributes

const TitleBlockTemplatem_titleblock_template
 
bool m_use_cache
 
QPicture m_rendered_template
 
DiagramContext m_context
 
int m_last_known_titleblock_width
 

Detailed Description

Definition at line 25 of file titleblocktemplaterenderer.h.

Constructor & Destructor Documentation

◆ TitleBlockTemplateRenderer()

TitleBlockTemplateRenderer::TitleBlockTemplateRenderer ( QObject *  parent = nullptr)

Constructor

Parameters
parnetParent QObject of this renderer

Definition at line 8 of file titleblocktemplaterenderer.cpp.

◆ ~TitleBlockTemplateRenderer()

TitleBlockTemplateRenderer::~TitleBlockTemplateRenderer ( )
override

Destructor

Definition at line 19 of file titleblocktemplaterenderer.cpp.

Member Function Documentation

◆ context()

DiagramContext TitleBlockTemplateRenderer::context ( ) const

TitleBlockTemplateRenderer::context.

Returns
the current diagram context use when render the titleblock

Definition at line 52 of file titleblocktemplaterenderer.cpp.

References m_context.

Referenced by setContext(), BorderTitleBlock::setNextFolioNum(), and BorderTitleBlock::setPreviousFolioNum().

◆ height()

int TitleBlockTemplateRenderer::height ( ) const
Returns
the height of the rendered template, or -1 if no template has been set for this renderer.
See also
TitleBlockTemplate::height()

Definition at line 61 of file titleblocktemplaterenderer.cpp.

References m_titleblock_template.

◆ invalidateRenderedTemplate()

void TitleBlockTemplateRenderer::invalidateRenderedTemplate ( )

Invalidates the previous rendering of the template by resetting the internal QPicture.

Definition at line 114 of file titleblocktemplaterenderer.cpp.

References m_rendered_template.

Referenced by setContext(), and setTitleBlockTemplate().

◆ render()

void TitleBlockTemplateRenderer::render ( QPainter *  provided_painter,
int  titleblock_width 
)

Render the titleblock.

Parameters
provided_painterQPainter to use to render the titleblock.
titleblock_widthThe total width of the titleblock to render

Definition at line 71 of file titleblocktemplaterenderer.cpp.

References m_context, m_last_known_titleblock_width, m_rendered_template, m_titleblock_template, m_use_cache, and renderToQPicture().

Referenced by renderToQPicture().

◆ renderDxf()

void TitleBlockTemplateRenderer::renderDxf ( QRectF &  title_block_rect,
int  titleblock_width,
QString &  file_path,
int  color 
)

Definition at line 89 of file titleblocktemplaterenderer.cpp.

References m_context, and m_titleblock_template.

◆ renderToQPicture()

void TitleBlockTemplateRenderer::renderToQPicture ( int  titleblock_width)
private

Renders the titleblock to the internal QPicture

Parameters
titleblock_widthWidth of the titleblock to render

Definition at line 98 of file titleblocktemplaterenderer.cpp.

References m_context, m_last_known_titleblock_width, m_rendered_template, m_titleblock_template, and render().

Referenced by render().

◆ setContext()

void TitleBlockTemplateRenderer::setContext ( const DiagramContext context)

TitleBlockTemplateRenderer::setContext.

Parameters
context: Context to use when rendering the titleblock

Definition at line 43 of file titleblocktemplaterenderer.cpp.

References context(), invalidateRenderedTemplate(), and m_context.

Referenced by BorderTitleBlock::setNextFolioNum(), and BorderTitleBlock::setPreviousFolioNum().

◆ setTitleBlockTemplate()

void TitleBlockTemplateRenderer::setTitleBlockTemplate ( const TitleBlockTemplate titleblock_template)
Parameters
titleblock_templateTitleBlock template to render.

Definition at line 32 of file titleblocktemplaterenderer.cpp.

References invalidateRenderedTemplate(), and m_titleblock_template.

◆ setUseCache()

void TitleBlockTemplateRenderer::setUseCache ( bool  use_cache)
Parameters
use_cachetrue for this renderer to use its QPicture-based cache, false otherwise.

Definition at line 122 of file titleblocktemplaterenderer.cpp.

References m_use_cache.

◆ titleBlockTemplate()

const TitleBlockTemplate * TitleBlockTemplateRenderer::titleBlockTemplate ( ) const
Returns
the titleblock template used for the rendering

Definition at line 25 of file titleblocktemplaterenderer.cpp.

References m_titleblock_template.

◆ useCache()

bool TitleBlockTemplateRenderer::useCache ( ) const
Returns
true if this renderer uses its QPicture-based cache, false otherwise.

Definition at line 130 of file titleblocktemplaterenderer.cpp.

References m_use_cache.

Member Data Documentation

◆ m_context

DiagramContext TitleBlockTemplateRenderer::m_context
private

Definition at line 53 of file titleblocktemplaterenderer.h.

Referenced by context(), render(), renderDxf(), renderToQPicture(), and setContext().

◆ m_last_known_titleblock_width

int TitleBlockTemplateRenderer::m_last_known_titleblock_width
private

Definition at line 54 of file titleblocktemplaterenderer.h.

Referenced by render(), and renderToQPicture().

◆ m_rendered_template

QPicture TitleBlockTemplateRenderer::m_rendered_template
private

◆ m_titleblock_template

const TitleBlockTemplate* TitleBlockTemplateRenderer::m_titleblock_template
private

◆ m_use_cache

bool TitleBlockTemplateRenderer::m_use_cache
private

Definition at line 51 of file titleblocktemplaterenderer.h.

Referenced by render(), setUseCache(), and useCache().


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