3 #include "MeasureTableModel.h" 10 #include <QStringList> 22 #include "AbstractTableDelegate.h" 23 #include "AbstractMeasureItem.h" 24 #include "TableColumn.h" 25 #include "TableColumnList.h" 26 #include "MeasureTableDelegate.h" 27 #include "AbstractTreeModel.h" 31 MeasureTableModel::MeasureTableModel(AbstractTreeModel *model) :
32 AbstractTableModel(model, new MeasureTableDelegate) {
33 connect(model, SIGNAL(filterCountsChanged(
int,
int)),
34 this, SLOT(calculateFilterCounts()));
42 MeasureTableModel::~MeasureTableModel() {
48 return getSortedItems(start, end, AbstractTreeModel::MeasureItems);
53 AbstractTreeItem *item1, AbstractTreeItem *item2) {
54 return getSortedItems(item1, item2, AbstractTreeModel::MeasureItems);
58 int MeasureTableModel::getVisibleRowCount()
const {
59 return getDataModel()->getVisibleItemCount(
60 AbstractTreeModel::MeasureItems,
true);
65 return getDataModel()->getSelectedItems(
66 AbstractTreeModel::MeasureItems,
true);
70 QString MeasureTableModel::getWarningMessage(AbstractTreeItem
const *row,
71 TableColumn
const *column, QString valueToSave)
const {
72 return getMeasureWarningMessage(row, column, valueToSave);
76 void MeasureTableModel::setGlobalSelection(
bool selected) {
77 return getDataModel()->setGlobalSelection(selected,
78 AbstractTreeModel::MeasureItems);
82 void MeasureTableModel::calculateFilterCounts() {
83 int visible = getDataModel()->getVisibleItemCount(
84 AbstractTreeModel::MeasureItems,
true);
85 int total = getDataModel()->getItemCount(
86 AbstractTreeModel::MeasureItems);
88 emit filterCountsChanged(visible, total);
92 int MeasureTableModel::indexOfVisibleItem(
93 AbstractTreeItem
const *item)
const {
94 return getDataModel()->indexOfVisibleItem(item,
95 AbstractTreeModel::MeasureItems,
true);
99 QString MeasureTableModel::getMeasureWarningMessage(
100 AbstractTreeItem
const *row, TableColumn
const *column,
101 QString valueToSave) {
102 QString colTitle = column->getTitle();
103 AbstractMeasureItem::Column colType =
104 AbstractMeasureItem::getColumn(colTitle);
108 if (colType == AbstractMeasureItem::EditLock &&
109 valueToSave.toLower() ==
"no" &&
110 row->getFormattedData(colTitle).toLower() ==
"yes") {
111 QString pointColTitle =
112 AbstractMeasureItem::getColumnName(AbstractMeasureItem::PointId);
113 warningText =
"Are you sure you want to unlock control measure [" +
114 row->getFormattedData() +
"] in point [" +
115 row->getFormattedData(pointColTitle) +
"] for editing?";
122 void MeasureTableModel::handleTreeSelectionChanged(
124 AbstractTableModel::handleTreeSelectionChanged(
125 newlySelectedItems, AbstractTreeItem::Measure);
129 TableColumnList *MeasureTableModel::createColumns() {
130 return AbstractMeasureItem::createColumns();
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Namespace for ISIS/Bullet specific routines.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.