11 #include "TableView.h"
18 #include <QVBoxLayout>
20 #include "AbstractTableModel.h"
21 #include "IException.h"
22 #include "TableViewHeader.h"
23 #include "TableViewContent.h"
24 #include "TableColumn.h"
25 #include "TableColumnList.h"
37 QString pathForSettings,
42 setObjectName(objName);
47 connect(
m_model, SIGNAL(filterCountsChanged(
int,
int)),
48 this, SIGNAL(filterCountsChanged(
int,
int)));
49 connect(
m_model, SIGNAL(userWarning(AbstractTableModel::Warning)),
59 for (
int i = 0; i <
m_columns->size(); i++) {
61 QString colTitle = col->getTitle();
62 int defaultWidth = QFontMetrics(font()).width(colTitle) + 40;
63 if (colTitle.size()) {
64 key = objectName() +
" " + colTitle +
" width";
65 key.replace(
" ",
"_");
66 col->setWidth(settings.value(key, defaultWidth).toInt());
68 key = objectName() +
" " + colTitle +
" ascending";
69 key.replace(
" ",
"_");
70 col->setSortAscending(settings.value(key,
true).toBool());
73 col->setWidth(defaultWidth);
79 key = objectName() +
" sorting order";
80 key.replace(
" ",
"_");
89 connect(
m_header, SIGNAL(requestedGlobalSelection(
bool)),
91 connect(
m_header, SIGNAL(requestedGlobalSelection(
bool)),
92 this, SIGNAL(selectionChanged()));
95 connect(
m_content, SIGNAL(tableSelectionChanged()),
96 this, SIGNAL(selectionChanged()));
101 connect(
m_content, SIGNAL(horizontalScrollBarValueChanged(
int)),
102 m_header, SLOT(updateHeaderOffset(
int)));
103 connect(
m_content, SIGNAL(modelDataChanged()),
104 this, SIGNAL(modelDataChanged()));
108 this, SIGNAL(editControlPoint(
ControlPoint *, QString)));
110 connect(
m_header, SIGNAL(columnResized(
bool)),
111 m_content, SLOT(updateHorizontalScrollBar(
bool)));
113 QVBoxLayout *layout =
new QVBoxLayout;
117 layout->setContentsMargins(0, 0, 0, 0);
118 layout->setSpacing(0);
129 ASSERT(objectName().size());
133 for (
int i = 0; i <
m_columns->size(); i++) {
135 QString colTitle = col->getTitle();
136 if (colTitle.size()) {
137 key = objectName() +
" " + colTitle +
" width";
138 key.replace(
" ",
"_");
139 settings.setValue(key, col->getWidth());
141 key = objectName() +
" " + colTitle +
" ascending";
142 key.replace(
" ",
"_");
143 settings.setValue(key, col->sortAscending());
147 key = objectName() +
" sorting order";
148 key.replace(
" ",
"_");
149 settings.setValue(key,
m_columns->getSortingOrderAsStrings());
176 for (
int i = 0; i <
m_columns->size(); i++) {
178 if (col->getTitle() == column)
179 col->setVisible(visible);
259 case AbstractTableModel::SortingDisabled:
260 m_warningLabel->setText(tr(
"<font color='red'>Sorting disabled</font>"));
264 case AbstractTableModel::SortingTableSizeLimitReached:
266 tr(
"<font color='red'>Sorting disabled - table row count (%L1) > table size limit"
273 case AbstractTableModel::None: