diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tabpreviewpopup.cpp | 4 | ||||
-rw-r--r-- | src/webtab.cpp | 11 | ||||
-rw-r--r-- | src/webtab.h | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/src/tabpreviewpopup.cpp b/src/tabpreviewpopup.cpp index 821c033c..52c06cfb 100644 --- a/src/tabpreviewpopup.cpp +++ b/src/tabpreviewpopup.cpp @@ -98,7 +98,9 @@ TabPreviewPopup::~TabPreviewPopup() void TabPreviewPopup::setWebTab(WebTab* tab) { - const QPixmap preview = tab->tabPreview(); + int w = (tab->parentWidget()->sizeHint().width() / TabBar::baseWidthDivisor); + int h = w * rApp->mainWindow()->size().height() / rApp->mainWindow()->size().width(); + const QPixmap preview = tab->tabPreview(w, h); if (!preview.isNull()) { diff --git a/src/webtab.cpp b/src/webtab.cpp index c91c3a20..1519d833 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -36,14 +36,12 @@ #include "application.h" #include "historymanager.h" #include "messagebar.h" -#include "mainwindow.h" #include "opensearchmanager.h" #include "previewselectorbar.h" #include "rsswidget.h" #include "searchenginebar.h" #include "sessionmanager.h" #include "syncmanager.h" -#include "tabbar.h" #include "urlbar.h" #include "walletbar.h" #include "webpage.h" @@ -368,7 +366,7 @@ bool WebTab::hasAdBlockedElements() } -QPixmap WebTab::tabPreview() +QPixmap WebTab::tabPreview(int width, int height) { if (isPageLoading()) { @@ -376,12 +374,9 @@ QPixmap WebTab::tabPreview() return QPixmap(); } - int w = (parentWidget()->sizeHint().width() / TabBar::baseWidthDivisor); - int h = w * rApp->mainWindow()->size().height() / rApp->mainWindow()->size().width(); - if (!part()) { - return WebSnap::renderPagePreview(*page(), w, h); + return WebSnap::renderPagePreview(*page(), width, height); } else { @@ -390,7 +385,7 @@ QPixmap WebTab::tabPreview() partWidget->render(&partThumb); - return partThumb.scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + return partThumb.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } } diff --git a/src/webtab.h b/src/webtab.h index c318da10..e9805846 100644 --- a/src/webtab.h +++ b/src/webtab.h @@ -92,7 +92,7 @@ public: bool hasAdBlockedElements(); - QPixmap tabPreview(); + QPixmap tabPreview(int width, int height); private Q_SLOTS: void updateProgress(int progress); |