mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +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);"
|
"var qz_c2f_nextSibling=this.nextSibling;this.parentNode.removeChild(this);"
|
||||||
"setTimeout(function(){if(qz_c2f_nextSibling){"
|
"setTimeout(function(){if(qz_c2f_nextSibling){"
|
||||||
"qz_c2f_parentNode.insertBefore(qz_c2f_clone,qz_c2f_nextSibling);}"
|
"qz_c2f_parentNode.insertBefore(qz_c2f_clone,qz_c2f_nextSibling);}"
|
||||||
"else{qz_c2f_parentNode.appendChild(qz_c2f_clone);}"
|
"else{qz_c2f_parentNode.appendChild(qz_c2f_clone);}},250);";
|
||||||
"}, 250);";
|
|
||||||
|
|
||||||
m_element.evaluateJavaScript(js);
|
m_element.evaluateJavaScript(js);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <QWebHistory>
|
#include <QWebHistory>
|
||||||
#include <QWebFrame>
|
#include <QWebFrame>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QStyle>
|
||||||
|
|
||||||
WebTab::SavedTab::SavedTab(WebTab* webTab)
|
WebTab::SavedTab::SavedTab(WebTab* webTab)
|
||||||
{
|
{
|
||||||
@ -255,16 +256,15 @@ QPixmap WebTab::renderTabPreview()
|
|||||||
|
|
||||||
const int previewWidth = 230;
|
const int previewWidth = 230;
|
||||||
const int previewHeight = 150;
|
const int previewHeight = 150;
|
||||||
const int verticalScrollBarWidth = page->mainFrame()->scrollBarGeometry(Qt::Vertical).width();
|
const int scrollBarExtent = style()->pixelMetric(QStyle::PM_ScrollBarExtent);
|
||||||
const int horizontalScrollBarWidth = page->mainFrame()->scrollBarGeometry(Qt::Horizontal).height();
|
|
||||||
const int pageWidth = qMin(page->mainFrame()->contentsSize().width(), 1280);
|
const int pageWidth = qMin(page->mainFrame()->contentsSize().width(), 1280);
|
||||||
const int pageHeight = (pageWidth / 23 * 15);
|
const int pageHeight = (pageWidth / 23 * 15);
|
||||||
const qreal scalingFactor = 2 * static_cast<qreal>(previewWidth) / pageWidth;
|
const qreal scalingFactor = 2 * static_cast<qreal>(previewWidth) / pageWidth;
|
||||||
|
|
||||||
page->setViewportSize(QSize(pageWidth, pageHeight));
|
page->setViewportSize(QSize(pageWidth, pageHeight));
|
||||||
|
|
||||||
QPixmap pageImage((2 * previewWidth) - verticalScrollBarWidth, (2 * previewHeight) - horizontalScrollBarWidth);
|
QPixmap pageImage((2 * previewWidth) - scrollBarExtent, (2 * previewHeight) - scrollBarExtent);
|
||||||
pageImage.fill(Qt::red);
|
pageImage.fill(Qt::transparent);
|
||||||
|
|
||||||
QPainter p(&pageImage);
|
QPainter p(&pageImage);
|
||||||
p.scale(scalingFactor, scalingFactor);
|
p.scale(scalingFactor, scalingFactor);
|
||||||
|
Loading…
Reference in New Issue
Block a user