[Webkit-unassigned] [Bug 30773] New: [Qt] QWebInspector: improve QWebPage::webInspectorTriggered(QWebElement&) -> QWebInspector::show() connection

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 26 06:22:06 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=30773

           Summary: [Qt] QWebInspector: improve
                    QWebPage::webInspectorTriggered(QWebElement&) ->
                    QWebInspector::show() connection
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: Qt
          Severity: Enhancement
          Priority: P2
         Component: WebKit Qt
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: jocelyn.turcotte at nokia.com
            Blocks: 29843


== Currently the way to connect an instantiated QWebInspector to a QWebPage
context menu event is:
// ...
QWebPage *page = new QWebPage;
// ...

QWebInspector *inspector = new QWebInspector;
inspector->setPage(page);

connect(page, SIGNAL(webInspectorTriggered(const QWebElement&)), inspector,
SLOT(show()));


== A way to lazily create the inspector on the first context menu event:
void UserClass::initialize() {
    // ...
    m_page = new QWebPage;
    // ...

    connect(page, SIGNAL(webInspectorTriggered(const QWebElement&)),
userObject, SLOT(createAndShowInspector()));
}

void UserClass::createAndShowInspector() {
    if (!m_inspector) {
        m_inspector = new QWebInspector;
        m_inspector->setPage(m_page);
    }
    m_inspector->show();
}


== The problem is that the actual "set inspected element" is happening
magically after the webInspectorTriggered signal has been emitted.
== So it might be cool to expose this behavior in the api.
== Two possible ways:
= 1. Add a setInspectedElement property setter
= Maybe we will add the getter in later versions, but this would require
additional API in WebKit's web inspector.
= Also, what is actually the current inspectedElement is not totally obvious
neither.
// ...
QWebPage *page = new QWebPage;
// ...

QWebInspector *inspector = new QWebInspector;
inspector->setPage(page);

connect(page, SIGNAL(webInspectorTriggered(const QWebElement&)), inspector,
SLOT(show()));
connect(page, SIGNAL(webInspectorTriggered(const QWebElement&)), inspector,
SLOT(setInspectedElement(const QWebElement&)));

= 2. Add a showElement(QWebElement&) slot
= Good thing: simple
= Bad thing: The showElement slot however has two responsibilities
= This might cause problem for a user that might call this method just to set
the inspected element since show() will be called each time.
// ...
QWebPage *page = new QWebPage;
// ...

QWebInspector *inspector = new QWebInspector;
inspector->setPage(page);

connect(page, SIGNAL(webInspectorTriggered(const QWebElement&)), inspector,
SLOT(showElement(const QWebElement&)));

-- 
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