chatwindow.cpp 586 Bytes
#include "chatwindow.h"
#include "ui_chatwindow.h"

using namespace std;

ChatWindow::ChatWindow(QString& nickname, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ChatWindow)
{
    ui->setupUi(this);
    QList<int> sizes;
    sizes.push_front(ui->chatText->height());
    sizes.push_front(100);
    ui->splitter->setSizes(sizes);
    this->setWindowTitle("Chat with " + nickname);
    connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close()));
}

void ChatWindow::printMsg(string& str)
{
    ui->chatText->printMsg(str);
}

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