QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
TitleBlockTemplateView Class Reference

#include <templateview.h>

Inherits QGraphicsView.

Collaboration diagram for TitleBlockTemplateView:
Collaboration graph

Public Slots

void setTitleBlockTemplate (TitleBlockTemplate *)
 
void selectionChanged ()
 
void zoomIn ()
 
void zoomOut ()
 
void zoomFit ()
 
void zoomReset ()
 
QList< TitleBlockCell * > cut ()
 
QList< TitleBlockCell * > copy ()
 
bool mayPaste ()
 
QList< TitleBlockCellpastedCells ()
 
void paste ()
 
void addColumnAtEnd ()
 
void addRowAtEnd ()
 
void addColumnBefore ()
 
void addRowBefore ()
 
void addColumnAfter ()
 
void addRowAfter ()
 
void editColumn (HelperCell *=nullptr)
 
void editRow (HelperCell *=nullptr)
 
void deleteColumn ()
 
void deleteRow ()
 
void mergeSelectedCells ()
 
void splitSelectedCell ()
 
void refresh ()
 
void changePreviewWidth ()
 
void setPreviewWidth (int)
 
void updateLayout ()
 
void rowsDimensionsChanged ()
 
void columnsDimensionsChanged ()
 
void updateDisplayedMinMaxWidth ()
 
void setReadOnly (bool)
 

Signals

void selectedCellsChanged (QList< TitleBlockCell * >)
 
void gridModificationRequested (TitleBlockTemplateCommand *)
 
void previewWidthChanged (int, int)
 

Public Member Functions

 TitleBlockTemplateView (QWidget *=nullptr)
 
 TitleBlockTemplateView (QGraphicsScene *, QWidget *=nullptr)
 TitleBlockTemplateView::TitleBlockTemplateView.
 
 ~TitleBlockTemplateView () override
 
TitleBlockTemplatetitleBlockTemplate () const
 
virtual QList< TitleBlockCell * > selectedCells () const
 
virtual TitleBlockTemplateCellsSet selectedCellsSet () const
 
virtual TitleBlockTemplateCellsSet cells (const QRectF &) const
 
virtual void analyzeSelectedCells (bool *, bool *, int *)
 TitleBlockTemplateView::analyzeSelectedCells.
 
virtual QSizeF templateSize () const
 
virtual qreal templateWidth () const
 
virtual qreal templateHeight () const
 

Protected Slots

virtual void applyColumnsWidths (bool=true)
 
virtual void applyRowsHeights (bool=true)
 
virtual void updateRowsHelperCells ()
 
virtual void updateColumnsHelperCells ()
 

Protected Member Functions

void drawBackground (QPainter *, const QRectF &) override
 
virtual void addCells ()
 
virtual void loadTemplate (TitleBlockTemplate *)
 
virtual void init ()
 
void wheelEvent (QWheelEvent *) override
 
virtual qreal zoomFactor () const
 
virtual void fillWithEmptyCells ()
 
bool event (QEvent *) override
 
virtual void normalizeCells (QList< TitleBlockCell > &, int x=0, int y=0) const
 TitleBlockTemplateView::normalizeCells Given a cells list, change their position so the top left one is at row x and column y.
 

Private Slots

void updateLastContextMenuCell (HelperCell *)
 
void adjustSceneRect ()
 

Private Member Functions

 TitleBlockTemplateView (const TitleBlockTemplateView &)
 
QList< QAction * > rowsActions () const
 
QList< QAction * > columnsActions () const
 
void updateTotalWidthLabel ()
 
void requestGridModification (TitleBlockTemplateCommand *)
 
int lastContextMenuCellIndex () const
 
int indexOf (QGraphicsLayoutItem *)
 
void removeItem (QGraphicsLayoutItem *)
 
TitleBlockTemplateCellsSet makeCellsSetFromGraphicsItems (const QList< QGraphicsItem * > &) const
 TitleBlockTemplateView::makeCellsSetFromGraphicsItems.
 
QString makePrettyToolTip (const QString &)
 TitleBlockTemplateView::makePrettyToolTip.
 

Private Attributes

TitleBlockTemplatetbtemplate_
 
QGraphicsGridLayout * tbgrid_
 
QGraphicsWidget * form_
 
