1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

WebTab: Add makeCurrentTab and closeTab methods

This commit is contained in:
David Rosca 2018-02-01 20:25:57 +01:00
parent 349f6b9c32
commit 29735b24c8
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 16 additions and 0 deletions

View File

@ -628,6 +628,20 @@ bool WebTab::isCurrentTab() const
return m_isCurrentTab; return m_isCurrentTab;
} }
void WebTab::makeCurrentTab()
{
if (m_tabBar) {
m_tabBar->tabWidget()->setCurrentIndex(tabIndex());
}
}
void WebTab::closeTab()
{
if (m_tabBar) {
m_tabBar->tabWidget()->closeTab(tabIndex());
}
}
int WebTab::tabIndex() const int WebTab::tabIndex() const
{ {
return m_tabBar ? m_tabBar->tabWidget()->indexOf(const_cast<WebTab*>(this)) : -1; return m_tabBar ? m_tabBar->tabWidget()->indexOf(const_cast<WebTab*>(this)) : -1;

View File

@ -100,6 +100,8 @@ public:
int tabIndex() const; int tabIndex() const;
bool isCurrentTab() const; bool isCurrentTab() const;
void makeCurrentTab();
void closeTab();
bool haveInspector() const; bool haveInspector() const;
void showWebInspector(bool inspectElement = false); void showWebInspector(bool inspectElement = false);