summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainview.cpp16
-rw-r--r--src/mainview.h5
-rw-r--r--src/tabbar.cpp4
3 files changed, 16 insertions, 9 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 716e8dab..89c380de 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -62,6 +62,7 @@ QString temporaryUglyHackString = "";
MainView::MainView(MainWindow *parent)
: KTabWidget(parent)
, m_widgetBar(new StackedUrlBar(this))
+ , m_originalWidthHint(0)
, m_addTabButton(0)
, m_currentTabIndex(0)
, m_parentWindow(parent)
@@ -114,6 +115,7 @@ void MainView::postLaunch()
m_addTabButton->setAutoRaise(true);
m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ m_originalWidthHint = sizeHint().width();
}
@@ -186,13 +188,7 @@ void MainView::updateTabBar()
ButtonInCorner = false;
}
- // detecting X position
- int newPosX = tabBarWidth;
- int tabWidthHint = tabBar()->tabSizeHint(0).width();
- if (tabWidthHint < sizeHint().width() / 4)
- newPosX = tabWidgetWidth - m_addTabButton->width();
-
- m_addTabButton->move(newPosX, 0);
+ m_addTabButton->move(tabBarWidth, 0);
}
}
@@ -332,6 +328,12 @@ WebTab *MainView::newWebTab(bool focused)
}
+int MainView::originalWidthHint() const
+{
+ return m_originalWidthHint;
+}
+
+
void MainView::newTab()
{
WebView *w = newWebTab()->view();
diff --git a/src/mainview.h b/src/mainview.h
index ce17a772..f8aa94b7 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -105,6 +105,8 @@ public:
return m_recentlyClosedTabs;
}
+ int originalWidthHint() const;
+
Q_SIGNALS:
// current tab signals
void currentTitle(const QString &url);
@@ -187,6 +189,9 @@ private:
QString m_loadingGitPath;
+ // The original width hint of the mainview for tabs width
+ int m_originalWidthHint;
+
// the new tab button
QToolButton *m_addTabButton;
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 2c28573f..172d98ee 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -98,8 +98,8 @@ QSize TabBar::tabSizeHint(int index) const
int buttonSize = view->addTabButton()->size().width();
int tabBarWidth = view->size().width() - buttonSize;
- int baseWidth = view->sizeHint().width() / baseWidthDivisor;
- int minWidth = view->sizeHint().width() / minWidthDivisor;
+ int baseWidth = view->originalWidthHint() / baseWidthDivisor;
+ int minWidth = view->originalWidthHint() / minWidthDivisor;
int w;
if (baseWidth * count() < tabBarWidth)