int preview_width_
 
SplittedHelperCelltotal_width_helper_cell_
 
HelperCellextra_cells_width_helper_cell_
 
QAction * add_column_before_
 
QAction * add_row_before_
 
QAction * add_column_after_
 
QAction * add_row_after_
 
QAction * edit_column_dim_
 
QAction * edit_row_dim_
 
QAction * delete_column_
 
QAction * delete_row_
 
QAction * change_preview_width_
 
HelperCelllast_context_menu_cell_
 
int apply_columns_widths_count_
 
int apply_rows_heights_count_
 
bool first_activation_
 Boolean used to detect the first display of this widget.
 
bool read_only_
 Boolean stating whether this view allows template edition.
 

Detailed Description

This QGraphicsView subclass is used in the title block template editor to offer a graphical preview of the template being edited, but also to handle cell selection and various actions.

Constructor & Destructor Documentation

◆ TitleBlockTemplateView() [1/3]

TitleBlockTemplateView::TitleBlockTemplateView ( QWidget *  parent = nullptr)

Constructor

Parameters
parentParent QWidget.
Here is the call graph for this function:

◆ TitleBlockTemplateView() [2/3]

TitleBlockTemplateView::TitleBlockTemplateView ( QGraphicsScene *  scene,
QWidget *  parent = nullptr 
)

TitleBlockTemplateView::TitleBlockTemplateView.

Parameters
scene
parentParent QWidget.
Here is the call graph for this function:

◆ ~TitleBlockTemplateView()

TitleBlockTemplateView::~TitleBlockTemplateView ( )
override

Destructor

◆ TitleBlockTemplateView() [3/3]

TitleBlockTemplateView::TitleBlockTemplateView ( const TitleBlockTemplateView )
private

Member Function Documentation

◆ addCells()

void TitleBlockTemplateView::addCells ( )
protectedvirtual

Add the cells (both helper cells and regular visual cells) to the scene to get a visual representation of the edited title block template.

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

◆ addColumnAfter

void TitleBlockTemplateView::addColumnAfter ( )
slot

Add a column right after the last index selected when calling the context menu.

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

◆ addColumnAtEnd

void TitleBlockTemplateView::addColumnAtEnd ( )
slot

Add a column right after the last one.

Here is the call graph for this function:

◆ addColumnBefore

void TitleBlockTemplateView::addColumnBefore ( )
slot

Add a column right before the last index selected when calling the context menu.

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

◆ addRowAfter

void TitleBlockTemplateView::addRowAfter ( )
slot

Add a row right after the last index selected when calling the context menu.

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

◆ addRowAtEnd

void TitleBlockTemplateView::addRowAtEnd ( )
slot

Add a row right after the last one.

Here is the call graph for this function:

◆ addRowBefore

void TitleBlockTemplateView::addRowBefore ( )
slot

Add a row right before the last index selected when calling the context menu.

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

◆ adjustSceneRect

void TitleBlockTemplateView::adjustSceneRect ( )
privateslot

Adjusts the bounding rect of the scene.

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

◆ analyzeSelectedCells()

void TitleBlockTemplateView::analyzeSelectedCells ( bool *  can_merge,
bool *  can_split,
int *  count 
)
virtual

TitleBlockTemplateView::analyzeSelectedCells.

Parameters
can_merge: If non-zero, will be changed to reflect whether selected cells may be merged
can_split: If non-zero, will be changed to reflect whether selected cells may be splitted
count: If non-zero, will be changed to reflect the number of selected cells
Here is the call graph for this function:

◆ applyColumnsWidths

void TitleBlockTemplateView::applyColumnsWidths ( bool  animate = true)
protectedvirtualslot

Apply the columns widths currently specified by the edited title block template.

Parameters
animatetrue to animate the change, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyRowsHeights

void TitleBlockTemplateView::applyRowsHeights ( bool  animate = true)
protectedvirtualslot

Apply the rows heights currently specified by the edited title block template.

Parameters
animatetrue to animate the change, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cells()

TitleBlockTemplateCellsSet TitleBlockTemplateView::cells ( const QRectF &  rect) const
virtual
Returns
the visual cells contained in the rect
Parameters
rectRectangle in the coordinates of the QGraphicsWidget representing the title block template.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ changePreviewWidth

