From 77dd698df2da11469f9f98ed305fce4c395cf34f Mon Sep 17 00:00:00 2001
From: Edric Milaret <edric.ladent-milaret@savoirfairelinux.com>
Date: Tue, 7 Jul 2015 16:45:41 -0400
Subject: [PATCH] history: fix expand being done too early

Refs #76415

Change-Id: I0912db7f2899f9b4f4a100bec149f075d20c0e6a
---
 callwidget.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/callwidget.cpp b/callwidget.cpp
index ebc52d2..34e2370 100644
--- a/callwidget.cpp
+++ b/callwidget.cpp
@@ -92,9 +92,13 @@ CallWidget::CallWidget(QWidget *parent) :
         ui->historyList->setHeaderHidden(true);
         historyDelegate_ = new HistoryDelegate();
         ui->historyList->setItemDelegate(historyDelegate_);
-        auto idx = CategorizedHistoryModel::SortedProxy::instance()->model()->index(0,0);
-        if (idx.isValid())
-            ui->historyList->setExpanded(idx, true);
+
+        connect(CategorizedHistoryModel::SortedProxy::instance()->model(), &QSortFilterProxyModel::layoutChanged, [=]() {
+            auto idx = CategorizedHistoryModel::SortedProxy::instance()->model()->index(0,0);
+            if (idx.isValid())
+                ui->historyList->setExpanded(idx, true);
+        });
+
 
         ui->sortComboBox->setModel(CategorizedHistoryModel::SortedProxy::instance()->categoryModel());
 
-- 
GitLab