QWidget * KWQTableDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const { Q_UNUSED(option); KLineEdit *editor = new KLineEdit(parent); editor->setFrame(false); editor->setFont(index.data(Qt::FontRole).value<QFont>()); //connect(editor, SIGNAL(returnPressed()), this, SLOT(commitAndCloseEditor())); return editor; }
FileEditor::FileEditor(FileContent *fileContent, QWidget *parent) : NoteEditor(fileContent), m_fileContent(fileContent) { KLineEdit *lineEdit = new KLineEdit(parent); FocusWidgetFilter *filter = new FocusWidgetFilter(lineEdit); QPalette palette; palette.setColor(lineEdit->backgroundRole(), note()->backgroundColor()); palette.setColor(lineEdit->foregroundRole(), note()->textColor()); lineEdit->setPalette(palette); lineEdit->setFont(note()->font()); lineEdit->setText(m_fileContent->fileName()); lineEdit->selectAll(); setInlineEditor(lineEdit); connect(filter, SIGNAL(returnPressed()), this, SIGNAL(askValidation())); connect(filter, SIGNAL(escapePressed()), this, SIGNAL(askValidation())); connect(filter, SIGNAL(mouseEntered()), this, SIGNAL(mouseEnteredEditorWidget())); }