diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-04-29 12:41:39 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-04-29 12:41:39 +0200 |
commit | 1ef712920d762f9f88393caf1018bd8708c02424 (patch) | |
tree | 56107fd4b2f222b91d321c09dc20a65a8d3f4487 /src | |
parent | Right icon button fix (diff) | |
download | rekonq-1ef712920d762f9f88393caf1018bd8708c02424.tar.xz |
Fixing tab switch behavior.
It seems webkit removed an update on setViewPortSize, letting
our trick about setScrollBarPolicy dangerous (no scrollbar on rendered
pages)
Diffstat (limited to 'src')
-rw-r--r-- | src/tabbar.cpp | 24 | ||||
-rw-r--r-- | src/tabbar.h | 4 | ||||
-rw-r--r-- | src/websnap.cpp | 12 |
3 files changed, 25 insertions, 15 deletions
diff --git a/src/tabbar.cpp b/src/tabbar.cpp index a2f269c4..7e10a196 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -197,25 +197,31 @@ void TabBar::mouseMoveEvent(QMouseEvent *event) { //Find the tab under the mouse int i = 0; - int tab = -1; - while (i<count() && tab==-1) + int tabIndex = -1; + while ( i<count() + && tabIndex == -1 + ) { if (tabRect(i).contains(event->pos())) { - tab = i; + tabIndex = i; } i++; } - //if found and not the current tab then show tab preview - if (tab != -1 && tab != currentIndex() && m_currentTabPreview != tab && event->buttons() == Qt::NoButton) + // if found and not the current tab then show tab preview + if ( tabIndex != -1 + && tabIndex != currentIndex() + && m_currentTabPreview != tabIndex + && event->buttons() == Qt::NoButton + ) { - showTabPreview(tab); - m_currentTabPreview = tab; + showTabPreview(tabIndex); + m_currentTabPreview = tabIndex; } - //if current tab or not found then hide previous tab preview - if (tab==currentIndex() || tab==-1) + // if current tab or not found then hide previous tab preview + if (tabIndex == currentIndex() || tabIndex == -1) { if ( !m_previewPopup.isNull() ) { diff --git a/src/tabbar.h b/src/tabbar.h index 97c320fc..fd325b66 100644 --- a/src/tabbar.h +++ b/src/tabbar.h @@ -61,8 +61,6 @@ public: TabBar(QWidget *parent); ~TabBar(); - void showTabPreview(int tab); - signals: void cloneTab(int index); void closeTab(int index); @@ -94,6 +92,8 @@ private slots: void emptyAreaContextMenu(const QPoint &); private: + void showTabPreview(int tab); + friend class MainView; /** diff --git a/src/websnap.cpp b/src/websnap.cpp index 6be7314e..af52b592 100644 --- a/src/websnap.cpp +++ b/src/websnap.cpp @@ -72,10 +72,14 @@ void WebSnap::load() // You are playing with fire.. QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h) { + // NOTE + // it seems no way to enable/disable scrollbars in new QtWebKit's + // and this is affecting tabbed browsing + // prepare page - page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); - page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); QSize oldSize = page.viewportSize(); +// page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); +// page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); // find the best size QSize size; @@ -98,8 +102,8 @@ QPixmap WebSnap::renderPreview(const QWebPage &page, int w, int h) pageImage = pageImage.scaled(w, h, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); // restore page settings - page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded); - page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded); +// page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded); +// page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded); page.setViewportSize(oldSize); QPixmap pm = QPixmap::fromImage(pageImage); |