Emit currentTitleChanged when we change tab.

To allow the searchBar to follow tab change and adapt itself.
This commit is contained in:
Matthieu Gautier 2018-12-10 16:55:48 +01:00
parent d52dab04ce
commit f45ab71923

View File

@ -2,6 +2,7 @@
#include "kiwixapp.h"
#include <QAction>
#include <QTimer>
#define QUITIFNULL(VIEW) if (nullptr==(VIEW)) { return; }
#define QUITIFNOTCURRENT(VIEW) if((VIEW)!=currentWidget()) {return;}
@ -179,9 +180,11 @@ void TabBar::onCurrentChanged(int index)
emit webActionEnabledChanged(QWebEnginePage::Back, view->isWebActionEnabled(QWebEnginePage::Back));
emit webActionEnabledChanged(QWebEnginePage::Forward, view->isWebActionEnabled(QWebEnginePage::Forward));
KiwixApp::instance()->setSideBar(KiwixApp::NONE);
QTimer::singleShot(0, [=](){emit currentTitleChanged(view->title());});
} else {
emit webActionEnabledChanged(QWebEnginePage::Back, false);
emit webActionEnabledChanged(QWebEnginePage::Forward, false);
KiwixApp::instance()->setSideBar(KiwixApp::CONTENTMANAGER_BAR);
QTimer::singleShot(0, [=](){emit currentTitleChanged("");});
}
}