1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 04:36:34 +01:00

Fixed regression from last commit when page thumbnail could be rendered

with scrollbars.
This commit is contained in:
nowrep 2012-04-12 15:41:28 +02:00
parent a34057d1ea
commit 48b7aed86b
2 changed files with 7 additions and 8 deletions

View File

@ -47,7 +47,7 @@ private:
QPoint m_position;
QWeakPointer<DesktopNotification> m_desktopNotif;
unsigned int m_uint;
quint32 m_uint;
};
#endif // DESKTOPNOTIFICATIONSFACTORY_H

View File

@ -257,15 +257,14 @@ QPixmap WebTab::renderTabPreview()
const int previewHeight = 150;
const int verticalScrollBarWidth = page->mainFrame()->scrollBarGeometry(Qt::Vertical).width();
const int horizontalScrollBarWidth = page->mainFrame()->scrollBarGeometry(Qt::Horizontal).height();
const int pageWidth = qMin(page->mainFrame()->contentsSize().width(), 1280);
const int pageHeight = (pageWidth / 23 * 15);
const qreal scalingFactor = 2 * static_cast<qreal>(previewWidth) / pageWidth;
int renderWidth = qMin(page->mainFrame()->contentsSize().width(), 1280) - verticalScrollBarWidth;
int renderHeight = (renderWidth / 23 * 15) - horizontalScrollBarWidth;
qreal scalingFactor = 2 * static_cast<qreal>(previewWidth) / renderWidth;
page->setViewportSize(QSize(pageWidth, pageHeight));
page->setViewportSize(QSize(renderWidth, renderHeight));
QPixmap pageImage(2 * previewWidth, 2 * previewHeight);
pageImage.fill(Qt::transparent);
QPixmap pageImage((2 * previewWidth) - verticalScrollBarWidth, (2 * previewHeight) - horizontalScrollBarWidth);
pageImage.fill(Qt::red);
QPainter p(&pageImage);
p.scale(scalingFactor, scalingFactor);