Marlin  01.17.01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ocoldelegate.cpp
Go to the documentation of this file.
1 #include <QtGui>
2 
3 #include "marlin/CCProcessor.h"
4 #include "marlin/CCCollection.h"
5 
6 #include "ocoldelegate.h"
7 
9  _parent = qobject_cast<QTableWidget *>(parent);
10  _p=p;
11  _msc=msc;
12 }
13 
14 QWidget *OColDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & /* option */, const QModelIndex &index) const
15 {
16 
17  QLineEdit *edit = new QLineEdit(parent);
18  if( index.column() != 2){
19  edit->setReadOnly(true);
20  }
21  return edit;
22 }
23 
24 void OColDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
25 {
26  QLineEdit *edit = qobject_cast<QLineEdit *>(editor);
27  edit->setText(index.model()->data(index).toString());
28 
29  if( _p->isActive() ){
30  //set background color
31  _parent->currentItem()->setBackgroundColor(
32  _p->isErrorCol( _parent->item(index.row(),1)->text().toStdString(), edit->text().toStdString() ) ?
33  QColor(184,16,0,180) : QColor(32,140,64,180) );
34  }
35 }
36 
37 void OColDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
38 {
39  QLineEdit *edit = qobject_cast<QLineEdit *>(editor);
40  model->setData(index, edit->displayText());
41 
42  //update the processor
43  _p->getCols( OUTPUT, _parent->item(index.row(),0)->text().toStdString() )[ 0 ]->setValue(edit->displayText().toStdString());
45 
46  if( _p->isActive() ){
47  //set background color
48  _parent->currentItem()->setBackgroundColor(
49  _p->isErrorCol( _parent->item(index.row(),1)->text().toStdString(), edit->text().toStdString() ) ?
50  QColor(184,16,0,180) : QColor(32,140,64,180) );
51  }
52 }
53 
QTableWidget * _parent
Definition: ocoldelegate.h:36
this class is a Marlin Steering File consistency check Tool.
bool isErrorCol(const std::string &type, const std::string &value)
Returns true if the given collection is in the unavailable or duplicate list of this processor...
Definition: CCProcessor.cc:381
CCProcessor * _p
Definition: ocoldelegate.h:34
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
handles information about marlin processors and their collections needed by MarlinSteerCheck ...
Definition: CCProcessor.h:39
MarlinSteerCheck * _msc
Definition: ocoldelegate.h:35
ColVec & getCols(const std::string &iotype, const std::string &type_name="ALL_COLLECTIONS")
Returns collections of a given iotype ( INPUT, OUTPUT, UNAVAILABLE, DUPLICATE ) for a given name or t...
Definition: CCProcessor.cc:352
void consistencyCheck()
Performs a check at all active processors to search for unavailable collections.
void setEditorData(QWidget *editor, const QModelIndex &index) const
OColDelegate(const OColDelegate &)=default
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
bool isActive()
Returns true if the processor is active.
Definition: CCProcessor.h:68
#define OUTPUT
Definition: CCProcessor.h:16