20 int row = index.row();
21 int col = index.column();
25 if (role == Qt::EditRole || role == Qt::DisplayRole) {
28 return p->detectorNumber();
29 }
else if (col == 2) {
30 return p->detectorTypeName();
31 }
else if (col == 3) {
32 return p->detectorName();
34 }
else if (role == Qt::CheckStateRole) {
42 }
else if (role == Qt::TextAlignmentRole) {
43 if (col == 0 || col == 1) {
44 return Qt::AlignHCenter;
46 return Qt::AlignAbsolute;
56 if (orientation == Qt::Horizontal) {
57 if (role == Qt::DisplayRole) {
73 }
else if (role == Qt::TextAlignmentRole) {
74 return Qt::AlignHCenter;
83 int row = index.row();
84 int col = index.column();
89 if (col == 1 && role == Qt::CheckStateRole) {
90 proxy->setEnabled(!proxy->enabled());
92 emit dataChanged(index, index);
95 }
else if (col == 3) {
96 if (role == Qt::EditRole || role == Qt::DisplayRole) {
97 proxy->setDetectorName(value.toString());
99 emit dataChanged(index, index);
111 int row = index.row();
112 int col = index.column();
115 return QAbstractListModel::flags(index) | Qt::ItemIsUserCheckable;
116 }
else if (col == 3) {
117 return QAbstractListModel::flags(index) | Qt::ItemIsEditable;
119 return QAbstractListModel::flags(index);
141 beginRemoveRows(QModelIndex(), row, row);
154 if (row >= 0 && row < (nRows-1)) {
155 beginMoveRows(QModelIndex(), row+1, row+1, QModelIndex(), row);
173 if (row >= 1 && row < nRows) {
174 beginMoveRows(QModelIndex(), row, row, QModelIndex(), row-1);
193 p->configureDetector();
203 p->setProperty(
"detectorNumber", i);
QSharedPointer< QxrdDetectorProxy > QxrdDetectorProxyPtr
void append(QxrdDetectorProxyPtr proxy)
void moveDetectorUp(int row)
void removeDetector(int row)
int rowCount(const QModelIndex &parent) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
bool setData(const QModelIndex &index, const QVariant &value, int role)
QVariant data(const QModelIndex &index, int role) const
QVector< QxrdDetectorProxyPtr > m_DetectorProxies
QxrdDetectorProxyListModel()
void moveDetectorDown(int row)
Qt::ItemFlags flags(const QModelIndex &index) const
QxrdDetectorProxyPtr detectorProxy(int i)
void configureDetector(int row)
int columnCount(const QModelIndex &parent) const