1 /*
2 # PostgreSQL Database Modeler (pgModeler)
3 #
4 # Copyright 2006-2020 - Raphael Araújo e Silva <raphael@pgmodeler.io>
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation version 3.
9 #
10 # This program 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 # The complete text of GPLv3 is at LICENSE file on source code root directory.
16 # Also, you can get the complete GNU General Public License at <http://www.gnu.org/licenses/>
17 */
18 
19 #include "basetableview.h"
20 
21 bool BaseTableView::hide_ext_attribs = false;
22 bool BaseTableView::hide_tags = false;
23 unsigned BaseTableView::attribs_per_page[2] = { 10, 5 };
24 
BaseTableView(BaseTable * base_tab)25 BaseTableView::BaseTableView(BaseTable *base_tab) : BaseObjectView(base_tab)
26 {
27 	if(!base_tab)
28 		throw Exception(ErrorCode::AsgNotAllocattedObject, __PRETTY_FUNCTION__, __FILE__, __LINE__);
29 
30 	pending_geom_update = false;
31 	body=new RoundedRectItem;
32 	body->setRoundedCorners(RoundedRectItem::BottomLeftCorner | RoundedRectItem::BottomRightCorner);
33 
34 	title=new TableTitleView;
35 	title->setZValue(2);
36 
37 	ext_attribs_body=new RoundedRectItem;
38 	ext_attribs_body->setRoundedCorners(RoundedRectItem::NoCorners);
39 
40 	ext_attribs=new QGraphicsItemGroup;
41 	ext_attribs->setZValue(1);
42 	ext_attribs->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
43 
44 	columns=new QGraphicsItemGroup;
45 	columns->setZValue(1);
46 	columns->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
47 
48 	tag_item = new TextPolygonItem;
49 	tag_item->setZValue(3);
50 
51 	obj_shadow=new RoundedRectItem;
52 	obj_shadow->setZValue(-1);
53 
54 	obj_selection=new RoundedRectItem;
55 	obj_selection->setVisible(false);
56 	obj_selection->setZValue(4);
57 
58 	attribs_toggler = new AttributesTogglerItem;
59 	attribs_toggler->setZValue(1);
60 
61 	this->addToGroup(obj_selection);
62 	this->addToGroup(obj_shadow);
63 	this->addToGroup(columns);
64 	this->addToGroup(body);
65 	this->addToGroup(title);
66 	this->addToGroup(tag_item);
67 	this->addToGroup(ext_attribs);
68 	this->addToGroup(ext_attribs_body);
69 	this->addToGroup(attribs_toggler);
70 
71 	this->setAcceptHoverEvents(true);
72 	sel_child_obj_view=nullptr;
73 	configurePlaceholder();
74 
75 	sel_enabler_timer.setInterval(500);
76 
77 	connect(attribs_toggler, SIGNAL(s_collapseModeChanged(CollapseMode)), this, SLOT(configureCollapsedSections(CollapseMode)));
78 	connect(attribs_toggler, SIGNAL(s_paginationToggled(bool)), this, SLOT(togglePagination(bool)));
79 	connect(attribs_toggler, SIGNAL(s_currentPageChanged(unsigned,unsigned)), this, SLOT(configureCurrentPage(unsigned,unsigned)));
80 
81 	connect(&sel_enabler_timer, &QTimer::timeout, [&](){
82 		this->setFlag(QGraphicsItem::ItemIsSelectable, true);
83 	});
84 }
85 
~BaseTableView()86 BaseTableView::~BaseTableView()
87 {
88 	this->removeFromGroup(body);
89 	this->removeFromGroup(title);
90 	this->removeFromGroup(attribs_toggler);
91 	this->removeFromGroup(ext_attribs_body);
92 	this->removeFromGroup(ext_attribs);
93 	this->removeFromGroup(columns);
94 	this->removeFromGroup(tag_item);
95 	delete attribs_toggler;
96 	delete ext_attribs_body;
97 	delete ext_attribs;
98 	delete body;
99 	delete title;
100 	delete columns;
101 	delete tag_item;
102 }
103 
setHideExtAttributes(bool value)104 void BaseTableView::setHideExtAttributes(bool value)
105 {
106 	hide_ext_attribs=value;
107 }
108 
setHideTags(bool value)109 void BaseTableView::setHideTags(bool value)
110 {
111 	hide_tags=value;
112 }
113 
isExtAttributesHidden()114 bool BaseTableView::isExtAttributesHidden()
115 {
116 	return hide_ext_attribs;
117 }
118 
isTagsHidden()119 bool BaseTableView::isTagsHidden()
120 {
121 	return hide_tags;
122 }
123 
itemChange(GraphicsItemChange change,const QVariant & value)124 QVariant BaseTableView::itemChange(GraphicsItemChange change, const QVariant &value)
125 {
126 	if(change==ItemSelectedHasChanged)
127 	{
128 		this->setToolTip(this->table_tooltip);
129 		configureObjectSelection();
130 		attribs_toggler->clearButtonsSelection();
131 	}
132 	else if(change == ItemVisibleHasChanged)
133 	{
134 		if(value.toBool() && pending_geom_update)
135 		{
136 			this->configureObject();
137 			pending_geom_update = false;
138 		}
139 	}
140 	else if(change == ItemZValueHasChanged)
141 	{
142 		BaseTable *tab = dynamic_cast<BaseTable *>(getUnderlyingObject());
143 		tab->setZValue(this->zValue());
144 	}
145 
146 	if(change==ItemPositionHasChanged)
147 		emit s_objectMoved();
148 
149 	BaseObjectView::itemChange(change, value);
150 	return value;
151 }
152 
mousePressEvent(QGraphicsSceneMouseEvent * event)153 void BaseTableView::mousePressEvent(QGraphicsSceneMouseEvent *event)
154 {
155 	//Emit a signal containing the select child object if the user right-click the focused item
156 	if(!this->isSelected() && event->buttons()==Qt::RightButton && sel_child_obj_view)
157 	{
158 		// Avoiding clear selection when the focused child item is amongst the other selected children
159 		if(sel_child_obj_view->getUnderlyingObject() && !sel_child_objs.contains(sel_child_obj_view))
160 		{
161 			// Forcing the selection clearing when we right click an child object that is not selected yet
162 			emit s_sceneClearRequested();
163 			clearChildrenSelection();
164 
165 			/* Deactivate the table in order not to hide the child object selection.
166 				 The table object is reativated when the context menu is hidden */
167 			this->setEnabled(false);
168 			emit s_popupMenuRequested(dynamic_cast<TableObject *>(sel_child_obj_view->getUnderlyingObject()));
169 		}
170 	}
171 	else
172 	{
173 		QPointF pnt = attribs_toggler->mapFromScene(event->scenePos());
174 
175 		//If the user clicks the extended attributes toggler
176 		if(!this->isSelected() && event->buttons()==Qt::LeftButton && event->modifiers() == Qt::NoModifier &&
177 			 attribs_toggler->isVisible() && attribs_toggler->boundingRect().contains(pnt))
178 			attribs_toggler->setButtonSelected(pnt, true);
179 
180 		/* We select children object only if the have a source object (column, constraint, trigger, etc). View references
181 		 * items should not be selected here because they do not have a source object */
182 		if(sel_child_obj_view && sel_child_obj_view->getUnderlyingObject() &&
183 			 event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
184 		{
185 			this->setFlag(QGraphicsItem::ItemIsSelectable, false);
186 			sel_child_obj_view->setFakeSelection(!sel_child_obj_view->hasFakeSelection());
187 
188 			if(!sel_child_obj_view->hasFakeSelection())
189 					sel_child_objs.removeAll(sel_child_obj_view);
190 			else
191 				sel_child_objs.append(sel_child_obj_view);
192 
193 			sel_child_obj_view = nullptr;
194 			event->ignore();
195 			emit s_childrenSelectionChanged();
196 			sel_enabler_timer.start();
197 		}
198 		else if((this->flags() & QGraphicsItem::ItemIsSelectable) == QGraphicsItem::ItemIsSelectable)
199 		{
200 			// Forcing the scene selection clearing when we right click the table itself directly
201 			if(event->buttons() == Qt::RightButton && !this->isSelected())
202 			{
203 				emit s_sceneClearRequested();
204 				this->setSelected(true);
205 			}
206 
207 			clearChildrenSelection();
208 			BaseObjectView::mousePressEvent(event);
209 		}
210 	}
211 }
212 
setAttributesPerPage(unsigned section_id,unsigned value)213 void BaseTableView::setAttributesPerPage(unsigned section_id, unsigned value)
214 {
215 	if(section_id > BaseTable::ExtAttribsSection)
216 		throw Exception(ErrorCode::RefElementInvalidIndex,__PRETTY_FUNCTION__,__FILE__,__LINE__);
217 
218 	if(value > 0)
219 		attribs_per_page[section_id] = value;
220 }
221 
getAttributesPerPage(unsigned section_id)222 unsigned BaseTableView::getAttributesPerPage(unsigned section_id)
223 {
224 	if(section_id > BaseTable::ExtAttribsSection)
225 		throw Exception(ErrorCode::RefElementInvalidIndex,__PRETTY_FUNCTION__,__FILE__,__LINE__);
226 
227 	return attribs_per_page[section_id];
228 }
229 
hoverLeaveEvent(QGraphicsSceneHoverEvent *)230 void BaseTableView::hoverLeaveEvent(QGraphicsSceneHoverEvent *)
231 {
232 	if(!this->isSelected() && obj_selection->isVisible())
233 		obj_selection->setVisible(false);
234 
235 	attribs_toggler->clearButtonsSelection();
236 	sel_child_obj_view=nullptr;
237 }
238 
hoverMoveEvent(QGraphicsSceneHoverEvent * event)239 void BaseTableView::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
240 {
241 	/* Case the table itself is not selected shows the child selector
242 		at mouse position */
243 	if(!this->isSelected())
244 	{
245 		QList<QGraphicsItem *> items;
246 		double cols_height, item_idx, ext_height=0;
247 		QRectF rect, rect1;
248 		QPointF pnt = attribs_toggler->mapFromScene(event->scenePos());
249 
250 		items.append(columns->childItems());
251 
252 		if(!hide_ext_attribs &&
253 			 dynamic_cast<BaseTable *>(this->getUnderlyingObject())->getCollapseMode() == CollapseMode::NotCollapsed)
254 		{
255 			items.append(ext_attribs->childItems());
256 			ext_height=ext_attribs->boundingRect().height();
257 		}
258 
259 		//Calculates the default item height
260 		cols_height=(columns->boundingRect().height() + ext_height + (2*VertSpacing)) / static_cast<double>(items.size());
261 
262 		//Calculates the item index based upon the mouse position
263 		rect=this->mapRectToItem(title, title->boundingRect());
264 		item_idx=(event->pos().y() - rect.bottom()) / cols_height;
265 
266 		if(attribs_toggler->isVisible() && attribs_toggler->boundingRect().contains(pnt))
267 		{
268 			attribs_toggler->setButtonSelected(pnt);
269 		}
270 		//If the index is invalid clears the selection
271 		else if(item_idx < 0 || item_idx >= items.size())
272 		{
273 			this->hoverLeaveEvent(event);
274 			this->setToolTip(this->table_tooltip);
275 		}
276 		else if(!items.isEmpty())
277 		{
278 			TableObjectView *item=dynamic_cast<TableObjectView *>(items[static_cast<int>(item_idx)]);
279 
280 			//Configures the selection with the item's dimension
281 			if(obj_selection->boundingRect().height() != item->boundingRect().height())
282 			{
283 				dynamic_cast<RoundedRectItem *>(obj_selection)->setBorderRadius(2);
284 				dynamic_cast<RoundedRectItem *>(obj_selection)->setRect(QRectF(0, 0,
285 																																			 title->boundingRect().width() - (2.5 * HorizSpacing),
286 																																			 item->boundingRect().height() - VertSpacing));
287 			}
288 
289 			//Sets the selection position as same as item's position
290 			rect1=this->mapRectToItem(item, item->boundingRect());
291 			obj_selection->setVisible(true);
292 			obj_selection->setPos(QPointF(title->pos().x() + HorizSpacing, -rect1.top() + VertSpacing/2));
293 
294 			//Stores the selected child object
295 			sel_child_obj_view = item;
296 			this->setToolTip(item->toolTip());
297 		}
298 	}
299 }
300 
addConnectedRelationship(BaseRelationship * base_rel)301 void BaseTableView::addConnectedRelationship(BaseRelationship *base_rel)
302 {
303 	BaseTable *tab = dynamic_cast<BaseTable *>(getUnderlyingObject());
304 
305 	if(!base_rel ||
306 		 (base_rel &&
307 			base_rel->getTable(BaseRelationship::SrcTable) != tab &&
308 			base_rel->getTable(BaseRelationship::DstTable) != tab))
309 		return;
310 
311 	connected_rels.push_back(base_rel);
312 }
313 
removeConnectedRelationship(BaseRelationship * base_rel)314 void BaseTableView::removeConnectedRelationship(BaseRelationship *base_rel)
315 {
316 	connected_rels.erase(std::find(connected_rels.begin(), connected_rels.end(), base_rel));
317 }
318 
getConnectedRelationshipIndex(BaseRelationship * base_rel,bool only_self_rels)319 int BaseTableView::getConnectedRelationshipIndex(BaseRelationship *base_rel, bool only_self_rels)
320 {
321 	vector<BaseRelationship *>::iterator itr;
322 	vector<BaseRelationship *> self_rels, *vet_rels = nullptr;
323 
324 	if(!only_self_rels)
325 		vet_rels = &connected_rels;
326 	else
327 	{
328 		for(auto &rel : connected_rels)
329 		{
330 			if(rel->isSelfRelationship())
331 				self_rels.push_back(rel);
332 		}
333 
334 		vet_rels = &self_rels;
335 	}
336 
337 	itr = std::find(vet_rels->begin(), vet_rels->end(), base_rel);
338 
339 	if(itr != vet_rels->end())
340 		return itr - vet_rels->begin();
341 
342 	return -1;
343 }
344 
getConnectedRelsCount(BaseTable * src_tab,BaseTable * dst_tab)345 unsigned BaseTableView::getConnectedRelsCount(BaseTable *src_tab, BaseTable *dst_tab)
346 {
347 	unsigned count = 0;
348 
349 	for(auto &rel : connected_rels)
350 	{
351 		if((rel->getTable(BaseRelationship::SrcTable) == src_tab &&
352 				rel->getTable(BaseRelationship::DstTable) == dst_tab) ||
353 			 (rel->getTable(BaseRelationship::SrcTable) == dst_tab &&
354 				rel->getTable(BaseRelationship::DstTable) == src_tab))
355 			count++;
356 	}
357 
358 	return count;
359 }
360 
configureTag()361 void BaseTableView::configureTag()
362 {
363 	BaseTable *tab=dynamic_cast<BaseTable *>(this->getUnderlyingObject());
364 	Tag *tag=tab->getTag();
365 
366 	tag_item->setVisible(tag!=nullptr && !hide_tags);
367 
368 	if(!hide_tags && tag)
369 	{
370 		QPolygonF pol;
371 		QPointF p1, p2;
372 		double bottom;
373 		QFont fnt=BaseObjectView::getFontStyle(Attributes::Tag).font();
374 
375 		fnt.setPointSizeF(fnt.pointSizeF() * 0.80);
376 		tag_item->setFont(fnt);
377 		tag_item->setText(tag->getName());
378 		tag_item->setBrush(BaseObjectView::getFontStyle(Attributes::Tag).foreground());
379 
380 		p1=tag_item->getTextBoundingRect().topLeft();
381 		p2=tag_item->getTextBoundingRect().bottomRight();
382 		bottom=this->boundingRect().bottom();
383 
384 		pol.append(QPointF(p1.x()- HorizSpacing, p1.y() - VertSpacing));
385 		pol.append(QPointF(p2.x(), p1.y() - VertSpacing));
386 		pol.append(QPointF(p2.x() + HorizSpacing + 5, p2.y()/2));
387 		pol.append(QPointF(p2.x(), p2.y() + VertSpacing));
388 		pol.append(QPointF(p1.x(), p2.y() + VertSpacing));
389 		pol.append(QPointF(p1.x()-HorizSpacing, p2.y() + VertSpacing));
390 
391 		tag_item->setPolygon(pol);
392 		tag_item->setPen(BaseObjectView::getBorderStyle(Attributes::Tag));
393 		tag_item->setBrush(BaseObjectView::getFillStyle(Attributes::Tag));
394 		tag_item->setPos(-5, bottom - 1.5);
395 		tag_item->setTextPos(HorizSpacing/2, 0);
396 	}
397 }
398 
__configureObject(double width)399 void BaseTableView::__configureObject(double width)
400 {
401 	BaseTable *tab = dynamic_cast<BaseTable *>(getUnderlyingObject());
402 	double height = 0,
403 			factor = qApp->screens().at(qApp->desktop()->screenNumber(qApp->activeWindow()))->logicalDotsPerInch() / 96.0,
404 			pixel_ratio = qApp->screens().at(qApp->desktop()->screenNumber(qApp->activeWindow()))->devicePixelRatio();
405 
406 	QPen pen = body->pen();
407 	attribs_toggler->setBrush(body->brush());
408 	attribs_toggler->setPen(body->pen());
409 
410 	QLinearGradient grad(QPointF(0,0),QPointF(0,1));
411 	grad.setCoordinateMode(QGradient::ObjectBoundingMode);
412 	grad.setColorAt(0, body->pen().color().lighter(200));
413 	grad.setColorAt(1, body->pen().color().lighter());
414 	pen.setStyle(Qt::SolidLine);
415 
416 	attribs_toggler->setButtonsBrush(grad);
417 	attribs_toggler->setButtonsPen(body->pen());
418 	attribs_toggler->setRect(QRectF(0, 0, width, 12 * factor * pixel_ratio));
419 	attribs_toggler->setCollapseMode(tab->getCollapseMode());
420 
421 	//Set the protected icon position to the top-right on the title
422 	protected_icon->setPos(title->pos().x() + (2 * HorizSpacing), title->boundingRect().height() * 0.25);
423 	this->bounding_rect = title->boundingRect();
424 
425 	body->setRoundedCorners(RoundedRectItem::NoCorners);
426 
427 	height = title->boundingRect().height() + attribs_toggler->boundingRect().height() - VertSpacing;
428 	height += (body->isVisible() ? body->boundingRect().height() : 1);
429 	height += (ext_attribs_body->isVisible() ? ext_attribs_body->boundingRect().height() - VertSpacing + 1 : 0);
430 
431 	this->bounding_rect.setHeight(height);
432 
433 	attribs_toggler->setPos(title->pos().x(),
434 													height - attribs_toggler->boundingRect().height());
435 
436 	this->table_tooltip=this->getUnderlyingObject()->getName(true) +
437 						QString(" (") + this->getUnderlyingObject()->getTypeName() + QString(") \n") +
438 						QString("Id: %1\n").arg(this->getUnderlyingObject()->getObjectId()) +
439 						tr("Connected rels: %1").arg(this->getConnectRelsCount());
440 
441 	this->setToolTip(this->table_tooltip);
442 	this->setZValue(tab->getZValue());
443 
444 	configureObjectSelection();
445 	configureObjectShadow();
446 }
447 
calculateWidth()448 double BaseTableView::calculateWidth()
449 {
450 	/* Calculating the maximum width between the title, columns, extended attributes and the attribs toggler.
451 	 * This width is used to set the uniform width of table */
452 	vector<double> widths = { columns->isVisible() ? columns->boundingRect().width() : 0,
453 														ext_attribs->isVisible() ? ext_attribs->boundingRect().width() : 0,
454 														attribs_toggler->isVisible() ? attribs_toggler->getButtonsWidth() : 0,
455 														title->boundingRect().width() };
456 
457 	std::sort(widths.begin(), widths.end());
458 	return widths.back() + (2 * HorizSpacing);
459 }
460 
getConnectRelsCount()461 int BaseTableView::getConnectRelsCount()
462 {
463 	return connected_rels.size();
464 }
465 
requestRelationshipsUpdate()466 void BaseTableView::requestRelationshipsUpdate()
467 {
468 	emit s_relUpdateRequest();
469 }
470 
togglePlaceholder(bool value)471 void BaseTableView::togglePlaceholder(bool value)
472 {
473 	BaseObjectView::togglePlaceholder(!connected_rels.empty() && value);
474 }
475 
configureObjectShadow()476 void BaseTableView::configureObjectShadow()
477 {
478 	RoundedRectItem *rect_item=dynamic_cast<RoundedRectItem *>(obj_shadow);
479 
480 	rect_item->setPen(Qt::NoPen);
481 	rect_item->setBrush(QColor(50,50,50,60));
482 	rect_item->setRect(this->boundingRect());
483 	rect_item->setPos(3.5, 4.5);
484 }
485 
getSelectedChidren()486 QList<TableObjectView *> BaseTableView::getSelectedChidren()
487 {
488 	return sel_child_objs;
489 }
490 
clearChildrenSelection()491 void BaseTableView::clearChildrenSelection()
492 {
493 	if(sel_child_objs.isEmpty())
494 		return;
495 
496 	for(auto &tab_obj : sel_child_objs)
497 		tab_obj->setFakeSelection(false);
498 
499 	sel_child_objs.clear();
500 	emit s_childrenSelectionChanged();
501 }
502 
startGeometryUpdate()503 void BaseTableView::startGeometryUpdate()
504 {
505 	//We need to force the object to be not selectable so further calls to mousePressEvent doesn't select the object
506 	this->setFlag(QGraphicsItem::ItemIsSelectable, false);
507 }
508 
finishGeometryUpdate()509 void BaseTableView::finishGeometryUpdate()
510 {
511 	//Updating the object's geometry to reflect the geometry change
512 	this->configureObject();
513 	obj_selection->setVisible(false);
514 
515 	// Using a single shot time to restore the selectable flag
516 	QTimer::singleShot(300, [&]{ this->setFlag(QGraphicsItem::ItemIsSelectable, true); });
517 
518 	//Updating the schema box that holds the object (if visible)
519 	dynamic_cast<Schema *>(this->getUnderlyingObject()->getSchema())->setModified(true);
520 }
521 
configurePaginationParams(unsigned section_id,unsigned total_attrs,unsigned & start_attr,unsigned & end_attr)522 bool BaseTableView::configurePaginationParams(unsigned section_id, unsigned total_attrs, unsigned &start_attr, unsigned &end_attr)
523 {
524 	if(section_id > BaseTable::ExtAttribsSection)
525 		return false;
526 
527 	BaseTable *table = dynamic_cast<BaseTable *>(getUnderlyingObject());
528 	unsigned attr_per_page = attribs_per_page[section_id];
529 
530 	start_attr = end_attr = 0;
531 	attribs_toggler->setPaginationEnabled(table->isPaginationEnabled());
532 
533 	/* If the pagination is enabled for the table and the amount of objects is greater than the
534 	 * number of objects per page we configure the pagination parameter */
535 	if(table->isPaginationEnabled() && total_attrs > attr_per_page)
536 	{
537 		// Calculating the proportions of columns and extended attributes displayed per page
538 		unsigned max_pages = 0, curr_page = table->getCurrentPage(section_id);
539 
540 		// Determining the maximum amount of pages
541 		max_pages = ceil(total_attrs / static_cast<double>(attr_per_page));
542 
543 		// Validating the current page related to the maximum determined
544 		if(curr_page >= max_pages)
545 			curr_page = max_pages - 1;
546 
547 		// Calculating the start and end columns/ext. attributes for the current page
548 		start_attr = curr_page * attr_per_page;
549 		end_attr = start_attr + attr_per_page;
550 
551 		// Validating the determined start/end indexes avoiding the extrapolation of limits
552 		if(start_attr > total_attrs)
553 			start_attr = total_attrs;
554 
555 		if(end_attr > total_attrs)
556 			end_attr = total_attrs;
557 
558 		// Configure the attributes toggler item withe the calculated pagination parameters
559 		attribs_toggler->setPaginationValues(section_id, curr_page, max_pages);
560 		return true;
561 	}
562 	else
563 	{
564 		attribs_toggler->setPaginationValues(section_id, 0, 0);
565 		return false;
566 	}
567 }
568 
configureCollapsedSections(CollapseMode coll_mode)569 void BaseTableView::configureCollapsedSections(CollapseMode coll_mode)
570 {
571 	startGeometryUpdate();
572 	dynamic_cast<BaseTable *>(this->getUnderlyingObject())->setCollapseMode(coll_mode);
573 	finishGeometryUpdate();
574 	emit s_collapseModeChanged();
575 }
576 
togglePagination(bool enabled)577 void BaseTableView::togglePagination(bool enabled)
578 {
579 	BaseTable *tab = dynamic_cast<BaseTable *>(this->getUnderlyingObject());
580 
581 	startGeometryUpdate();
582 	tab->setPaginationEnabled(enabled);
583 	tab->resetCurrentPages();
584 	finishGeometryUpdate();
585 	emit s_paginationToggled();
586 }
587 
configureCurrentPage(unsigned section_id,unsigned page)588 void BaseTableView::configureCurrentPage(unsigned section_id, unsigned page)
589 {
590 	startGeometryUpdate();
591 	dynamic_cast<BaseTable *>(this->getUnderlyingObject())->setCurrentPage(section_id, page);
592 	finishGeometryUpdate();
593 	emit s_currentPageChanged();
594 }
595