OSDN Git Service

Implemented almost all ui.
[greensite/jasmine.git] / ui / editdelegate.cxx
1 #include "editdelegate.h"
2 MemberListEditDelegate::MemberListEditDelegate(QObject *parent):
3                 QItemDelegate(parent){}
4 QWidget *MemberListEditDelegate::createEditor(QWidget *parent,const QStyleOptionViewItem &option,const QModelIndex &index)const{
5         QLineEdit *editor=qobject_cast<QLineEdit *>(QItemDelegate::createEditor(parent,option,index));
6         editor->setValidator(new IPAddressValidator(true,editor));
7         connect(editor,SIGNAL(editingFinished()),SLOT(edit_finished()));
8         return editor;
9 }
10 void MemberListEditDelegate::edit_finished(){
11         QLineEdit *editor=qobject_cast<QLineEdit *>(this->sender());
12         emit this->commitData(editor);
13         emit this->closeEditor(editor);
14 }