oksirc/ui.cpp
Darren VanBuren 851c2f79e3 Separate UI to new file, still not quite complete.
Also fixed code style in files, and settings used by CLion.
2017-07-09 15:17:24 -07:00

35 lines
No EOL
1 KiB
C++

#include "ui.h"
ui::ui(int argc, char **argv) {
app = new QApplication(argc, argv);
mainWindow = new QWidget();
mainWindow->resize(1280, 720);
mainWindow->setWindowTitle("oksirc - early Qt test");
mainLog = new QPlainTextEdit();
mainLog->setReadOnly(true);
textEntry = new QLineEdit();
QPushButton *sendButton = new QPushButton(QApplication::translate("send", "Send"));
QObject::connect(sendButton, &QPushButton::clicked, this, &ui::sendButtonClicked);
QHBoxLayout *entryLineLayout = new QHBoxLayout();
entryLineLayout->addWidget(textEntry);
entryLineLayout->addWidget(sendButton);
QVBoxLayout *mainLogAndLineLayout = new QVBoxLayout();
mainLogAndLineLayout->addWidget(mainLog);
mainLogAndLineLayout->addLayout(entryLineLayout);
mainWindow->setLayout(mainLogAndLineLayout);
mainWindow->show();
textEntry->setFocus();
}
int ui::exec() {
return app->exec();
}
void ui::sendButtonClicked(bool checked) {
this->mainLog->appendPlainText("Send button clicked!");
this->mainLog->appendPlainText(textEntry->text());
textEntry->clear();
}