Developments in The Qt WebKit Integration

Post on 12-May-2015

1.626 views 1 download

Tags:

description

The Qt WebKit Integration provides a powerful framework to seamlessly integrate web technologies into applications, where web content can interact with Qt components. This presentation introduces the QtWebKit APIs, the underlying engine and new features coming in future releases. Presentation by Kenneth Christiansen held during Qt Developer Days 2009. http://qt.nokia.com/developer/learning/elearning

Transcript of Developments in The Qt WebKit Integration

�������������� ����������������

������������������������������������ ��������

������������������

���������������� ���� ��

����������������������������������� ���������!��"��

������#�������

$��������� ����������

������ ������%

���������������������������������������

������

������&���������������������

������������������������������

�������������������������� �'()

����� �������������������

�����������

�������������������������*�������������

����������������+

�������������������������������

����������������

�����

�����

�����

,�����

-���&.�����

�����

$���

#�/

�������������0�����$�������

$�������������������1

������������ ��$���� �������-)2

�����������������1

�����,������0����� �������-�����

3������-�������0�������

��������������������������

������������������������������������������������

�������4���������������

����� �,��5����� �,������0����� ��������(((

/�������������������������

����������������

����6������7�������������������1

� ���0���

� 8���-����0����9�������:

!�������������

���0�������������������������������������

�����������

��4���������

$������*���������

;�������$�����

��(((

!�����������������������

����������������������������������

���0��������� �������1

� ����������/��������������������������

� $������������������

� $�����&�����������������3�/;<������*=����

��� ������������(((

���������������������������������������

�������� &����$�

�������������������������������������������

��� ������������(((

�����$���������������� &������������������>�

�$� ��������$��������������������������� �

����� ����������(

������� �����������������������������������������������>

������������������������ ��������

#����������������������

�������������������� >���������������%

�������>������������� �������������������

������������������������ ������������������

������������

��4&,���-�������-�����

� #������������4��������

� 3�/;<

� ������������

� #������������4��������

�����?�0�������

� -�����������������

� ���0-- �8���-���� �@/;�����-=,�����������

� �����������������������������

� ����������������� ���(((

0--��������������.����

� A��� ������� ����

� 8���-����������

� 0--�?�����A��

� ;���������������

3�/;�0����

� $�������������������8���-����

� /��������

� 3��������?��������B���������9���,;:�

� /���������

8���-����������

� -�������C

� -���������������

� 8��������

��

3�/;<�/����������

� #���D�������3�/;<�����

� ����������������$�����

� A�������������

� ����������������1&9

��

$�����������

� .����� ������������

� �������$�����������

� A���������

��

-=,�E(E

� A� ����������-��������=�����,������������

� !�������� �-��

� -���������������������������(

��

��

������������������� ���� ��!"#

$�������������������� ��!"#

��

;�����������(((

��!"#����������������������������������������

�������������������������%&'()�����������������

�������������!�����*��������+�

��

����������

������������������������������������

6�$����������������������������������� �

�������������������������������������7�

;���&����� ��������&����� ���������&����������������(

��

-����������;������

;����������� �������������&�����

����������+�

-���������������.4��������

A����8���-����

������'��)������,�8��

A��8���-��������������������C

�#/��<�8��������������������������'

.4����������3�/;<5����,���

� �����&�����3�/;�����*�����

� -����*����������� ����������������

� .��*����������

� =������������ ������&����������

��������������������������3������@F; �/�"�������������������(

��

����������������� ��������������-

��

���������+������������ �����������

��������� ���.� ���������� ���������

����������������� ������������������

����.����������������� �������� ���/$

��

G��������������H��

��������������������������

0���+� ����1�� �������������1�� �-

��

$�������������� ���2��+���

3���������� �������+����������������40'����+�55

��

�������������� ���.�����

� .�����������������G/������������

� B �����������$�

� 8��������������� ����������������

� #������������&����������������G/�

������

��

0--�-������

QWebElement document = frame->documentElement();

/* Assume the document has the following structure:

<p class=intro>

<span>Intro</span>

<span>Snippets</span>

</p>

<p>

<span>Content</span>

<span>Here</span>

</p>

*/

QList<QWebElement> allSpans = document.findAll("span");

QList<QWebElement> introSpans = document.findAll("p.intro span");

��

.����������

��

frame->setHtml("<html><body><p>First Paragraph</p><p>Second Paragraph</p></body></html>");

QWebElement doc = frame->documentElement();

QWebElement body = doc.firstChild();

QWebElement firstParagraph = body.firstChild();

QWebElement secondParagraph = firstParagraph.nextSibling();

���������$�����

-�������������������A���(

#��� ��������������

$����������������

-����

�&�� ������ ����-

�����$����&�������������������8���-����0���

���-�������� -������4�����������8���-�����

���/�������������������

������������������������ ������������F�������

����������������������������� ����������� ��!")

-�������-�����)2������

!�������� �������������������������������

.4��������������� ����������

0����������#6� ����������� ��!"#������

��

A��4������ ���������������

�����������������4����

����������������������������� �����

������������������������"�����������������

����������������

������������������������� ����������

��

#�������������������������

>������������*������ �7���

� �����������������������

� 0���������

� �������������������

� ������� ��������������F������� ��������������

���,�������=���(

��

������������������

.���������������C�((((

����������"""������������������� ��������

��

,�������=�������������

�����������>��������������������������

���������,�������=���(

��������.����� ����������������� ������

�����������

��

&����� ������������������� �-

$�������������� *������ ���7���

��

�������������� ,���������=���

� ��������&������������������ ���=���

� �� ,���������������������������

� -��������$���� ���=��� ���������������

���������������,���������������

�����������

��

�������������� ,���������=���

����������������������"����

� ����������������������������

� 0������������� �����������������

� F�������������������������6!���������7 �

��������4���� ���������������������

��

�������������� ,���������=���

����������������������������������

��������������������������������

80����������+������������������������+��9�:�;

��������

0������+.��������� ������������ -

����B�����������������������������������������(

����4�������� ������������������������

(��< � ��������� ��������������������������-

��

/������������C

��������������������������������������

�������������� �������������������������

������������������������(

&�� ��� ���������� ��������+������=� ��������� ������.�

���� .����"

��

�����������

���������������������������������������

�����������G/��������������

������������������� ����������������������� ����������+�

55"�$���������� ��� ��� ���������� ��� ���+������

��

3�/;<

� �����$���������������������3�/;<���������

������������������

� -�������������������������������������

� ���������������������������

��

/��������

� �$������������������������������

� -������������������� -������������������

� ,�����F#;���������H���������������

� 0�������������������������������

� /������4������������������������������

��

������� �����������������>

��

������������������������

� ;������������������������������

� 3�/;<�������������������"��

� ���������������������,;

��

�'(I���������������������

� -������������������

� /���������������,�������=�������������

� -���������������

� �����������-�����

� 0������������������������������

��

�������������������������

%���������������

� �#0���������?1������������������

� !������������������@AA��� "������"���

� ��������������������������������C

��

&$'2�30��

B2�&$0��

&$'2�30��

B2�&$0��>