Add Headermemo, work in Progress
This commit is contained in:
@@ -983,6 +983,54 @@ void MainWindow::setupTransactionsTab() {
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::setupchatTab() {
|
||||
|
||||
// Send button
|
||||
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton);
|
||||
|
||||
}
|
||||
|
||||
ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) {
|
||||
QObject::connect(this, &QPlainTextEdit::textChanged, this, &ChatMemoEdit::updateDisplay);
|
||||
}
|
||||
|
||||
void ChatMemoEdit::updateDisplay() {
|
||||
QString txt = this->toPlainText();
|
||||
if (lenDisplayLabel)
|
||||
lenDisplayLabel->setText(QString::number(txt.toUtf8().size()) + "/" + QString::number(maxlen));
|
||||
|
||||
if (txt.toUtf8().size() <= maxlen) {
|
||||
// Everything is fine
|
||||
if (sendChatButton)
|
||||
sendChatButton->setEnabled(true);
|
||||
|
||||
if (lenDisplayLabel)
|
||||
lenDisplayLabel->setStyleSheet("");
|
||||
}
|
||||
else {
|
||||
// Overweight
|
||||
if (sendChatButton)
|
||||
sendChatButton->setEnabled(false);
|
||||
|
||||
if (lenDisplayLabel)
|
||||
lenDisplayLabel->setStyleSheet("color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
void ChatMemoEdit::setMaxLen(int len) {
|
||||
this->maxlen = len;
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
void ChatMemoEdit::setLenDisplayLabel(QLabel* label_40) {
|
||||
this->lenDisplayLabel = label_40;
|
||||
}
|
||||
|
||||
void ChatMemoEdit::setSendChatButton(QPushButton* button) {
|
||||
this->sendChatButton = button;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateChat()
|
||||
{
|
||||
qDebug() << "Called MainWindow::updateChat()";
|
||||
|
||||
Reference in New Issue
Block a user