Get closer to actually connecting, add hitting enter on text entry
This commit is contained in:
parent
1af0632037
commit
4ff4d4d93d
3 changed files with 105 additions and 7 deletions
11
ui.cpp
11
ui.cpp
|
@ -11,6 +11,7 @@ ui::ui(int argc, char **argv) {
|
|||
textEntry = new QLineEdit();
|
||||
QPushButton *sendButton = new QPushButton(QApplication::translate("send", "Send"));
|
||||
QObject::connect(sendButton, &QPushButton::clicked, this, &ui::sendButtonClicked);
|
||||
QObject::connect(textEntry, &QLineEdit::returnPressed, this, &ui::returnOnTextEntry);
|
||||
|
||||
QHBoxLayout *entryLineLayout = new QHBoxLayout();
|
||||
entryLineLayout->addWidget(textEntry);
|
||||
|
@ -28,8 +29,14 @@ int ui::exec() {
|
|||
return app->exec();
|
||||
}
|
||||
|
||||
void ui::returnOnTextEntry() {
|
||||
mainLog->appendPlainText("Return key pressed!");
|
||||
mainLog->appendPlainText(textEntry->text());
|
||||
textEntry->clear();
|
||||
}
|
||||
|
||||
void ui::sendButtonClicked(bool checked) {
|
||||
this->mainLog->appendPlainText("Send button clicked!");
|
||||
this->mainLog->appendPlainText(textEntry->text());
|
||||
mainLog->appendPlainText("Send button clicked!");
|
||||
mainLog->appendPlainText(textEntry->text());
|
||||
textEntry->clear();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue