diff options
author | Yoann Laissus <yoann.laissus@gmail.com> | 2011-09-20 17:55:46 +0200 |
---|---|---|
committer | Yoann Laissus <yoann.laissus@gmail.com> | 2011-09-20 17:55:46 +0200 |
commit | 5ba5ca480db1eb14fa1163ce5ac1640f66125b21 (patch) | |
tree | cbcef92140ac91161531667ae54e743c6d946efc /src | |
parent | QtWebKit 2.2 related fixes (diff) | |
download | rekonq-5ba5ca480db1eb14fa1163ce5ac1640f66125b21.tar.xz |
Fix tab size and addTabButton position when a KMessageWidget appears
REVIEW: 102651
Diffstat (limited to 'src')
-rw-r--r-- | src/mainview.cpp | 16 | ||||
-rw-r--r-- | src/mainview.h | 5 | ||||
-rw-r--r-- | src/tabbar.cpp | 4 |
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) |