void TitleBlockTemplateView::changePreviewWidth ( )
slot

Ask the user a new width for the preview

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

◆ columnsActions()

QList< QAction * > TitleBlockTemplateView::columnsActions ( ) const
private
Returns
the list of columns-specific actions.
Here is the caller graph for this function:

◆ columnsDimensionsChanged

void TitleBlockTemplateView::columnsDimensionsChanged ( )
slot

Update the displayed layout. Call this function when the dimensions of columns changed.

Here is the call graph for this function:

◆ copy

QList< TitleBlockCell * > TitleBlockTemplateView::copy ( )
slot

Export currently selected cells to the clipboard.

Returns
the list of cells copied to the clipboard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cut

QList< TitleBlockCell * > TitleBlockTemplateView::cut ( )
slot

Export currently selected cells to the clipboard before setting them as empty.

Returns
the list of cells copied to the clipboard
Here is the call graph for this function:

◆ deleteColumn

void TitleBlockTemplateView::deleteColumn ( )
slot

Remove the column at the last index selected when calling the context menu.

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

◆ deleteRow

void TitleBlockTemplateView::deleteRow ( )
slot

Remove the row at the last index selected when calling the context menu.

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

◆ drawBackground()

void TitleBlockTemplateView::drawBackground ( QPainter *  painter,
const QRectF &  rect 
)
overrideprotected

Reimplement the way the background is drawn to render the title block template.

◆ editColumn

void TitleBlockTemplateView::editColumn ( HelperCell cell = nullptr)
slot

Edit the width of a column.

Parameters
cell(optional) HelperCell of the column to be modified. If 0, this method uses the last index selected when calling the context menu.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ editRow

void TitleBlockTemplateView::editRow ( HelperCell cell = nullptr)
slot

Edit the height of a row.

Parameters
cell(optional) HelperCell of the row to be modified. If 0, this method uses the last index selected when calling the context menu.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ event()

bool TitleBlockTemplateView::event ( QEvent *  event)
overrideprotected
Parameters
eventObject describing the received event
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fillWithEmptyCells()

void TitleBlockTemplateView::fillWithEmptyCells ( )
protectedvirtual

Fill the layout with empty cells where needed.

Here is the caller graph for this function:

◆ gridModificationRequested

void TitleBlockTemplateView::gridModificationRequested ( TitleBlockTemplateCommand )
signal
Here is the caller graph for this function:

◆ indexOf()

int TitleBlockTemplateView::indexOf ( QGraphicsLayoutItem *  item)
private
Parameters
iteman item supposed to be contained in the grid layout.
Returns
the flat index if this item, or -1 if it could not be found.
Here is the caller graph for this function:

◆ init()

void TitleBlockTemplateView::init ( )
protectedvirtual

Initialize this view (actions, signals/slots connections, etc.)

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

◆ lastContextMenuCellIndex()

int TitleBlockTemplateView::lastContextMenuCellIndex ( ) const
private
Returns
the last index selected when triggering the context menu.
See also
updateLastContextMenuCell
Here is the caller graph for this function:

◆ loadTemplate()

void TitleBlockTemplateView::loadTemplate ( TitleBlockTemplate tbt)
protectedvirtual

Load the tbt title block template. If a different template was previously loaded, it is deleted.

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

◆ makeCellsSetFromGraphicsItems()

TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems ( const QList< QGraphicsItem * > &  items) const
private

TitleBlockTemplateView::makeCellsSetFromGraphicsItems.

Parameters
items: a list of QGraphicsItem
Returns
the corresponding TitleBlockTemplateCellsSet
Here is the caller graph for this function:

◆ makePrettyToolTip()

QString TitleBlockTemplateView::makePrettyToolTip ( const QString &  string)
private

TitleBlockTemplateView::makePrettyToolTip.

Parameters
string: a text string
Returns
an HTML string that can be passed to setToolTip()
Here is the caller graph for this function:

◆ mayPaste

bool TitleBlockTemplateView::mayPaste ( )
slot
Returns
true if the content of the clipboard looks interesting

◆ mergeSelectedCells

void TitleBlockTemplateView::mergeSelectedCells ( )
slot

Merge the selected cells.

Here is the call graph for this function:

