#include <SortKeys.h>
List of all members.
Public Member Functions |
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 |
| SortKeysDelegate (QObject *parent=0) |
Constructor & Destructor Documentation
References TRACE.
: QItemDelegate(parent)
{
TRACE;
_keyList=MetaDataFactory::instance()->registeredNames();
}
Member Function Documentation
References QGpCoreTools::tr(), and w.
{
switch(index.column()) {
case 0: {
QComboBox *w=new QComboBox (parent);
w->addItems(_keyList);
return w;
}
case 1: {
QLineEdit * w=new QLineEdit(parent);
return w;
}
case 2: {
QComboBox *w=new QComboBox (parent);
w->addItem(tr(sortKeyAscending));
w->addItem(tr(sortKeyDescending));
return w;
}
default:
break;
}
return 0;
}
References TRACE, and w.
{
TRACE;
switch(index.column()) {
case 0:
case 2: {
QComboBox *w=qobject_cast<QComboBox *>(editor);
if(!w) return;
int pos=w->findText(index.model()->data(index).toString(), Qt::MatchExactly);
w->setCurrentIndex(pos);
break;
}
case 1: {
QLineEdit *w=qobject_cast<QLineEdit *>(editor);
if(!w) return;
w->setText(index.model()->data(index).toString());
break;
}
default:
break;
}
}
References TRACE, and w.
{
TRACE;
switch(index.column()) {
case 0:
case 2: {
QComboBox *w=qobject_cast<QComboBox *>(editor);
if(!w) return;
model->setData(index, w->currentText());
break;
}
case 1: {
QLineEdit *w=qobject_cast<QLineEdit *>(editor);
if(!w) return;
model->setData(index, w->text());
break;
}
default:
break;
}
}
The documentation for this class was generated from the following files: