QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
templateview.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef TITLEBLOCK_SLASH_TEMPLATE_VIEW_H
19#define TITLEBLOCK_SLASH_TEMPLATE_VIEW_H
20#include "../titleblocktemplate.h"
21
22#include <QGraphicsView>
23class HelperCell;
27
33class TitleBlockTemplateView : public QGraphicsView {
34 Q_OBJECT
35
36 // constructors, destructor
37 public:
38 TitleBlockTemplateView(QWidget * = nullptr);
39 TitleBlockTemplateView(QGraphicsScene *,
40 QWidget * = nullptr);
41 ~TitleBlockTemplateView() override;
42 private:
44
45 // methods and slots
46 public:
48 virtual QList<TitleBlockCell *> selectedCells() const;
50 virtual TitleBlockTemplateCellsSet cells(const QRectF &) const;
51 virtual void analyzeSelectedCells(bool *, bool *, int *);
52 virtual QSizeF templateSize() const;
53 virtual qreal templateWidth() const;
54 virtual qreal templateHeight() const;
55
56 public slots:
58 void selectionChanged();
59 void zoomIn();
60 void zoomOut();
61 void zoomFit();
62 void zoomReset();
63 QList<TitleBlockCell *> cut();
64 QList<TitleBlockCell *> copy();
65 bool mayPaste();
66 QList<TitleBlockCell> pastedCells();
67 void paste();
68 void addColumnAtEnd();
69 void addRowAtEnd();
70 void addColumnBefore();
71 void addRowBefore();
72 void addColumnAfter();
73 void addRowAfter();
74 void editColumn(HelperCell * = nullptr);
75 void editRow(HelperCell * = nullptr);
76 void deleteColumn();
77 void deleteRow();
78 void mergeSelectedCells();
79 void splitSelectedCell();
80 void refresh();
81 void changePreviewWidth();
82 void setPreviewWidth(int);
83 void updateLayout();
87 void setReadOnly(bool);
88
89 protected slots:
90 virtual void applyColumnsWidths(bool = true);
91 virtual void applyRowsHeights(bool = true);
92 virtual void updateRowsHelperCells();
93 virtual void updateColumnsHelperCells();
94
95 protected:
96 void drawBackground(QPainter *, const QRectF &) override;
97 virtual void addCells();
98 virtual void loadTemplate(TitleBlockTemplate *);
99 virtual void init();
100 void wheelEvent(QWheelEvent *) override;
101 virtual qreal zoomFactor() const;
102 virtual void fillWithEmptyCells();
103 bool event(QEvent *) override;
104 virtual void normalizeCells(
105 QList<TitleBlockCell> &, int x = 0, int y = 0) const;
106
107 signals:
108 void selectedCellsChanged(QList<TitleBlockCell *>);
110 void previewWidthChanged(int, int);
111
112 private:
113 QList<QAction *> rowsActions() const;
114 QList<QAction *> columnsActions() const;
117 int lastContextMenuCellIndex() const;
118 int indexOf(QGraphicsLayoutItem *);
119 void removeItem(QGraphicsLayoutItem *);
121 const QList<QGraphicsItem *> &) const;
122 QString makePrettyToolTip(const QString &);
123
124 private slots:
126 void adjustSceneRect();
127
128 // attributes
129 private:
131 QGraphicsGridLayout *tbgrid_;
132 QGraphicsWidget *form_;
146};
147#endif
Definition helpercell.h:28
Definition splittedhelpercell.h:26
Definition templatecellsset.h:28
Definition templatecommands.h:67
The TitleBlockTemplate class This class represents an title block template for an electric diagram....
Definition titleblocktemplate.h:37
Definition templateview.h:33
void editRow(HelperCell *=nullptr)
Definition templateview.cpp:372
void zoomIn()
Definition templateview.cpp:110
void paste()
Definition templateview.cpp:250
TitleBlockTemplate * tbtemplate_
Definition templateview.h:130
QAction * delete_column_
Definition templateview.h:139
virtual void updateColumnsHelperCells()
Definition templateview.cpp:722
TitleBlockTemplateCellsSet makeCellsSetFromGraphicsItems(const QList< QGraphicsItem * > &) const
TitleBlockTemplateView::makeCellsSetFromGraphicsItems.
Definition templateview.cpp:1131
QList< TitleBlockCell > pastedCells()
Definition templateview.cpp:200
QAction * edit_column_dim_
Definition templateview.h:138
virtual void loadTemplate(TitleBlockTemplate *)
Definition templateview.cpp:910
QGraphicsGridLayout * tbgrid_
Definition templateview.h:131
QString makePrettyToolTip(const QString &)
TitleBlockTemplateView::makePrettyToolTip.
Definition templateview.cpp:1150
void zoomFit()
Definition templateview.cpp:128
TitleBlockTemplateView(const TitleBlockTemplateView &)
void mergeSelectedCells()
Definition templateview.cpp:416
QAction * change_preview_width_
Definition templateview.h:140
void setPreviewWidth(int)
Definition templateview.cpp:1047
SplittedHelperCell * total_width_helper_cell_
Definition templateview.h:134
QList< QAction * > rowsActions() const
Definition templateview.cpp:946
virtual void fillWithEmptyCells()
Definition templateview.cpp:848
~TitleBlockTemplateView() override
Definition templateview.cpp:77
virtual qreal templateHeight() const
Definition templateview.cpp:536
void addRowAfter()
Definition templateview.cpp:333
QList< TitleBlockCell * > copy()
Definition templateview.cpp:165
void wheelEvent(QWheelEvent *) override
Definition templateview.cpp:551
void deleteColumn()
Definition templateview.cpp:396
QList< QAction * > columnsActions() const
Definition templateview.cpp:954
void selectedCellsChanged(QList< TitleBlockCell * >)
void changePreviewWidth()
Definition templateview.cpp:834
void setReadOnly(bool)
Definition templateview.cpp:1031
void zoomReset()
Definition templateview.cpp:137
void deleteRow()
Definition templateview.cpp:406
virtual qreal zoomFactor() const
Definition templateview.cpp:567
int apply_rows_heights_count_
Definition templateview.h:143
void addColumnBefore()
Definition templateview.cpp:297
void editColumn(HelperCell *=nullptr)
Definition templateview.cpp:346
void gridModificationRequested(TitleBlockTemplateCommand *)
void selectionChanged()
Definition templateview.cpp:101
virtual TitleBlockTemplateCellsSet cells(const QRectF &) const
Definition templateview.cpp:470
void setTitleBlockTemplate(TitleBlockTemplate *)
Definition templateview.cpp:85
QGraphicsWidget * form_
Definition templateview.h:132
void refresh()
Definition templateview.cpp:814
virtual qreal templateWidth() const
Definition templateview.cpp:522
QAction * add_column_before_
Definition templateview.h:136
TitleBlockTemplate * titleBlockTemplate() const
Definition templateview.cpp:93
int preview_width_
Definition templateview.h:133
void drawBackground(QPainter *, const QRectF &) override
Definition templateview.cpp:441
QAction * delete_row_
Definition templateview.h:139
void updateDisplayedMinMaxWidth()
Definition templateview.cpp:995
void addRowBefore()
Definition templateview.cpp:309
virtual QSizeF templateSize() const
Definition templateview.cpp:514
virtual void analyzeSelectedCells(bool *, bool *, int *)
TitleBlockTemplateView::analyzeSelectedCells.
Definition templateview.cpp:486
QAction * edit_row_dim_
Definition templateview.h:138
virtual void applyColumnsWidths(bool=true)
Definition templateview.cpp:608
QAction * add_column_after_
Definition templateview.h:137
void updateTotalWidthLabel()
Definition templateview.cpp:1063
void requestGridModification(TitleBlockTemplateCommand *)
Definition templateview.cpp:1080
virtual void applyRowsHeights(bool=true)
Definition templateview.cpp:673
HelperCell * last_context_menu_cell_
Definition templateview.h:141
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 ...
Definition templateview.cpp:886
void addColumnAtEnd()
Definition templateview.cpp:278
bool read_only_
Boolean stating whether this view allows template edition.
Definition templateview.h:145
void addColumnAfter()
Definition templateview.cpp:321
void previewWidthChanged(int, int)
QAction * add_row_after_
Definition templateview.h:137
bool first_activation_
Boolean used to detect the first display of this widget.
Definition templateview.h:144
bool mayPaste()
Definition templateview.cpp:190
virtual void init()
Definition templateview.cpp:575
QList< TitleBlockCell * > cut()
Definition templateview.cpp:148
int apply_columns_widths_count_
Definition templateview.h:142
virtual void addCells()
Definition templateview.cpp:739
void zoomOut()
Definition templateview.cpp:119
void adjustSceneRect()
Definition templateview.cpp:1171
void updateLastContextMenuCell(HelperCell *)
Definition templateview.cpp:1164
QAction * add_row_before_
Definition templateview.h:136
virtual QList< TitleBlockCell * > selectedCells() const
Definition templateview.cpp:452
bool event(QEvent *) override
Definition templateview.cpp:870
void addRowAtEnd()
Definition templateview.cpp:287
virtual void updateRowsHelperCells()
Definition templateview.cpp:706
void removeItem(QGraphicsLayoutItem *)
Definition templateview.cpp:1113
void columnsDimensionsChanged()
Definition templateview.cpp:986
void splitSelectedCell()
Definition templateview.cpp:428
int indexOf(QGraphicsLayoutItem *)
Definition templateview.cpp:1102
void rowsDimensionsChanged()
Definition templateview.cpp:977
void updateLayout()
Definition templateview.cpp:964
virtual TitleBlockTemplateCellsSet selectedCellsSet() const
Definition templateview.cpp:460
int lastContextMenuCellIndex() const
Definition templateview.cpp:1090
HelperCell * extra_cells_width_helper_cell_
Definition templateview.h:135