◆ normalizeCells()

void TitleBlockTemplateView::normalizeCells ( QList< TitleBlockCell > &  cells,
int  x = 0,
int  y = 0 
) const
protectedvirtual

TitleBlockTemplateView::normalizeCells Given a cells list, change their position so the top left one is at row x and column y.

Parameters
cellsCells list
x: row
y: column
Here is the call graph for this function:
Here is the caller graph for this function:

◆ paste

void TitleBlockTemplateView::paste ( )
slot

Import the cells described in the clipboard.

Here is the call graph for this function:

◆ pastedCells

QList< TitleBlockCell > TitleBlockTemplateView::pastedCells ( )
slot
Returns
a list containing the pasted cells
Here is the call graph for this function:
Here is the caller graph for this function:

◆ previewWidthChanged

void TitleBlockTemplateView::previewWidthChanged ( int  ,
int   
)
signal
Here is the caller graph for this function:

◆ refresh

void TitleBlockTemplateView::refresh ( )
slot

Refresh the regular cells.

◆ removeItem()

void TitleBlockTemplateView::removeItem ( QGraphicsLayoutItem *  item)
private

Removes an item from the grid layout

Parameters
iteman item supposed to be contained in the grid layout.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestGridModification()

void TitleBlockTemplateView::requestGridModification ( TitleBlockTemplateCommand command)
private

Emit the gridModificationRequested() signal with command after having set its view component.

See also
TitleBlockTemplateCommand::setView()
Parameters
commandA command object modifying the rendered title block template.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rowsActions()

QList< QAction * > TitleBlockTemplateView::rowsActions ( ) const
private
Returns
the list of rows-specific actions.
Here is the caller graph for this function:

◆ rowsDimensionsChanged

void TitleBlockTemplateView::rowsDimensionsChanged ( )
slot

Update the displayed layout. Call this function when the dimensions of rows changed.

Here is the call graph for this function:

◆ selectedCells()

QList< TitleBlockCell * > TitleBlockTemplateView::selectedCells ( ) const
virtual
Returns
the selected logical cells, not including the spanned ones.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectedCellsChanged

void TitleBlockTemplateView::selectedCellsChanged ( QList< TitleBlockCell * >  )
signal
Here is the caller graph for this function:

◆ selectedCellsSet()

TitleBlockTemplateCellsSet TitleBlockTemplateView::selectedCellsSet ( ) const
virtual
Returns
the selected visual cells.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectionChanged

void TitleBlockTemplateView::selectionChanged ( )
slot

Emits the selectedCellsChanged() signal with the currently selected cells.

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

◆ setPreviewWidth

void TitleBlockTemplateView::setPreviewWidth ( int  width)
slot

Set the new preview width to width

Parameters
widthnew preview width
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setReadOnly

void TitleBlockTemplateView::setReadOnly ( bool  read_only)
slot
Parameters
read_onlywhether this view should be read only.

◆ setTitleBlockTemplate

void TitleBlockTemplateView::setTitleBlockTemplate ( TitleBlockTemplate tbtemplate)
slot
Parameters
tbtemplateTitle block template to be rendered by this view. If set to zero, the View will render nothing.
Here is the call graph for this function:

◆ splitSelectedCell

void TitleBlockTemplateView::splitSelectedCell ( )
slot

Split the selected cell.

Here is the call graph for this function:

◆ templateHeight()

qreal TitleBlockTemplateView::templateHeight ( ) const
virtual
Returns
the current height of the rendered title block template
Here is the caller graph for this function:

◆ templateSize()

QSizeF TitleBlockTemplateView::templateSize ( ) const
virtual
Returns
the current size of the rendered title block template
Here is the call graph for this function:
Here is the caller graph for this function:

◆ templateWidth()

qreal TitleBlockTemplateView::templateWidth ( ) const
virtual
Returns
the current width of the rendered title block template
Here is the caller graph for this function:

◆ titleBlockTemplate()

TitleBlockTemplate * TitleBlockTemplateView::titleBlockTemplate ( ) const
Returns
The title block template object rendered by this view.

◆ updateColumnsHelperCells

void TitleBlockTemplateView::updateColumnsHelperCells ( )
protectedvirtualslot

