summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-05-22 15:48:23 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-05-22 17:25:01 +0200
commit701bdcbc8b7751834f6d24844bcb91a23cbdc409 (patch)
tree08b01cf07b2cff2d7f51bceb8a06656f25f5d942 /src/gui/itemviews
parentfc7a43cceba63b79a40183334ab97527483113e3 (diff)
Pressing enter in a QPlainTextEdit embedded on a itemview should insert a newline
Do the same special case as for QTextEdit (yes, this is a pitty that we have special cases like that Reviewed-by: Thierry Task-number: 252532
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp3
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index 3b7eb2dcdb..a748199b1c 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -47,6 +47,7 @@
#include <qbrush.h>
#include <qlineedit.h>
#include <qtextedit.h>
+#include <qplaintextedit.h>
#include <qpainter.h>
#include <qpalette.h>
#include <qpoint.h>
@@ -1194,7 +1195,7 @@ bool QItemDelegate::eventFilter(QObject *object, QEvent *event)
case Qt::Key_Enter:
case Qt::Key_Return:
#ifndef QT_NO_TEXTEDIT
- if (qobject_cast<QTextEdit*>(editor))
+ if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor))
return false; // don't filter enter key events for QTextEdit
// We want the editor to be able to process the key press
// before committing the data (e.g. so it can do
diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp
index be0971b016..7f2c8eda0e 100644
--- a/src/gui/itemviews/qstyleditemdelegate.cpp
+++ b/src/gui/itemviews/qstyleditemdelegate.cpp
@@ -47,6 +47,7 @@
#include <qbrush.h>
#include <qlineedit.h>
#include <qtextedit.h>
+#include <qplaintextedit.h>
#include <qpainter.h>
#include <qpalette.h>
#include <qpoint.h>
@@ -646,7 +647,7 @@ bool QStyledItemDelegate::eventFilter(QObject *object, QEvent *event)
case Qt::Key_Enter:
case Qt::Key_Return:
#ifndef QT_NO_TEXTEDIT
- if (qobject_cast<QTextEdit*>(editor))
+ if (qobject_cast<QTextEdit *>(editor) || qobject_cast<QPlainTextEdit *>(editor))
return false; // don't filter enter key events for QTextEdit
// We want the editor to be able to process the key press
// before committing the data (e.g. so it can do