summaryrefslogtreecommitdiff
path: root/src/tabbar/tabbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabbar/tabbar.cpp')
-rw-r--r--src/tabbar/tabbar.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/tabbar/tabbar.cpp b/src/tabbar/tabbar.cpp
index 849dfbc1..4cd39550 100644
--- a/src/tabbar/tabbar.cpp
+++ b/src/tabbar/tabbar.cpp
@@ -22,23 +22,8 @@ TabBar::TabBar(QWidget *parent) : QTabBar(parent)
setMovable(true);
setAcceptDrops(true);
- connect(this, &QTabBar::currentChanged, this, [this](int index) {
- if (index == -1) {
- emit currentChanged(nullptr);
- return;
- }
- auto view = m_views.at(index);
- Q_ASSERT(!view.isNull());
- emit currentChanged(view);
- });
connect(this, &QTabBar::tabMoved, this, [this](int from, int to) { m_views.move(from, to); });
- connect(this, &QTabBar::tabCloseRequested, this, [this](int index) {
- removeTab(index);
- emit removeView(m_views.at(index));
- m_views.removeAt(index);
- });
-
/*
// context menu(s)
setContextMenuPolicy(Qt::CustomContextMenu);
@@ -62,10 +47,23 @@ int TabBar::addTab(RekonqView *view)
const int index = m_views.indexOf(view);
setTabText(index, title);
});
+ connect(view, &RekonqView::iconChanged, this, [this, view](const QIcon &icon) {
+ const int index = m_views.indexOf(view);
+ setTabIcon(index, icon);
+ });
return id;
}
+RekonqView *TabBar::removeTab(int index)
+{
+ RekonqView *view = m_views.at(index);
+ m_views.removeAt(index);
+ QTabBar::removeTab(index);
+
+ return view;
+}
+
// ------------------------------------------------------------------------------------
QSize TabBar::tabSizeHint(int index) const