aboutsummaryrefslogtreecommitdiffstats
path: root/textedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--textedit.cpp35
1 files changed, 35 insertions, 0 deletions
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;
+}