mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Ensuring tab previews are painted without scrollbars.
- it finally works now
This commit is contained in:
parent
82bd695d3a
commit
8e76ba5a47
@ -267,8 +267,7 @@ void ClickToFlash::load()
|
||||
"var qz_c2f_nextSibling=this.nextSibling;this.parentNode.removeChild(this);"
|
||||
"setTimeout(function(){if(qz_c2f_nextSibling){"
|
||||
"qz_c2f_parentNode.insertBefore(qz_c2f_clone,qz_c2f_nextSibling);}"
|
||||
"else{qz_c2f_parentNode.appendChild(qz_c2f_clone);}"
|
||||
"}, 250);";
|
||||
"else{qz_c2f_parentNode.appendChild(qz_c2f_clone);}},250);";
|
||||
|
||||
m_element.evaluateJavaScript(js);
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <QWebHistory>
|
||||
#include <QWebFrame>
|
||||
#include <QLabel>
|
||||
#include <QStyle>
|
||||
|
||||
WebTab::SavedTab::SavedTab(WebTab* webTab)
|
||||
{
|
||||
@ -255,16 +256,15 @@ QPixmap WebTab::renderTabPreview()
|
||||
|
||||
const int previewWidth = 230;
|
||||
const int previewHeight = 150;
|
||||
const int verticalScrollBarWidth = page->mainFrame()->scrollBarGeometry(Qt::Vertical).width();
|
||||
const int horizontalScrollBarWidth = page->mainFrame()->scrollBarGeometry(Qt::Horizontal).height();
|
||||
const int scrollBarExtent = style()->pixelMetric(QStyle::PM_ScrollBarExtent);
|
||||
const int pageWidth = qMin(page->mainFrame()->contentsSize().width(), 1280);
|
||||
const int pageHeight = (pageWidth / 23 * 15);
|
||||
const qreal scalingFactor = 2 * static_cast<qreal>(previewWidth) / pageWidth;
|
||||
|
||||
page->setViewportSize(QSize(pageWidth, pageHeight));
|
||||
|
||||
QPixmap pageImage((2 * previewWidth) - verticalScrollBarWidth, (2 * previewHeight) - horizontalScrollBarWidth);
|
||||
pageImage.fill(Qt::red);
|
||||
QPixmap pageImage((2 * previewWidth) - scrollBarExtent, (2 * previewHeight) - scrollBarExtent);
|
||||
pageImage.fill(Qt::transparent);
|
||||
|
||||
QPainter p(&pageImage);
|
||||
p.scale(scalingFactor, scalingFactor);
|
||||
|
Loading…
Reference in New Issue
Block a user