[Webkit-unassigned] [Bug 51094] New: No way to set focus to GraphicsWebView with Qt Quick (QML) outside of a mouse click.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 14 21:19:22 PST 2010


           Summary: No way to set focus to GraphicsWebView with Qt Quick
                    (QML) outside of a mouse click.
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
               URL: http://developer.qt.nokia.com/forums/viewthread/2394/
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: Major
          Priority: P2
         Component: WebKit Qt
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: getownse at hotmail.com


WebView {
    id: webView
    width: 1280
    height: 600
    url: "http://www.google.com"
    focus: true

WebView will get the focus, but not the underlining GraphicsWebView.  In order for key events to be posted to the GraphicsWebView (and allow for HTML key events to be executed) a user must first click on the WebView to give the GraphicsWebView focus, and then key events will work.  My targetted system does not have a mouse, and makes it impossible for a keyboard to post key input to a website that requires key events WITHOUT having a focus html element such as a input box.

My work around was to make the GraphicsWebView the Focus Proxy by changing the following init method in qdeclarativewebview.cpp:

void QDeclarativeWebView::init()
    d = new QDeclarativeWebViewPrivate(this);


    setFlag(QGraphicsItem::ItemHasNoContents, true);

    d->view = new GraphicsWebView(this);
    QWebPage* wp = new QDeclarativeWebPage(this);

    setFocusProxy(d->view);  /********************** <---- THIS LINE IS THE WORK AROUND **********************/

    connect(d->view, SIGNAL(geometryChanged()), this, SLOT(updateDeclarativeWebViewSize()));
    connect(d->view, SIGNAL(doubleClick(int, int)), this, SIGNAL(doubleClick(int, int)));
    connect(d->view, SIGNAL(scaleChanged()), this, SIGNAL(contentsScaleChanged()));

I attached an example.

You can navigate between the HTML menu and the QML menu using the left and right keys.
You can navigate the QML menu by pressing up and down.
You can NOT navigate the HTML menu by pressing up and down, UNTIL you first click on the HTML menu.  Then you CAN navigate the HTML menu by pressing up and down.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list