From 17cfdbb9140f7c711db5d814c1e965a09cc81e55 Mon Sep 17 00:00:00 2001
From: tobiglaser <76131623+tobiglaser@users.noreply.github.com>
Date: Sun, 15 May 2022 22:27:14 +0200
Subject: [PATCH] add control

---
 Text2Console/control.cpp | 23 +++++++++++++++++++++++
 Text2Console/control.h   | 22 ++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 Text2Console/control.cpp
 create mode 100644 Text2Console/control.h

diff --git a/Text2Console/control.cpp b/Text2Console/control.cpp
new file mode 100644
index 0000000..d67dcb3
--- /dev/null
+++ b/Text2Console/control.cpp
@@ -0,0 +1,23 @@
+#include <iostream>
+
+#include "control.h"
+#include <QObject>
+
+Control::Control(MainWindow *_view)
+{
+    view = _view;
+    connect(view->button, SIGNAL(clicked()), this, SLOT(onButton()));
+}
+
+void Control::onButton()
+{
+    QString text = view->lineEdit->text();
+
+    std::string str = text.toStdString();
+
+    std::cout << str << std::endl;
+}
+
+Control::~Control()
+{
+}
\ No newline at end of file
diff --git a/Text2Console/control.h b/Text2Console/control.h
new file mode 100644
index 0000000..fec1a74
--- /dev/null
+++ b/Text2Console/control.h
@@ -0,0 +1,22 @@
+#ifndef CONTROL_H
+#define CONTROL_H
+
+#include <QObject>
+#include "mainwindow.h"
+
+class Control : public QObject
+{
+    Q_OBJECT
+
+private:
+    MainWindow *view;
+
+public:
+    Control(MainWindow *_view);
+    ~Control();
+
+private slots:
+    void onButton();
+
+};
+#endif // CONTROL_H
-- 
GitLab