Separate UI to new file, still not quite complete.
Also fixed code style in files, and settings used by CLion.
This commit is contained in:
parent
4d6ff1e9f8
commit
851c2f79e3
6 changed files with 184 additions and 105 deletions
35
ui.cpp
Normal file
35
ui.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#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();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue