summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 87dbfaa1..47e39524 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -42,6 +42,7 @@
#include "webview.h"
#include "sessionmanager.h"
#include "homepage.h"
+#include "websnap.h"
// KDE Includes
#include <KUrl>
@@ -621,8 +622,8 @@ void MainView::mouseMoveEvent(QMouseEvent *event)
m_currentTabPreview=tab;
}
- //if current tab then hide previous tab preview
- if (tab==m_tabBar->currentIndex())
+ //if current tab or not found then hide previous tab preview
+ if (tab==m_tabBar->currentIndex() || tab==-1)
{
if ( m_previewPopup)
{
@@ -645,18 +646,6 @@ void MainView::leaveEvent(QEvent *event)
KTabWidget::leaveEvent(event);
}
-QPixmap MainView::renderTabPreview(int tab, int w, int h)
-{
- QPixmap image = QPixmap(webView(tab)->width(), webView(tab)->height());
- image.fill(Qt::transparent);
- QPainter p(&image);
- webView(tab)->page()->mainFrame()->render(&p);
- p.end();
- image = image.scaled(w, h, Qt::KeepAspectRatioByExpanding);
-
- return image;
-}
-
void MainView::showTabPreview(int tab)
{
int w=200;
@@ -669,11 +658,10 @@ void MainView::showTabPreview(int tab)
}
m_previewPopup = new KPassivePopup(this);
- m_previewPopup->setAutoDelete(true);
m_previewPopup->setFrameShape(QFrame::NoFrame);
m_previewPopup->setFixedSize(w, h);
QLabel *l = new QLabel();
- l->setPixmap(renderTabPreview(tab, w, h));
+ l->setPixmap(WebSnap::renderPreview(webView(tab)->page(), w, h));
m_previewPopup->setView(l);
m_previewPopup->layout()->setAlignment(Qt::AlignTop);
m_previewPopup->layout()->setMargin(0);