From bb03a402d7a6a1a93d3c6b809126dcc37c95fbb3 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Thu, 13 Apr 2017 04:32:18 +0300 Subject: [PATCH] Add proper struct initialization --- include/HistoryView.h | 8 ++++++++ src/HistoryView.cc | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/HistoryView.h b/include/HistoryView.h index ba267ad4..09f8bdce 100644 --- a/include/HistoryView.h +++ b/include/HistoryView.h @@ -34,6 +34,14 @@ struct PendingMessage { QString body; QString event_id; HistoryViewItem *widget; + + PendingMessage(int txn_id, QString body, QString event_id, HistoryViewItem *widget) + : txn_id(txn_id) + , body(body) + , event_id(event_id) + , widget(widget) + { + } }; class HistoryView : public QWidget diff --git a/src/HistoryView.cc b/src/HistoryView.cc index f1e19aec..374fe133 100644 --- a/src/HistoryView.cc +++ b/src/HistoryView.cc @@ -174,10 +174,7 @@ void HistoryView::addUserTextMessage(const QString &body, int txn_id) last_sender_ = user_id; - PendingMessage message = {}; - message.txn_id = txn_id; - message.body = body; - message.widget = view_item; + PendingMessage message(txn_id, body, "", view_item); pending_msgs_.push_back(message); }