www.pudn.com > treeView.rar > itemdelegate.cpp, change:2011-03-13,size:909b


#include "itemdelegate.h" 
#include "QLineEdit" 
#include <QComboBox> 
#include "widget.h" 
ItemDelegate::ItemDelegate(QObject *parent) : 
    QItemDelegate(parent) 
{ 
} 
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, 
                         const QModelIndex &index) const 
{ 
   QItemDelegate::paint(painter,option,index); 
} 
QWidget *ItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, 
                                const QModelIndex &index) const 
{ 
    Widget *widget = new Widget(parent); 
    widget->setMinimumHeight(50); 
    widget->setMinimumWidth(200); 
    //widget->resize(QSize(100,100)); 
    return widget; 
} 
void ::ItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const 
{ 
    //QWidget *edit = new QWidget; 
    QComboBox *edit = new QComboBox; 
    QItemDelegate::setEditorData(edit,index); 
}