28 parent_view_(parent_view)
38 parent_view_(copy.parent_view_)
52 QPainterPath cells_path;
54 cells_path.addRect(cell -> geometry());
64 if (!count())
return(
false);
65 if (count() == 1)
return(
true);
67 QPolygonF points =
painterPath().simplified().toFillPolygon();
68 if (points.isClosed()) points.pop_back();
70 return(points.count() == 4 || points.count() == 5);
78 if (!cell -> isSelected()) {
91 QSet<TitleBlockCell *> all_cells =
cells(
true);
95 if (cell -> spanner_cell && !all_cells.contains(cell -> spanner_cell)) {
106 if (empty())
return(
nullptr);
107 if (count() == 1)
return(first());
110 QMultiMap<int, TitleBlockTemplateVisualCell *> top_cells;
113 top_cells.insertMulti(cell -> num_row, cell_view);
116 QList<TitleBlockTemplateVisualCell *> candidates = top_cells.values(top_cells.keys().first());
117 if (candidates.count() == 1)
return(candidates.first());
120 int lowest_num_col = 100000;
124 if (cell -> num_col < lowest_num_col) {
125 lowest_num_col = cell -> num_col;
126 candidate = cell_view;
137 if (empty())
return(
nullptr);
138 if (count() == 1)
return(first());
141 QMultiMap<qreal, TitleBlockTemplateVisualCell *> bottom_cells;
143 bottom_cells.insertMulti(cell_view -> geometry().bottom(), cell_view);
145 QList<TitleBlockTemplateVisualCell *> candidates = bottom_cells.values(bottom_cells.keys().last());
146 if (candidates.count() == 1)
return(candidates.first());
149 qreal highest_right = -100000;
152 qreal right = cell_view -> geometry().right();
153 if (right > highest_right) {
154 highest_right = right;
155 candidate = cell_view;
170 if (!top_left_cell)
return(merge_area);
172 if (!bottom_right_cell)
return(merge_area);
174 merge_area.setTopLeft(top_left_cell -> geometry().topLeft());
175 merge_area.setBottomRight(bottom_right_cell -> geometry().bottomRight());
188 QRectF merge_area_rect = rect.isNull() ?
mergeAreaRect() : rect;
199 QSet<TitleBlockCell *>
set;
202 if (include_spanned) {
virtual ~TitleBlockTemplateCellsSet()
QPainterPath painterPath() const
QRectF mergeAreaRect() const
TitleBlockTemplateCellsSet(const TitleBlockTemplateView *)
TitleBlockTemplateCellsSet mergeArea(const QRectF &=QRectF()) const
QSet< TitleBlockCell * > cells(bool=true) const
const TitleBlockTemplateView * parent_view_
the view displaying the cells
bool allCellsAreSelected() const
TitleBlockTemplateVisualCell * topLeftCell() const
TitleBlockTemplateVisualCell * bottomRightCell() const
bool hasExternalSpan() const