From ef3412789cee141bbd929e062959784332ba6434 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 29 Jan 2012 11:18:47 +0100 Subject: Restore scrollbars when using websnap features BUG:288957 --- src/previewselectorbar.cpp | 3 +-- src/previewselectorbar.h | 2 +- src/websnap.cpp | 9 +++++++-- src/websnap.h | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/previewselectorbar.cpp b/src/previewselectorbar.cpp index 8eecffb9..d72e9eb1 100644 --- a/src/previewselectorbar.cpp +++ b/src/previewselectorbar.cpp @@ -3,7 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2010 by Matthieu Gicquel -* Copyright (C) 2010-2011 by Andrea Diamantini +* Copyright (C) 2010-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or @@ -114,7 +114,6 @@ void PreviewSelectorBar::clicked() //cleanup the previous image from the cache (useful to refresh the snapshot) QFile::remove(WebSnap::imagePathFromUrl(urls.at(m_previewIndex))); - page->mainFrame()->setScrollBarValue(Qt::Vertical, 0); QPixmap preview = WebSnap::renderPagePreview(*page); preview.save(WebSnap::imagePathFromUrl(url)); diff --git a/src/previewselectorbar.h b/src/previewselectorbar.h index 3be750b2..fa54303d 100644 --- a/src/previewselectorbar.h +++ b/src/previewselectorbar.h @@ -3,7 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2010 by Matthieu Gicquel -* Copyright (C) 2010-2011 by Andrea Diamantini +* Copyright (C) 2010-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or diff --git a/src/websnap.cpp b/src/websnap.cpp index 3344ded8..6bbaa06a 100644 --- a/src/websnap.cpp +++ b/src/websnap.cpp @@ -3,7 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2009 Nokia Corporation -* Copyright (C) 2009-2011 by Andrea Diamantini +* Copyright (C) 2009-2012 by Andrea Diamantini * Copyright (C) 2010 by Matthieu Gicquel * * @@ -117,8 +117,10 @@ QPixmap WebSnap::renderClosingPagePreview(const QWebPage &page, int w, int h) QPixmap WebSnap::renderPagePreview(const QWebPage &page, int w, int h) { - //prepare page + // remove temporarily scrollbars page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); + + // prepare page int width = page.mainFrame()->contentsSize().width(); page.setViewportSize(QSize(width, width * ((0.0 + h) / w))); @@ -128,6 +130,9 @@ QPixmap WebSnap::renderPagePreview(const QWebPage &page, int w, int h) // resize image pageImage = pageImage.scaled(w, h, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); + // restore scrollbars + page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded); + return pageImage; } diff --git a/src/websnap.h b/src/websnap.h index 37cdc618..f227f083 100644 --- a/src/websnap.h +++ b/src/websnap.h @@ -3,7 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2009 Nokia Corporation -* Copyright (C) 2009-2011 by Andrea Diamantini +* Copyright (C) 2009-2012 by Andrea Diamantini * Copyright (C) 2010 by Matthieu Gicquel * * -- cgit v1.2.1