35 lines
No EOL
1 KiB
C++
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();
|
|
} |