Update the content (type and value) of columns helper cells.

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

◆ updateDisplayedMinMaxWidth

void TitleBlockTemplateView::updateDisplayedMinMaxWidth ( )
slot

Update the tooltip that displays the minimum and/or maximum width of the template.

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

◆ updateLastContextMenuCell

void TitleBlockTemplateView::updateLastContextMenuCell ( HelperCell last_context_menu_cell)
privateslot

Stores last_context_menu_cell as being the last helper cell the context menu was triggered on.

Here is the caller graph for this function:

◆ updateLayout

void TitleBlockTemplateView::updateLayout ( )
slot

Update the displayed layout. Call this function to refresh the display after the rendered title block template has been "deeply" modified, e.g. rows/columns have been added/modified or cells were merged/splitted.

Here is the call graph for this function:

◆ updateRowsHelperCells

void TitleBlockTemplateView::updateRowsHelperCells ( )
protectedvirtualslot

Update the content (type and value) of rows helper cells.

Here is the caller graph for this function:

◆ updateTotalWidthLabel()

void TitleBlockTemplateView::updateTotalWidthLabel ( )
private

Update the label of the helper cell that indicates the preview width.

Here is the caller graph for this function:

◆ wheelEvent()

void TitleBlockTemplateView::wheelEvent ( QWheelEvent *  e)
overrideprotected

Handles mouse wheel-related actions

Parameters
eQWheelEvent describing the wheel event
Here is the call graph for this function:

◆ zoomFactor()

qreal TitleBlockTemplateView::zoomFactor ( ) const
protectedvirtual
Returns
the zoom factor used by zoomIn() and zoomOut().
Here is the caller graph for this function:

◆ zoomFit

void TitleBlockTemplateView::zoomFit ( )
slot

Fit the rendered title block template in this view.

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

◆ zoomIn

void TitleBlockTemplateView::zoomIn ( )
slot

Zoom in by zoomFactor().

See also
zoomFactor()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zoomOut

void TitleBlockTemplateView::zoomOut ( )
slot

Zoom out by zoomFactor().

See also
zoomFactor()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zoomReset

void TitleBlockTemplateView::zoomReset ( )
slot

Reset the zoom level.

Here is the call graph for this function:

Member Data Documentation

◆ add_column_after_

QAction* TitleBlockTemplateView::add_column_after_
private

◆ add_column_before_

QAction* TitleBlockTemplateView::add_column_before_
private

◆ add_row_after_

QAction * TitleBlockTemplateView::add_row_after_
private

◆ add_row_before_

QAction * TitleBlockTemplateView::add_row_before_
private

◆ apply_columns_widths_count_

int TitleBlockTemplateView::apply_columns_widths_count_
private

◆ apply_rows_heights_count_

int TitleBlockTemplateView::apply_rows_heights_count_
private

◆ change_preview_width_

QAction* TitleBlockTemplateView::change_preview_width_
private

◆ delete_column_

QAction* TitleBlockTemplateView::delete_column_
private

◆ delete_row_

QAction * TitleBlockTemplateView::delete_row_
private

◆ edit_column_dim_

QAction* TitleBlockTemplateView::edit_column_dim_
private

◆ edit_row_dim_

QAction * TitleBlockTemplateView::edit_row_dim_
private

◆ extra_cells_width_helper_cell_

HelperCell* TitleBlockTemplateView::extra_cells_width_helper_cell_
private

◆ first_activation_

bool TitleBlockTemplateView::first_activation_
private

Boolean used to detect the first display of this widget.

◆ form_

QGraphicsWidget* TitleBlockTemplateView::form_
private

◆ last_context_menu_cell_

HelperCell* TitleBlockTemplateView::last_context_menu_cell_
private

◆ preview_width_

int TitleBlockTemplateView::preview_width_
private

◆ read_only_

bool TitleBlockTemplateView::read_only_
private

Boolean stating whether this view allows template edition.

◆ tbgrid_

QGraphicsGridLayout* TitleBlockTemplateView::tbgrid_
private

◆ tbtemplate_

TitleBlockTemplate* TitleBlockTemplateView::tbtemplate_
private

◆ total_width_helper_cell_

SplittedHelperCell* TitleBlockTemplateView::total_width_helper_cell_
private

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