9#include "TableViewContent.h"
15#include <QApplication>
30#include "ControlMeasure.h"
31#include "IException.h"
34#include "AbstractTableDelegate.h"
35#include "AbstractTableModel.h"
36#include "AbstractTreeItem.h"
37#include "TableColumn.h"
38#include "TableColumnList.h"
39#include <ControlPoint.h>
52 connect(m_model, SIGNAL(modelModified()),
this, SLOT(
refresh()));
53 connect(m_model, SIGNAL(filterProgressChanged(
int)),
55 connect(
this, SIGNAL(modelDataChanged()),
56 m_model, SLOT(applyFilter()));
64 m_columns =
getModel()->getColumns();
65 for (
int i = 0; i < m_columns->size(); i++) {
68 connect(column, SIGNAL(visibilityChanged()),
this, SLOT(
refresh()));
69 connect(column, SIGNAL(visibilityChanged()),
71 connect(column, SIGNAL(widthChanged()),
this, SLOT(
refresh()));
75 m_activeCell =
new QPair<AbstractTreeItem *, int>(NULL, -1);
78 m_lastShiftArrowSelectedCell =
new QPair< AbstractTreeItem *, int >;
79 m_lastShiftArrowSelectedCell->first = NULL;
81 verticalScrollBar()->setSingleStep(1);
83 m_rowHeight = QFontMetrics(font()).height() + ITEM_PADDING;
85 connect(horizontalScrollBar(), SIGNAL(valueChanged(
int)),
86 this, SIGNAL(horizontalScrollBarValueChanged(
int)));
88 setMouseTracking(
true);
93 setContextMenuPolicy(Qt::CustomContextMenu);
94 connect(
this, SIGNAL(customContextMenuRequested(QPoint)),
97 m_activeControlNet =
false;
114 delete m_lastShiftSelection;
115 m_lastShiftSelection = NULL;
129 delete m_lastShiftArrowSelectedCell;
130 m_lastShiftArrowSelectedCell = NULL;
142 return QWidget::minimumSizeHint();
212 m_activeControlNet = activeNet;
221 if (!m_model->isFiltering()) {
222 int rowCount = m_model->getVisibleRowCount();
223 verticalScrollBar()->setRange(0, qMax(rowCount - 1, 0));
228 m_lastShiftSelection->clear();
230 if (m_model->getSelectedItems().size() &&
236 viewport()->update();
250 for (
int i = 0; i < visibleCols.size(); i++)
251 range += visibleCols[i]->getWidth() - 1;
255 horizontalScrollBar()->setRange(0, range - viewport()->width());
256 horizontalScrollBar()->setPageStep(viewport()->width());
259 horizontalScrollBar()->setValue(horizontalScrollBar()->maximum());
271 if (newlySelectedItems.size())
272 scrollTo(newlySelectedItems.last());
282 int row =
getModel()->indexOfVisibleItem(newlySelectedItem);
285 int topRow = verticalScrollBar()->value();
288 verticalScrollBar()->setValue(row);
291 int wholeVisibleRowCount = viewport()->height() / m_rowHeight;
292 int bottomRow = topRow + wholeVisibleRowCount;
294 verticalScrollBar()->setValue(row - wholeVisibleRowCount + 1);
298 viewport()->update();
311 return QObject::eventFilter(target, event);
321 if (event->buttons() & Qt::LeftButton) {
322 int rowNum =
event->pos().y() / m_rowHeight;
324 if (m_activeCell->first &&
cellIsEditable(rowNum, m_activeCell->second)) {
327 m_columns->getVisibleColumns()[m_activeCell->second];
331 m_editWidget = delegate->getWidget(col);
332 delegate->readData(m_editWidget, m_activeCell->first, col);
333 m_editWidget->setParent(
this);
334 m_editWidget->setFocus(Qt::OtherFocusReason);
337 viewport()->update();
349 if (event->buttons() & Qt::LeftButton) {
351 if (!(event->modifiers() & Qt::ShiftModifier))
354 int rowNum =
event->pos().y() / m_rowHeight;
364 if (rowNum >= 0 && rowNum < m_items->size() && m_activeCell->first) {
369 m_model->setGlobalSelection(
false);
372 if (event->modifiers() & Qt::ControlModifier) {
379 m_lastShiftSelection->clear();
382 if (event->modifiers() & Qt::ShiftModifier) {
390 m_lastShiftSelection->clear();
397 if (rowNum >= 0 && rowNum < m_items->size()) {
400 if (columnNum != -1) {
401 TableColumn *column = m_columns->getVisibleColumns()[columnNum];
402 if (column->getTitle().isEmpty()) {
408 if (event->modifiers() & Qt::ControlModifier) {
409 if (item->getPointerType() == AbstractTreeItem::Measure)
410 item->parent()->setSelected(!item->isSelected());
412 item->setSelected(!item->isSelected());
414 newlySelectedItems.append(item);
417 if (event->modifiers() & Qt::ShiftModifier) {
422 m_model->getSelectedItems();
425 if (selectedItem->getPointerType() ==
426 AbstractTreeItem::Measure)
427 selectedItem->parent()->setSelected(
false);
430 m_model->setGlobalSelection(
false);
432 if (item->getPointerType() == AbstractTreeItem::Measure)
433 item->parent()->setSelected(
true);
435 item->setSelected(
true);
437 newlySelectedItems.append(item);
442 newlySelectedItems.clear();
444 newlySelectedItems.append(i);
445 if (i->getPointerType() == AbstractTreeItem::Point) {
447 child->setSelected(
true);
448 newlySelectedItems.append(child);
453 emit tableSelectionChanged(newlySelectedItems);
462 viewport()->update();
463 emit tableSelectionChanged();
484 if (event->buttons() & Qt::LeftButton) {
485 int rowNum =
event->pos().y() / m_rowHeight;
488 int yPos =
event->pos().y();
489 if (yPos >= 0 && rowNum < m_items->size() && m_activeCell->first) {
498 if (yPos >= 0 && rowNum < m_items->size()) {
503 if (columnNum != -1) {
510 newlySelectedItems.append(i);
511 if (i->getPointerType() == AbstractTreeItem::Point) {
513 child->setSelected(
true);
514 newlySelectedItems.append(child);
519 emit tableSelectionChanged(newlySelectedItems);
524 QScrollBar *vertScroll = verticalScrollBar();
526 if (yPos > viewport()->height() &&
527 vertScroll->value() < vertScroll->maximum()) {
529 vertScroll->setValue(vertScroll->value() + 1);
532 if (yPos < 0 && vertScroll->value() > vertScroll->minimum())
533 vertScroll->setValue(vertScroll->value() - 1);
536 viewport()->update();
537 emit tableSelectionChanged();
559 Qt::Key key = (Qt::Key) event->key();
562 if (key == Qt::Key_A && event->modifiers() == Qt::ControlModifier) {
565 m_model->setGlobalSelection(
true);
566 viewport()->update();
568 emit tableSelectionChanged();
572 else if (key == Qt::Key_Escape) {
576 setFocus(Qt::ActiveWindowFocusReason);
577 viewport()->update();
582 else if (key == Qt::Key_Delete) {
588 else if (key == Qt::Key_Return || key == Qt::Key_Enter) {
594 else if (key == Qt::Key_Tab) {
600 else if (key == Qt::Key_Up || key == Qt::Key_Down ||
601 key == Qt::Key_Left || key == Qt::Key_Right) {
603 if (m_items && m_items->size()) {
604 m_activeCell->first = (*m_items)[0];
605 m_activeCell->second = 1;
612 if (key == Qt::Key_Up && event->modifiers() == Qt::ShiftModifier) {
615 m_lastShiftArrowSelectedCell->first : m_activeCell->first;
617 int prevCellIndex =
getModel()->indexOfVisibleItem(prevCell);
619 if (prevCellIndex > 0) {
621 getModel()->getItems(prevCellIndex - 1, prevCellIndex);
623 if (itemList.size()) {
627 curItem == m_activeCell->first)
632 if (curItem == m_activeCell->first)
633 m_lastShiftArrowSelectedCell->first = NULL;
635 m_lastShiftArrowSelectedCell->first = curItem;
636 m_lastShiftArrowSelectedCell->second = m_activeCell->second;
639 int m_itemsPrevIndex = m_items->indexOf(prevCell);
640 int m_itemsCurIndex = m_items->indexOf(curItem);
641 if (m_itemsCurIndex == -1) {
642 if (m_itemsPrevIndex == 0) {
643 verticalScrollBar()->setValue(qMax(0, prevCellIndex - 1));
651 viewport()->update();
657 else if (key == Qt::Key_Down && event->modifiers() == Qt::ShiftModifier) {
659 m_lastShiftArrowSelectedCell->first : m_activeCell->first;
661 int prevCellIndex =
getModel()->indexOfVisibleItem(prevCell);
663 if (prevCellIndex >= 0 &&
664 prevCellIndex <
getModel()->getVisibleRowCount() - 1) {
666 getModel()->getItems(prevCellIndex + 1, prevCellIndex + 2);
668 if (itemList.size()) {
672 curItem == m_activeCell->first)
677 if (curItem == m_activeCell->first)
678 m_lastShiftArrowSelectedCell->first = NULL;
680 m_lastShiftArrowSelectedCell->first = curItem;
681 m_lastShiftArrowSelectedCell->second = m_activeCell->second;
682 viewport()->update();
685 int m_itemsPrevIndex = m_items->indexOf(prevCell);
686 int m_itemsCurIndex = m_items->indexOf(curItem);
687 if (m_itemsCurIndex == -1) {
688 if (m_itemsPrevIndex == m_items->size() - 1) {
689 int visibleItemCount =
getModel()->getVisibleRowCount();
690 verticalScrollBar()->setValue(qMin(visibleItemCount,
691 getModel()->indexOfVisibleItem(m_items->at(1))));
703 else if (key == Qt::Key_Up) {
708 else if (key == Qt::Key_Down) {
713 else if (key == Qt::Key_Left) {
718 else if (key == Qt::Key_Right) {
728 if (!m_items->contains(m_activeCell->first))
731 if (m_items->contains(m_activeCell->first) &&
733 m_activeCell->second)) {
736 m_columns->getVisibleColumns()[m_activeCell->second];
740 m_editWidget = delegate->getWidget(col);
741 delegate->readData(m_editWidget, m_activeCell->first, col, event->text());
742 m_editWidget->setParent(
this);
743 m_editWidget->setFocus(Qt::OtherFocusReason);
746 viewport()->update();
758 m_columns->getVisibleColumns()[m_activeCell->second];
759 getModel()->getDelegate()->saveData(
760 m_editWidget, m_activeCell->first, col);
765 setFocus(Qt::ActiveWindowFocusReason);
774 int activeIndex = m_items->indexOf(m_activeCell->first);
775 if (activeIndex != -1) {
776 if (activeIndex == 0) {
777 int row = qMax(0,
getModel()->indexOfVisibleItem(
778 m_activeCell->first) - 1);
780 verticalScrollBar()->setValue(row);
783 m_activeCell->first = (*m_items)[qMax(0, activeIndex - 1)];
785 viewport()->update();
794 int activeIndex = m_items->indexOf(m_activeCell->first);
795 if (activeIndex != -1) {
796 if (activeIndex == m_items->size() - 1) {
797 int row = qMin(
getModel()->getVisibleRowCount() - 1,
798 getModel()->indexOfVisibleItem(m_items->at(0)));
800 verticalScrollBar()->setValue(row + 1);
801 activeIndex = m_items->indexOf(m_activeCell->first);
804 m_activeCell->first = (*m_items)[qMin(activeIndex + 1, m_items->size() - 1)];
806 viewport()->update();
815 m_activeCell->second = qMax(1, m_activeCell->second - 1);
817 if (leftMostVisibleCol == m_activeCell->second) {
818 horizontalScrollBar()->setValue(horizontalScrollBar()->value() -
819 m_columns->getVisibleColumns()[m_activeCell->second]->getWidth());
823 viewport()->update();
831 m_activeCell->second = qMin(m_columns->getVisibleColumns().size() - 1,
832 m_activeCell->second + 1);
834 if (rightMostVisibleCol == m_activeCell->second) {
835 horizontalScrollBar()->setValue(horizontalScrollBar()->value() +
836 m_columns->getVisibleColumns()[m_activeCell->second]->getWidth());
840 viewport()->update();
850 if (m_model && m_columns) {
852 int rowCount = (int) ceil(viewport()->height() / (
double) m_rowHeight);
854 QPainter painter(viewport());
855 painter.setRenderHint(QPainter::Antialiasing,
false);
858 bool editWidgetVisible =
false;
859 for (
int i = 0; i < rowCount; i++) {
861 QPoint relativeTopLeft(0, i * m_rowHeight);
862 QPoint scrollBarPos(horizontalScrollBar()->value(),
863 verticalScrollBar()->value());
864 QPoint absoluteTopLeft(relativeTopLeft + scrollBarPos);
865 QSize rowSize(viewport()->width(), (
int) m_rowHeight);
868 painter.fillRect(QRect(relativeTopLeft, rowSize), palette().base());
870 if (i < m_items->size()) {
910 if (m_items->at(i)->isSelected()) {
911 QPoint selectionTopLeft(-absoluteTopLeft.x(), relativeTopLeft.y());
912 QSize selectionSize(m_columns->getVisibleWidth(), (
int) m_rowHeight);
914 QRect selectionRect(selectionTopLeft, selectionSize);
915 painter.fillRect(selectionRect, palette().highlight().color());
918 paintRow(&painter, i, absoluteTopLeft, relativeTopLeft);
922 for (
int i = 0; i < rowCount; i++) {
923 if (i < m_items->size()) {
924 QPoint relativeTopLeft(0, i * m_rowHeight);
925 if (m_editWidget && m_activeCell->first == m_items->at(i)) {
926 QPair<int, int> xRange(
927 m_columns->getVisibleXRange(m_activeCell->second));
930 QPoint(xRange.first - horizontalScrollBar()->value() - 1,
931 relativeTopLeft.y() + 1));
932 m_editWidget->resize(xRange.second - xRange.first, m_rowHeight + 1);
933 m_editWidget->setVisible(
true);
934 editWidgetVisible =
true;
937 if (m_activeCell->first == m_items->at(i)) {
938 QPair<int, int> activeXArea =
939 m_columns->getVisibleXRange(m_activeCell->second);
941 QRect activeArea(activeXArea.first, relativeTopLeft.y(),
942 activeXArea.second - activeXArea.first, m_rowHeight);
945 activeArea.left() - horizontalScrollBar()->value());
946 activeArea.adjust(-1, -1, -2, -1);
950 painter.drawRect(activeArea);
956 if (m_editWidget && !editWidgetVisible)
957 m_editWidget->setVisible(
false);
960 QWidget::paintEvent(event);
971 QAbstractScrollArea::resizeEvent(event);
984 QAbstractScrollArea::scrollContentsBy(dx, dy);
997 m_lastShiftArrowSelectedCell = NULL;
1000 m_lastShiftSelection = NULL;
1016 if (col->hasNetworkStructureEffect())
1019 emit modelDataChanged();
1027 m_activeCell->first = NULL;
1028 m_activeCell->second = -1;
1036 m_lastShiftArrowSelectedCell->first = NULL;
1048 TableColumn *col = m_columns->getVisibleColumns()[m_activeCell->second];
1050 QString colTitle = col->getTitle();
1054 QString cellData = m_activeCell->first->getFormattedData(colTitle);
1059 bool needsDialog =
true;
1061 for (
int i = 0; !done && i < selection.size(); i++) {
1063 bool changeData =
true;
1065 QString warningText =
1066 m_model->getWarningMessage(row, col, cellData);
1067 if (needsDialog && warningText.size()) {
1068 QMessageBox::StandardButton status = QMessageBox::warning(
1069 this,
"Change cells?", warningText, QMessageBox::Yes |
1070 QMessageBox::No | QMessageBox::YesToAll | QMessageBox::NoToAll);
1073 case QMessageBox::YesToAll:
1074 needsDialog =
false;
1076 case QMessageBox::NoToAll:
1078 case QMessageBox::No:
1086 row->setData(colTitle, cellData);
1089 viewport()->update();
1106 m_applyToAllAct->setStatusTip(tr(
"Copy the contents of this cell to all"
1107 "cells in the current column"));
1113 tr(
"Delete the currently selected rows"));
1119 tr(
"Edit the selected control point or the parent control point of control measure"));
1134 for (
int i = 0; i < m_columns->getVisibleColumns().size(); i++) {
1135 QPair<int, int> cellXRange(m_columns->getVisibleXRange(i));
1136 int deltaX = -horizontalScrollBar()->value();
1138 if (cellXRange.first + deltaX < screenX &&
1139 cellXRange.second + deltaX > screenX) {
1156 int calculatedRowNum = screenY / m_rowHeight;
1158 if (calculatedRowNum >= 0 && calculatedRowNum < m_items->size() &&
1159 screenY >= 0 && screenY <= viewport()->height())
1160 return calculatedRowNum;
1172 return (m_activeCell->first && m_activeCell->second >= 0);
1182 return (m_model->getSelectedItems().size());
1198 m_activeCell->second == colNum);
1212 return (m_model->getSelectedItems().contains(row));
1226 if (rowNum >= 0 && rowNum < m_items->size())
1243 if (colNum >= 0 && colNum < m_columns->getVisibleColumns().size())
1260 bool editable =
false;
1262 QString colName = m_columns->getVisibleColumns()[colNum]->getTitle();
1263 if (m_items->at(rowNum)->isSelectable() &&
1264 m_items->at(rowNum)->isDataEditable(colName) &&
1265 !m_columns->getVisibleColumns()[colNum]->isReadOnly())
1281 return m_columns->getVisibleColumns()[colNum]->getTitle().size();
1294 QPoint absolutePosition, QPoint relativePosition) {
1296 QPoint point(-absolutePosition.x(), relativePosition.y());
1302 QPen originalPen = painter->pen();
1304 QPoint textPoint(point.x() + ITEM_INDENTATION,
1305 point.y() + ITEM_PADDING / 2);
1308 int textHeight = m_rowHeight - ITEM_PADDING;
1310 QFontMetrics metrics(font());
1312 QPen gridPen(Qt::gray);
1315 for (
int i = 0; i < visibleCols.size(); i++) {
1318 QRect cellRect(cellXRange.first, point.y(),
1319 cellXRange.second - cellXRange.first, m_rowHeight);
1320 cellRect.moveLeft(cellRect.left() - horizontalScrollBar()->value() - 1);
1322 QString columnTitle = visibleCols[i]->getTitle();
1323 QRect textRect(textPoint, QSize(cellRect.right() - textPoint.x(),
1326 bool textCentered =
false;
1327 if (!columnTitle.isEmpty()) {
1328 text = item->getFormattedData(columnTitle);
1331 m_activeCell->second == i) {
1333 if (m_activeCell->first != item) {
1334 painter->fillRect(cellRect,
1335 QBrush(palette().highlight().color()));
1336 painter->setPen(palette().highlightedText().color());
1339 painter->setPen(palette().text().color());
1343 if (item->isSelected()) {
1344 painter->setPen(palette().highlightedText().color());
1357 painter->setPen(palette().color(QPalette::Disabled,
1361 painter->setPen(palette().text().color());
1368 text = QString::number(rowNum + verticalScrollBar()->value() + 1);
1369 textCentered =
true;
1372 int x = cellRect.center().x();
1373 QLinearGradient gradient(x, cellRect.top(), x, cellRect.bottom());
1375 bool selected = item->isSelected();
1376 QColor color = selected ? palette().highlight().color() :
1377 palette().button().color();
1379 int adjustment = 110;
1380 gradient.setColorAt(0, color.lighter(adjustment));
1381 gradient.setColorAt(1, color.darker(adjustment));
1382 painter->fillRect(cellRect, gradient);
1384 painter->setPen(palette().highlightedText().color());
1386 painter->setPen(palette().text().color());
1389 int flags = Qt::TextDontClip;
1391 flags |= Qt::AlignCenter;
1395 QFont normalFont = painter->font();
1397 if (item->getPointerType() == AbstractTreeItem::Measure) {
1399 if (cm && cm->Parent() && cm->Parent()->
GetRefMeasure() == cm) {
1400 QFont boldFont(normalFont);
1401 boldFont.setBold(
true);
1402 painter->setFont(boldFont);
1406 painter->drawText(textRect, flags,
1407 metrics.elidedText(text, Qt::ElideRight,
1408 textRect.width() - ITEM_INDENTATION));
1409 painter->setFont(normalFont);
1411 textPoint.setX(cellRect.right() + ITEM_INDENTATION);
1412 painter->setPen(originalPen);
1414 painter->setPen(gridPen);
1415 painter->drawLine(QPoint(cellRect.right(), point.y()),
1416 QPoint(cellRect.right(), point.y() + m_rowHeight));
1417 painter->setPen(originalPen);
1420 int left = -horizontalScrollBar()->value() - 1;
1421 int right = m_columns->getVisibleWidth();
1423 gridPen.setWidth(2);
1424 painter->setPen(gridPen);
1425 painter->drawLine(QPoint(left, point.y() + m_rowHeight),
1426 QPoint(right, point.y() + m_rowHeight));
1427 painter->setPen(originalPen);
1438 if (m_editWidget && m_activeCell->first && m_activeCell->second >= 0) {
1441 m_columns->getVisibleColumns()[m_activeCell->second];
1442 m_model->getDelegate()->saveData(m_editWidget, m_activeCell->first,
1447 catch (IException &e) {
1448 QMessageBox::critical(
this,
"Failed to Set Data", e.what());
1453 int oldActiveColumn = m_activeCell->second;
1461 for (
int i = 0; i < visibleCols.size(); i++) {
1462 QPair<int, int> cellXRange(m_columns->getVisibleXRange(i));
1463 QRect cellRect(cellXRange.first, m_rowHeight * rowNum,
1464 cellXRange.second - cellXRange.first, m_rowHeight);
1466 cellRect.moveLeft(cellRect.left() - horizontalScrollBar()->value());
1468 if (cellRect.contains(screenPos) &&
1469 (oldActiveColumn != -1 || !visibleCols[i]->getTitle().isEmpty())) {
1470 m_activeCell->first = item;
1471 m_activeCell->second = i;
1476 if (oldActiveColumn != m_activeCell->second) {
1499 *m_lastShiftSelection = m_model->getItems(
1503 m_lastShiftSelection->clear();
1522 if (row->getPointerType() == AbstractTreeItem::Point) {
1524 child->setSelected(
false);
1527 if (row->getPointerType() == AbstractTreeItem::Measure)
1528 row->parent()->setSelected(
false);
1530 row->setSelected(
false);
1534 *m_lastShiftSelection = m_model->getItems(
1538 m_lastShiftSelection->clear();
1543 row->setSelected(
true);
1545 if (row->getPointerType() == AbstractTreeItem::Measure)
1546 row->parent()->setSelected(
true);
1548 newlySelectedItems.append(row);
1551 return newlySelectedItems;
1580 QMessageBox::StandardButton status = QMessageBox::warning(
1581 this,
"Delete row(s)?",
"Delete selected row(s)?",
1582 QMessageBox::Yes | QMessageBox::No);
1584 if (status == QMessageBox::Yes) {
1588 emit rebuildModels(selectedRows);
1589 emit modelDataChanged();
1591 m_lastShiftSelection->clear();
1602 QString serialNumber;
1606 if (m_model->getSelectedItems().count() == 0) {
1607 item = m_activeCell->first;
1615 if (item->getPointerType() == AbstractTreeItem::Point) {
1621 serialNumber = item->getData(
"Image ID").toString();
1636 int startRow = verticalScrollBar()->value();
1637 int rowCount = (int) ceil(viewport()->height() / (
double) m_rowHeight);
1640 m_model->getItems(startRow, startRow + rowCount)) {
1641 m_items->append(item);
1644 viewport()->update();
1655 QMenu contextMenu(
this);
1666 if (QApplication::applicationName() !=
"cneteditor") {
1667 if (m_activeControlNet) {
1713 contextMenu.exec(mapToGlobal(mouseLocation));
Base class for delegates which create, read, and save data in the tables.
Translates the tree model into a table model.
Base class for an item in the tree.
const ControlMeasure * GetRefMeasure() const
Get the reference control measure.
QPair< int, int > getVisibleXRange(int visibleColumn)
bool hasActiveCell() const
Checks if there is an active cell.
void mouseDoubleClickEvent(QMouseEvent *event)
Overrides QWidget::mouseDoubleClickEvent.
QList< AbstractTreeItem * > updateRowGroupSelection(int lastRow)
Updates which row is selected.
void moveActiveCellDown()
Changes the viewport when the active cell is moved.
int getRowFromScreenY(int screenY) const
Calculates the visible range of a row and returns the index of the column.
void paintEvent(QPaintEvent *event)
Paints the table when there is a paint event.
AbstractTableModel * getModel()
Returns the model.
void clearActiveCell()
Clears the active cell.
void refresh()
Refreshes the table and viewport.
void leaveEvent(QEvent *event)
Overrides QWidget::leaveEvent.
void resizeEvent(QResizeEvent *event)
Updates the table when it is resized.
void scrollTo(QList< AbstractTreeItem * >)
Scrolls to the selected items.
void mousePressEvent(QMouseEvent *event)
Overrides QWidget::mousePressEvent.
void copyCellSelection(bool)
Copies the selected cells.
void updateItemList()
Updates the item list.
void createActions()
Builds the menus.
void updateColumnGroupSelection(AbstractTreeItem *)
Updates which column is selected.
void editControlPoint()
Retrieves the control point from the selected cells for editing.
void finishEditing()
Saves the data from the cell the user was modifying.
QSize sizeHint() const
Returns the minimum size hint.
void copyAll()
Copies all of the cells.
QAction * m_applyToSelectionAct
This action applies (copies) the contents of the active cell to the current selection.
QAction * m_editControlPointAct
This action edits selected control point or if measure selected, edit parent control pt.
void clearColumnSelection()
Clears the selected column.
void cellDataChanged(TableColumn const *col)
Rebuilds the models when the data is changed.
void moveActiveCellRight()
Changes the viewport when the active cell is moved.
QAction * m_deleteSelectedRowsAct
This action deletes the selected rows.
void updateHorizontalScrollBar(bool scrollRight=false)
Updates the horizontal scroll bar.
bool eventFilter(QObject *target, QEvent *event)
Overrides QObject::eventFilter.
bool rowIsValid(int rowNum) const
Checks if the row number is valid.
AbstractTreeItem * m_lastDirectlySelectedRow
This is the last row that was selected by either a control-click or normal click.
bool cellIsEditable(int, int) const
Checks if the cell is editable.
void moveActiveCellLeft()
Changes the viewport when the active cell is moved.
void deleteSelectedRows()
Deletes the selected rows.
void updateActiveCell(QPoint)
Updates which cell is active.
QSize minimumSizeHint() const
Returns the minimum size hint.
QAction * m_applyToAllAct
This action applies (copies) the contents of the active cell to all of the cells in the active cell's...
TableViewContent(AbstractTableModel *someModel)
Constructor.
bool hasRowSelection() const
Checks if there is a row selected.
void paintRow(QPainter *, int, QPoint, QPoint)
Repaints the row.
bool columnIsValid(int colNum) const
Checks if the column number is valid.
QList< AbstractTreeItem * > * rowsWithActiveColumnSelected
Stores a list of the rows that have their active column cells selected.
void keyPressEvent(QKeyEvent *event)
Overrides QWidget::keyPressEvent.
void copySelection()
Copies selected cells.
void nullify()
Clears all member variables.
bool isDataColumn(int) const
Checks if the column has a non empty title.
void moveActiveCellUp()
Shifts the active cell up.
void mouseReleaseEvent(QMouseEvent *event)
Overrides QWidget::mouseReleaseEvent.
void mouseMoveEvent(QMouseEvent *event)
Overrides QWidget::mouseMoveEvent.
void showContextMenu(QPoint)
Populates the context menus based on where the user clicked.
bool mouseInRowSelection(QPoint) const
Checks if the mouse is in the selected row.
void scrollContentsBy(int dx, int dy)
Updates the item list when the user scrolls.
virtual ~TableViewContent()
Destructor.
void setActiveControlNet(bool activeNet)
Sets if there is an active control net.
int getColumnFromScreenX(int screenX) const
Calculates the visible range of a column and returns the index of the column.
bool mouseInCellSelection(QPoint) const
Checks if the mouse is in the selected cells.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.