All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
#include <AsciiSignalRulesWidget.h>
Public Member Functions | |
| AsciiSignalRulesDelegate (QObject *parent=0) | |
| QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const |
| void | setEditorData (QWidget *editor, const QModelIndex &index) const |
| void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const |
| GeopsyGui::AsciiSignalRulesDelegate::AsciiSignalRulesDelegate | ( | QObject * | parent = 0 | ) |
| QWidget * GeopsyGui::AsciiSignalRulesDelegate::createEditor | ( | QWidget * | parent, |
| const QStyleOptionViewItem & | option, | ||
| const QModelIndex & | index | ||
| ) | const |
References TRACE.
{
TRACE;
switch(index.column()) {
case 1:
case 3:
case 4:
case 5:
case 6:
case 8: {
QLineEdit * w=new QLineEdit(parent);
connect(w, SIGNAL(textChanged(QString)), this, SLOT(commitWidget()));
return w;
}
case 7: {
QComboBox * w=new QComboBox(parent);
w->addItems(_tableFieldList);
return w;
}
default:
return QItemDelegate::createEditor(parent, option, index);
}
}
| void GeopsyGui::AsciiSignalRulesDelegate::setEditorData | ( | QWidget * | editor, |
| const QModelIndex & | index | ||
| ) | const |
References TRACE.
{
TRACE;
switch(index.column()) {
case 1:
case 3:
case 4:
case 5:
case 6:
case 8: {
QLineEdit * w= qobject_cast<QLineEdit *>(editor);
if( !w) return;
w->setText(index.model() ->data(index).toString());
w->selectAll();
}
break;
case 7: {
QComboBox * w=qobject_cast<QComboBox *>(editor);
if( !w) return;
int pos=w->findText(index.model() ->data(index).toString(), Qt::MatchExactly);
w->setCurrentIndex(pos);
}
break;
default:
return QItemDelegate::setEditorData(editor, index);
}
}
| void GeopsyGui::AsciiSignalRulesDelegate::setModelData | ( | QWidget * | editor, |
| QAbstractItemModel * | model, | ||
| const QModelIndex & | index | ||
| ) | const |
References TRACE.
{
TRACE;
switch(index.column()) {
case 1:
case 3:
case 4:
case 5:
case 6:
case 8: {
QLineEdit * w=qobject_cast<QLineEdit *>(editor);
if( !w) return;
model->setData(index, w->text());
}
break;
case 7: {
QComboBox * w=qobject_cast<QComboBox *>(editor);
if( !w) return;
model->setData(index, w->currentText());
}
break;
default:
return QItemDelegate::setModelData(editor, model, index);
}
}