diff --git a/src/widgets/chatwidget.cpp b/src/widgets/chatwidget.cpp index 138c54cf6..e85b80194 100644 --- a/src/widgets/chatwidget.cpp +++ b/src/widgets/chatwidget.cpp @@ -112,8 +112,7 @@ void ChatWidget::setChannelName(const QString &_newChannelName) this->header.updateChannelText(); // update view - this->view.layoutMessages(); - this->view.update(); + this->layoutMessages(true); } void ChatWidget::setChannel(std::shared_ptr _newChannel) @@ -177,9 +176,9 @@ void ChatWidget::showChangeChannelPopup() } } -void ChatWidget::layoutMessages() +void ChatWidget::layoutMessages(bool forceUpdate) { - if (this->view.layoutMessages()) { + if (this->view.layoutMessages() || forceUpdate) { this->view.update(); } } @@ -249,7 +248,11 @@ void ChatWidget::doPopup() void ChatWidget::doClearChat() { - qDebug() << "[UNIMPLEMENTED] Clear chat"; + // Clear all stored messages in this chat widget + this->messages.clear(); + + // Layout chat widget messages, and force an update regardless if there are no messages + this->layoutMessages(true); } void ChatWidget::doOpenChannel() diff --git a/src/widgets/chatwidget.hpp b/src/widgets/chatwidget.hpp index 250d7ab04..b9dcd5291 100644 --- a/src/widgets/chatwidget.hpp +++ b/src/widgets/chatwidget.hpp @@ -51,7 +51,7 @@ public: void showChangeChannelPopup(); messages::LimitedQueueSnapshot getMessagesSnapshot(); - void layoutMessages(); + void layoutMessages(bool forceUpdate = false); void updateGifEmotes(); void giveFocus();