summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-29 12:41:39 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-29 12:41:39 +0200
commit1ef712920d762f9f88393caf1018bd8708c02424 (patch)
tree56107fd4b2f222b91d321c09dc20a65a8d3f4487
parentRight icon button fix (diff)
downloadrekonq-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)
-rw-r--r--src/tabbar.cpp24
-rw-r--r--src/tabbar.h4
-rw-r--r--src/websnap.cpp12
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);