LogWidget.cpp 660 Bytes
Newer Older
Thiago Santini's avatar
Thiago Santini committed
1 2 3 4
#include "LogWidget.h"
#include "ui_LogWidget.h"

LogWidget::LogWidget(QWidget *parent) :
5
	ERWidget(parent),
Thiago Santini's avatar
Thiago Santini committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    ui(new Ui::LogWidget)
{
    ui->setupUi(this);

    setWindowTitle("Log Widget");
    setWindowIcon(QIcon(":/icons/logWidget.png"));
}

LogWidget::~LogWidget()
{
    delete ui;
}

void LogWidget::appendMessage(const QString &msg)
{
Thiago Santini's avatar
Thiago Santini committed
21 22
	ui->log->appendPlainText( msg.trimmed() );
	ui->log->verticalScrollBar()->setValue( ui->log->verticalScrollBar()->maximum() );
Thiago Santini's avatar
Thiago Santini committed
23
}
24 25 26 27 28 29 30 31 32 33 34

void LogWidget::on_usrMsg_returnPressed()
{
    on_addMsg_clicked();
}

void LogWidget::on_addMsg_clicked()
{
    qInfo() << "[USER]" << ui->usrMsg->text();
    ui->usrMsg->clear();
}