All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
QGpGuiTools::ColumnTextDelegate Class Reference

Brief description of class still missing. More...

#include <ColumnTextDelegate.h>

List of all members.

Public Member Functions

 ColumnTextDelegate (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
void setTypes (QStringList t)
const QStringList & types () const

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

QGpGuiTools::ColumnTextDelegate::ColumnTextDelegate ( QObject *  parent = 0) [inline]
: QItemDelegate(parent) {}

Member Function Documentation

QWidget * QGpGuiTools::ColumnTextDelegate::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const

References TRACE, and w.

  {
    TRACE;
    switch (index.row()) {
    case 0: {
        QComboBox * w=new QComboBox(parent);
        w->addItems(_types);
        connect(w, SIGNAL(activated(int)), this, SLOT(typeChanged()));
        return w;
      }
    case 1:
    case 2:
    case 3: {
        QLineEdit * w=new QLineEdit(parent);
        return w;
      }
    default:
      return 0;
    }
    return 0;
  }
void QGpGuiTools::ColumnTextDelegate::setEditorData ( QWidget *  editor,
const QModelIndex &  index 
) const

References TRACE, and w.

  {
    TRACE;
    switch (index.row()) {
    case 0: {
        QComboBox * w=qobject_cast<QComboBox *>(editor);
        ASSERT(w);
        int i=w->findText(index.model()->data(index).toString());
        w->setCurrentIndex(i);
        break;
      }
    case 1:
    case 2:
    case 3: {
        QLineEdit * w=qobject_cast<QLineEdit *>(editor);
        ASSERT(w);
        w->setText(index.model()->data(index).toString());
        w->selectAll();
        break;
      }
    default:
      break;
    }
  }
void QGpGuiTools::ColumnTextDelegate::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const

References TRACE, and w.

  {
    TRACE;
    switch (index.row()) {
    case 0: {
        QComboBox * w=qobject_cast<QComboBox *>(editor);
        ASSERT(w);
        if(model->data(index)!=w->currentText()) {
          model->setData(index, w->currentText());
        }
        break;
      }
    case 1:
    case 2:
    case 3: {
        QLineEdit * w=qobject_cast<QLineEdit *>(editor);
        ASSERT(w);
        if(model->data(index)!=w->text()) {
          model->setData(index, w->text());
        }
        break;
      }
    default:
      break;
    }
  }
void QGpGuiTools::ColumnTextDelegate::setTypes ( QStringList  t) [inline]
const QStringList& QGpGuiTools::ColumnTextDelegate::types ( ) const [inline]
{return _types;}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines