Review Request: Plasma::Webview

0xDeadC0de roguestar191 at comcast.net
Sun Feb 1 12:20:19 CET 2009


I'd like to request that plasma webview become full on QWebViews instead
of QWebPages.

On previous attempts at doing the same thing the QWebView would lose
left click abilities. That does not seem the case with this method
(Would obviously need some testing) but with 4.4.3 I get a normal
QWebView that accepts properly both left and right clicks, creates a
context menu on right clicks, and properly calls "downloadRequested"
when right clicking a link and clicking save link as or an image and
save image..

Proposed:
 changing "QWebPage" to "QWebView" in plasma's webview, then changing
all of Plasma::WebView to use the page() on the webview, and embeddeding
the webview inside a graphics widget as so:

WebView::WebView(QGraphicsItem *parent)
    : QGraphicsWidget(parent),
      d(new WebViewPrivate(this))
{
    d->page = 0;
    d->loaded = false;
    QGraphicsProxyWidget *prox = new QGraphicsProxyWidget(this);

    d->page = new QWebView(NULL);
    d->page->setMouseTracking(true);
    prox->setWidget(d->page);

    setAcceptsHoverEvents(true);
    setFlags(QGraphicsItem::ItemIsFocusable);
}

And the final change is in setGeometry, change to resize(), like so:

void WebView::setGeometry(const QRectF &geometry)
{
    QGraphicsWidget::setGeometry(geometry);
    d->page->resize(geometry.size().toSize());
}





More information about the Plasma-devel mailing list