QElectroTech 0.100.0-dev
|
#include <templateview.h>
Inherits QGraphicsView.
Public Slots | |
void | setTitleBlockTemplate (TitleBlockTemplate *) |
void | selectionChanged () |
void | zoomIn () |
void | zoomOut () |
void | zoomFit () |
void | zoomReset () |
QList< TitleBlockCell * > | cut () |
QList< TitleBlockCell * > | copy () |
bool | mayPaste () |
QList< TitleBlockCell > | pastedCells () |
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 | |
TitleBlockTemplate * | titleBlockTemplate () 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 | |
TitleBlockTemplate * | tbtemplate_ |
QGraphicsGridLayout * | tbgrid_ |
QGraphicsWidget * | form_ |
int | preview_width_ |
SplittedHelperCell * | total_width_helper_cell_ |
HelperCell * | extra_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_ |
HelperCell * | last_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. | |
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.
TitleBlockTemplateView::TitleBlockTemplateView | ( | QWidget * | parent = nullptr | ) |
Constructor
parent | Parent QWidget. |
TitleBlockTemplateView::TitleBlockTemplateView | ( | QGraphicsScene * | scene, |
QWidget * | parent = nullptr |
||
) |
TitleBlockTemplateView::TitleBlockTemplateView.
scene | |
parent | Parent QWidget. |
|
override |
Destructor
|
private |
|
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.
|
slot |
Add a column right after the last index selected when calling the context menu.
|
slot |
Add a column right after the last one.
|
slot |
Add a column right before the last index selected when calling the context menu.
|
slot |
Add a row right after the last index selected when calling the context menu.
|
slot |
Add a row right after the last one.
|
slot |
Add a row right before the last index selected when calling the context menu.
|
privateslot |
Adjusts the bounding rect of the scene.
|
virtual |
TitleBlockTemplateView::analyzeSelectedCells.
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 |
|
protectedvirtualslot |
Apply the columns widths currently specified by the edited title block template.
animate | true to animate the change, false otherwise. |
|
protectedvirtualslot |
Apply the rows heights currently specified by the edited title block template.
animate | true to animate the change, false otherwise. |
|
virtual |
rect | Rectangle in the coordinates of the QGraphicsWidget representing the title block template. |
|
slot |
Ask the user a new width for the preview
|
private |
|
slot |
Update the displayed layout. Call this function when the dimensions of columns changed.
|
slot |
Export currently selected cells to the clipboard.
|
slot |
Export currently selected cells to the clipboard before setting them as empty.
|
slot |
Remove the column at the last index selected when calling the context menu.
|
slot |
Remove the row at the last index selected when calling the context menu.
|
overrideprotected |
Reimplement the way the background is drawn to render the title block template.
|
slot |
Edit the width of a column.
cell | (optional) HelperCell of the column to be modified. If 0, this method uses the last index selected when calling the context menu. |
|
slot |
Edit the height of a row.
cell | (optional) HelperCell of the row to be modified. If 0, this method uses the last index selected when calling the context menu. |
|
overrideprotected |
event | Object describing the received event |
|
protectedvirtual |
Fill the layout with empty cells where needed.
|
signal |
|
private |
item | an item supposed to be contained in the grid layout. |
|
protectedvirtual |
Initialize this view (actions, signals/slots connections, etc.)
|
private |
|
protectedvirtual |
Load the tbt title block template. If a different template was previously loaded, it is deleted.
|
private |
TitleBlockTemplateView::makeCellsSetFromGraphicsItems.
items | : a list of QGraphicsItem |
|
private |
TitleBlockTemplateView::makePrettyToolTip.
string | : a text string |
|
slot |
|
slot |
Merge the selected cells.
|
protectedvirtual |
TitleBlockTemplateView::normalizeCells Given a cells list, change their position so the top left one is at row x and column y.
cells | Cells list |
x | : row |
y | : column |
|
slot |
Import the cells described in the clipboard.
|
slot |
|
signal |
|
slot |
Refresh the regular cells.
|
private |
Removes an item from the grid layout
item | an item supposed to be contained in the grid layout. |
|
private |
Emit the gridModificationRequested() signal with command after having set its view component.
command | A command object modifying the rendered title block template. |
|
private |
|
slot |
Update the displayed layout. Call this function when the dimensions of rows changed.
|
virtual |
|
signal |
|
virtual |
|
slot |
Emits the selectedCellsChanged() signal with the currently selected cells.
|
slot |
Set the new preview width to width
width | new preview width |
|
slot |
read_only | whether this view should be read only. |
|
slot |
tbtemplate | Title block template to be rendered by this view. If set to zero, the View will render nothing. |
|
slot |
Split the selected cell.
|
virtual |
|
virtual |
|
virtual |
TitleBlockTemplate * TitleBlockTemplateView::titleBlockTemplate | ( | ) | const |
|
protectedvirtualslot |
Update the content (type and value) of columns helper cells.
|
slot |
Update the tooltip that displays the minimum and/or maximum width of the template.
|
privateslot |
Stores last_context_menu_cell as being the last helper cell the context menu was triggered on.
|
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.
|
protectedvirtualslot |
Update the content (type and value) of rows helper cells.
|
private |
Update the label of the helper cell that indicates the preview width.
|
overrideprotected |
Handles mouse wheel-related actions
e | QWheelEvent describing the wheel event |
|
protectedvirtual |
|
slot |
Fit the rendered title block template in this view.
|
slot |
Zoom in by zoomFactor().
|
slot |
Zoom out by zoomFactor().
|
slot |
Reset the zoom level.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Boolean used to detect the first display of this widget.
|
private |
|
private |
|
private |
|
private |
Boolean stating whether this view allows template edition.
|
private |
|
private |
|
private |