Commit 62c198cf authored by Aaron J. Seigo's avatar Aaron J. Seigo
Browse files

apparently this fix does not belong in the stable branch.

if unsure why, you can ask Reindl Harald <h.reindl@thelounge.net>.

CCBUG:270414
parent 1a284bb7
......@@ -29,8 +29,7 @@
ItemEditor::ItemEditor(QGraphicsWidget *parent, const QStyleOptionViewItemV4 &option,
const QModelIndex &index)
: QGraphicsProxyWidget(parent),
m_index(index),
m_uncommitted(true)
m_index(index)
{
// Create the editor
m_editor = new KTextEdit();
......@@ -67,18 +66,14 @@ ItemEditor::~ItemEditor()
void ItemEditor::commitData()
{
if (m_uncommitted) {
const_cast<QAbstractItemModel*>(m_index.model())->setData(m_index, m_editor->toPlainText(), Qt::EditRole);
m_uncommitted = false;
}
const_cast<QAbstractItemModel*>(m_index.model())->setData(m_index, m_editor->toPlainText(), Qt::EditRole);
}
bool ItemEditor::eventFilter(QObject *watched, QEvent *event)
{
KTextEdit *editor = qobject_cast<KTextEdit*>(watched);
if (!editor) {
if (!editor)
return false;
}
switch (event->type())
{
......@@ -112,10 +107,8 @@ bool ItemEditor::eventFilter(QObject *watched, QEvent *event)
case QEvent::FocusOut:
{
if (m_uncommitted) {
commitData();
emit closeEditor(this, QAbstractItemDelegate::NoHint);
}
commitData();
emit closeEditor(this, QAbstractItemDelegate::NoHint);
return true;
}
......
......@@ -49,7 +49,6 @@ protected:
private:
KTextEdit *m_editor;
QModelIndex m_index;
bool m_uncommitted;
};
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment