Commit 0b080316 authored by Thiago Santini's avatar Thiago Santini

Adds user input to the Log Widget

parent fdd49102
......@@ -20,3 +20,14 @@ void LogWidget::appendMessage(const QString &msg)
{
ui->log->appendPlainText(msg.trimmed());
}
void LogWidget::on_usrMsg_returnPressed()
{
on_addMsg_clicked();
}
void LogWidget::on_addMsg_clicked()
{
qInfo() << "[USER]" << ui->usrMsg->text();
ui->usrMsg->clear();
}
......@@ -2,6 +2,7 @@
#define LOGWIDGET_H
#include <QMainWindow>
#include <QDebug>
namespace Ui {
class LogWidget;
......@@ -18,6 +19,11 @@ public:
public slots:
void appendMessage(const QString &msg);
private slots:
void on_usrMsg_returnPressed();
void on_addMsg_clicked();
private:
Ui::LogWidget *ui;
};
......
......@@ -22,6 +22,9 @@
<family>Courier New</family>
</font>
</property>
<property name="toolTip">
<string>Log messages</string>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
......@@ -30,6 +33,27 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="addLogLayout">
<item>
<widget class="QLineEdit" name="usrMsg">
<property name="toolTip">
<string>You can add a user message to the log by using this text box and pressing return or the &quot;Add&quot; button.</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addMsg">
<property name="toolTip">
<string>Adds user message to the log.</string>
</property>
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
......
Markdown is supported
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