9 (
QseDataSet *dataSet, QTableView *table, QObject *parent)
10 : QAbstractTableModel(parent),
18 connect(dataSet, SIGNAL(operationCompleted()),
19 this, SLOT(operationCompleted()));
25 QItemSelectionModel *m =
m_TableView -> selectionModel();
27 return (m->isRowSelected(s, QModelIndex()));
50 QItemSelectionModel *m =
m_TableView -> selectionModel();
53 m -> select(index(nrows-1,0),
54 QItemSelectionModel::Current | QItemSelectionModel::Rows |
55 QItemSelectionModel::Select);
58 ss.select(index(nrows-1,0),index(nrows-1,0));
60 QItemSelectionModel::Current | QItemSelectionModel::Rows |
61 QItemSelectionModel::Toggle);
73 QModelIndex topLeft = createIndex(0,0);
76 emit dataChanged(topLeft, botRight);
85 return index(n,0,QModelIndex());
91 if (parent.column() > 0) {
124 static int min(
int a,
int b)
137 case Qt::DisplayRole:
138 return "Qt::DisplayRole";
140 case Qt::DecorationRole:
141 return "Qt::DecorationRole";
144 return "Qt::EditRole";
146 case Qt::ToolTipRole:
147 return "Qt::ToolTipRole";
149 case Qt::StatusTipRole:
150 return "Qt::StatusTipRole";
152 case Qt::WhatsThisRole:
153 return "Qt::WhatsThisRole";
155 case Qt::SizeHintRole:
156 return "Qt::SizeHintRole";
159 return "Qt::FontRole";
161 case Qt::TextAlignmentRole:
162 return "Qt::TextAlignmentRole";
164 case Qt::BackgroundRole:
165 return "Qt::BackgroundRole";
170 case Qt::ForegroundRole:
171 return "Qt::ForegroundRole";
176 case Qt::CheckStateRole:
177 return "Qt::CheckStateRole";
179 case Qt::AccessibleTextRole:
180 return "Qt::AccessibleTextRole";
182 case Qt::AccessibleDescriptionRole:
183 return "Qt::AccessibleDescriptionRole";
186 return "Qt::UserRole";
196 if (!index.isValid()) {
200 int row = index.row();
201 int col = index.column();
206 case Qt::DisplayRole:
209 return scan -> name();
212 return scan -> maxRowCount();
230 case Qt::ToolTipRole:
232 const int maxlines = 15;
233 const int maxlength = 80;
240 QStringList hdr = scan -> header();
241 int nlines =
min(hdr.size(),maxlines);
242 for (
int i=0; i<nlines; i++) {
244 if (l.size()>maxlength) {
245 res += l.mid(0,maxlength) +
" ...\n";
250 if (hdr.size()>maxlines) {
256 if (l.size()>maxlength) {
257 res += l.mid(0,maxlength) +
" ...\n";
266 case Qt::SizeHintRole:
269 return QSize(200,15);
293 (
int section, Qt::Orientation orientation,
int role)
const
295 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
311 if (orientation == Qt::Vertical && role == Qt::DisplayRole) {
QseScan * scan(int n) const
QseGraphScansModel(QseDataSet *dataSet, QTableView *table, QObject *parent=0)
static const char * role_string(int role)
QString scanDateLine() const
QString scanCommand() const
QString scanColumnNamesLine() const
int columnCount(const QModelIndex &parent=QModelIndex()) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
void operationCompleted()
QModelIndex indexOfScan(int n)
QVariant data(const QModelIndex &index, int role) const
QString scanColumnCountLine() const
static int min(int a, int b)
int rowCount(const QModelIndex &parent=QModelIndex()) const