expose the zoomFactor property.

accept touch events

svn path=/trunk/KDE/kdelibs/; revision=1050596
This commit is contained in:
Marco Martin 2009-11-17 17:57:54 +00:00
parent 862fb4cb70
commit 2bfcef80ab
2 changed files with 34 additions and 0 deletions

View File

@ -69,6 +69,7 @@ WebView::WebView(QGraphicsItem *parent)
{
d->page = 0;
d->loaded = false;
setAcceptTouchEvents(true);
Plasma::Animator::self()->registerScrollingManager(this);
setAcceptsHoverEvents(true);
setFlags(QGraphicsItem::ItemIsFocusable);
@ -166,6 +167,24 @@ QRectF WebView::viewportGeometry() const
}
}
qreal WebView::zoomFactor() const
{
if (!d->page) {
return 1;
} else {
return d->page->mainFrame()->zoomFactor();
}
}
void WebView::setZoomFactor(const qreal zoom)
{
if (!d->page) {
return;
} else {
d->page->mainFrame()->setZoomFactor(zoom);
}
}
void WebView::setPage(QWebPage *page)
{

View File

@ -53,6 +53,7 @@ class PLASMA_EXPORT WebView : public QGraphicsWidget
Q_PROPERTY(QPointF scrollPosition READ scrollPosition WRITE setScrollPosition)
Q_PROPERTY(QSizeF contentsSize READ contentsSize)
Q_PROPERTY(QRectF viewportGeometry READ viewportGeometry)
Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
public:
explicit WebView(QGraphicsItem *parent = 0);
@ -122,6 +123,20 @@ class PLASMA_EXPORT WebView : public QGraphicsWidget
*/
QRectF viewportGeometry() const;
/**
* The zoom factor of the page
*
* @since 4.4
*/
qreal zoomFactor() const;
/**
* Sets the zoom factor of the page
*
* @since 4.4
*/
void setZoomFactor(const qreal zoom);
/**
* Sets the page to use in this item. The owner of the webpage remains,
* however if this WebView object is the owner of the current page,