From 1cf3eb2174458a0b844287b9c265fc4e92464177 Mon Sep 17 00:00:00 2001 From: nils Date: Wed, 22 Dec 2010 23:06:04 +0000 Subject: added comment action (to insert > at every line) in edit menu, added drag and drop handling and exported textedit to its own class git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@407 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- textedit.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 textedit.cpp (limited to 'textedit.cpp') diff --git a/textedit.cpp b/textedit.cpp new file mode 100644 index 0000000..9615d20 --- /dev/null +++ b/textedit.cpp @@ -0,0 +1,35 @@ +#include "QDebug" +class QString; +#include "textedit.h" +TextEdit::TextEdit(QWidget *parent) +{ + setAcceptDrops(true); +} + +void TextEdit::dragEnterEvent(QDragEnterEvent *event) +{ + if (event->mimeData()->hasFormat("text/plain")) + qDebug() << "enter drag action"; + + //event->acceptProposedAction(); +} + +void TextEdit::dropEvent(QDropEvent* event) +{ + this->setPlainText(event->mimeData()->text()); + + qDebug() << "enter drop action"; + qDebug() << event->mimeData()->text(); + event->acceptProposedAction(); +} + +void TextEdit::comment() +{ + QString test=this->toPlainText(); + qDebug() << "-------------"; + qDebug() << test; + test.replace("\n","\n>",Qt::CaseSensitive); + test.insert(0,QString(">")); + qDebug() << "-------------"; + qDebug() << test; +} -- cgit v1.2.3