/usr/share/qt5/doc/qtwebkit/qwebelement.html is in qtwebkit5-doc-html 5.212.0~alpha2-7ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qwebelement.cpp -->
<title>QWebElement Class | Qt 5.212.0</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
// loading style sheet breaks anchors that were jumped to before
// so force jumping to anchor again
setTimeout(function() {
var anchor = location.hash;
// need to jump to different anchor first (e.g. none)
location.hash = "#";
setTimeout(function() {
location.hash = anchor;
}, 0);
}, 0);
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td >Qt 5.212.0</td><td >QWebElement</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.212.0 Reference Documentation</td>
</tr></table>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#examples">Examples</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QWebElement Class</h1>
<!-- $$$QWebElement-brief -->
<p>The <a href="qtwebkit-bridge.html#qwebelement">QWebElement</a> class provides convenient access to DOM elements in a <a href="qwebframe.html">QWebFrame</a>. <a href="#details">More...</a></p>
<!-- @@@QWebElement -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QWebElement></span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += webkitwidgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.6</td></tr></table></div><ul>
<li><a href="qwebelement-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#StyleResolveStrategy-enum">StyleResolveStrategy</a></b> { InlineStyle, CascadedStyle, ComputedStyle }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#QWebElement">QWebElement</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#QWebElement-1">QWebElement</a></b>(const QWebElement &<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#dtor.QWebElement">~QWebElement</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#addClass">addClass</a></b>(const QString &<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#appendInside">appendInside</a></b>(const QString &<i>markup</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#appendInside-1">appendInside</a></b>(const QWebElement &<i>element</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#appendOutside">appendOutside</a></b>(const QString &<i>markup</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#appendOutside-1">appendOutside</a></b>(const QWebElement &<i>element</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#attribute">attribute</a></b>(const QString &<i>name</i>, const QString &<i>defaultValue</i> = QString()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#attributeNS">attributeNS</a></b>(const QString &<i>namespaceUri</i>, const QString &<i>name</i>, const QString &<i>defaultValue</i> = QString()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#attributeNames">attributeNames</a></b>(const QString &<i>namespaceUri</i> = QString()) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#classes">classes</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#clone">clone</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#document">document</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#encloseContentsWith">encloseContentsWith</a></b>(const QWebElement &<i>element</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#encloseContentsWith-1">encloseContentsWith</a></b>(const QString &<i>markup</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#encloseWith">encloseWith</a></b>(const QString &<i>markup</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#encloseWith-1">encloseWith</a></b>(const QWebElement &<i>element</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#evaluateJavaScript">evaluateJavaScript</a></b>(const QString &<i>scriptSource</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElementCollection </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#findAll">findAll</a></b>(const QString &<i>selectorQuery</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#findFirst">findFirst</a></b>(const QString &<i>selectorQuery</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#firstChild">firstChild</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#geometry">geometry</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#hasAttribute">hasAttribute</a></b>(const QString &<i>name</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#hasAttributeNS">hasAttributeNS</a></b>(const QString &<i>namespaceUri</i>, const QString &<i>name</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#hasAttributes">hasAttributes</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#hasClass">hasClass</a></b>(const QString &<i>name</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#hasFocus">hasFocus</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#isNull">isNull</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#lastChild">lastChild</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#localName">localName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#namespaceUri">namespaceUri</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#nextSibling">nextSibling</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#parent">parent</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#prefix">prefix</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#prependInside">prependInside</a></b>(const QString &<i>markup</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#prependInside-1">prependInside</a></b>(const QWebElement &<i>element</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#prependOutside">prependOutside</a></b>(const QString &<i>markup</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#prependOutside-1">prependOutside</a></b>(const QWebElement &<i>element</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#previousSibling">previousSibling</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#removeAllChildren">removeAllChildren</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#removeAttribute">removeAttribute</a></b>(const QString &<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#removeAttributeNS">removeAttributeNS</a></b>(const QString &<i>namespaceUri</i>, const QString &<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#removeClass">removeClass</a></b>(const QString &<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#removeFromDocument">removeFromDocument</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#render">render</a></b>(QPainter *<i>painter</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#render-1">render</a></b>(QPainter *<i>painter</i>, const QRect &<i>clip</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#replace">replace</a></b>(const QString &<i>markup</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#replace-1">replace</a></b>(const QWebElement &<i>element</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#setAttribute">setAttribute</a></b>(const QString &<i>name</i>, const QString &<i>value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#setAttributeNS">setAttributeNS</a></b>(const QString &<i>namespaceUri</i>, const QString &<i>name</i>, const QString &<i>value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#setFocus">setFocus</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#setInnerXml">setInnerXml</a></b>(const QString &<i>markup</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#setOuterXml">setOuterXml</a></b>(const QString &<i>markup</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#setPlainText">setPlainText</a></b>(const QString &<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#setStyleProperty">setStyleProperty</a></b>(const QString &<i>name</i>, const QString &<i>value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#styleProperty">styleProperty</a></b>(const QString &<i>name</i>, StyleResolveStrategy <i>strategy</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#tagName">tagName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement &</td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#takeFromDocument">takeFromDocument</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#toInnerXml">toInnerXml</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#toOuterXml">toOuterXml</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#toPlainText">toPlainText</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#toggleClass">toggleClass</a></b>(const QString &<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebFrame *</td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#webFrame">webFrame</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#operator-not-eq">operator!=</a></b>(const QWebElement &<i>o</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QWebElement &</td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#operator-eq">operator=</a></b>(const QWebElement &<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qwebelement.html#operator-eq-eq">operator==</a></b>(const QWebElement &<i>o</i>) const</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QWebElement-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qtwebkit-bridge.html#qwebelement">QWebElement</a> class provides convenient access to DOM elements in a <a href="qwebframe.html">QWebFrame</a>.</p>
<p>A <a href="qtwebkit-bridge.html#qwebelement">QWebElement</a> object allows easy access to the document model, represented by a tree-like structure of DOM elements. The root of the tree is called the document element and can be accessed using <a href="qwebframe.html#documentElement">QWebFrame::documentElement</a>().</p>
<p>Specific elements can be accessed using <a href="qwebelement.html#findAll">findAll</a>() and <a href="qwebelement.html#findFirst">findFirst</a>(). These elements are identified using CSS selectors. The code snippet below demonstrates the use of <a href="qwebelement.html#findAll">findAll</a>().</p>
<pre class="cpp">
<span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> document <span class="operator">=</span> frame<span class="operator">-</span><span class="operator">></span>documentElement();
<span class="comment">/* 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>
*/</span>
<span class="type"><a href="qwebelementcollection.html">QWebElementCollection</a></span> allSpans <span class="operator">=</span> document<span class="operator">.</span>findAll(<span class="string">"span"</span>);
<span class="type"><a href="qwebelementcollection.html">QWebElementCollection</a></span> introSpans <span class="operator">=</span> document<span class="operator">.</span>findAll(<span class="string">"p.intro span"</span>);
</pre>
<p>The first list contains all <code>span</code> elements in the document. The second list contains <code>span</code> elements that are children of <code>p</code>, classified with <code>intro</code>.</p>
<p>Using <a href="qwebelement.html#findFirst">findFirst</a>() is more efficient than calling <a href="qwebelement.html#findAll">findAll</a>(), and extracting the first element only in the list returned.</p>
<p>Alternatively you can traverse the document manually using <a href="qwebelement.html#firstChild">firstChild</a>() and <a href="qwebelement.html#nextSibling">nextSibling</a>():</p>
<pre class="cpp">
frame<span class="operator">-</span><span class="operator">></span>setHtml(<span class="string">"<html><body><p>First Paragraph</p><p>Second Paragraph</p></body></html>"</span>);
<span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> doc <span class="operator">=</span> frame<span class="operator">-</span><span class="operator">></span>documentElement();
<span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> body <span class="operator">=</span> doc<span class="operator">.</span>firstChild();
<span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> firstParagraph <span class="operator">=</span> body<span class="operator">.</span>firstChild();
<span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> secondParagraph <span class="operator">=</span> firstParagraph<span class="operator">.</span>nextSibling();
</pre>
<p>Individual elements can be inspected or changed using methods such as <a href="qwebelement.html#attribute">attribute</a>() or <a href="qwebelement.html#setAttribute">setAttribute</a>(). For examle, to capture the user's input in a text field for later use (auto-completion), a browser could do something like this:</p>
<pre class="cpp">
<span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> firstTextInput <span class="operator">=</span> document<span class="operator">.</span>findFirst(<span class="string">"input[type=text]"</span>);
<span class="type"><a href="../qtcore/qstring.html">QString</a></span> storedText <span class="operator">=</span> firstTextInput<span class="operator">.</span>attribute(<span class="string">"value"</span>);
</pre>
<p>When the same page is later revisited, the browser can fill in the text field automatically by modifying the value attribute of the input element:</p>
<pre class="cpp">
<span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> firstTextInput <span class="operator">=</span> document<span class="operator">.</span>findFirst(<span class="string">"input[type=text]"</span>);
textInput<span class="operator">.</span>setAttribute(<span class="string">"value"</span><span class="operator">,</span> storedText);
</pre>
<p>Another use case is to emulate a click event on an element. The following code snippet demonstrates how to call the JavaScript DOM method click() of a submit button:</p>
<pre class="cpp">
<span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> document <span class="operator">=</span> frame<span class="operator">-</span><span class="operator">></span>documentElement();
<span class="comment">/* Assume that the document has the following structure:
<form name="myform" action="submit_form.asp" method="get">
<input type="text" name="myfield">
<input type="submit" value="Submit">
</form>
*/</span>
<span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> button <span class="operator">=</span> document<span class="operator">.</span>findFirst(<span class="string">"input[type=submit]"</span>);
button<span class="operator">.</span>evaluateJavaScript(<span class="string">"click()"</span>);
</pre>
<p>The underlying content of <a href="qtwebkit-bridge.html#qwebelement">QWebElement</a> is explicitly shared. Creating a copy of a <a href="qtwebkit-bridge.html#qwebelement">QWebElement</a> does not create a copy of the content. Instead, both instances point to the same element.</p>
<p>The contents of child elements can be converted to plain text with <a href="qwebelement.html#toPlainText">toPlainText</a>(); to XHTML using <a href="qwebelement.html#toInnerXml">toInnerXml</a>(). To include the element's tag in the output, use <a href="qwebelement.html#toOuterXml">toOuterXml</a>().</p>
<p>It is possible to replace the contents of child elements using <a href="qwebelement.html#setPlainText">setPlainText</a>() and <a href="qwebelement.html#setInnerXml">setInnerXml</a>(). To replace the element itself and its contents, use <a href="qwebelement.html#setOuterXml">setOuterXml</a>().</p>
<a name="examples"></a>
<h3 >Examples</h3>
<p>The DOM Traversal Example shows one way to traverse documents in a running example.</p>
<p>The Simple Selector Example can be used to experiment with the searching features of this class and provides sample code you can start working with.</p>
</div>
<!-- @@@QWebElement -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$StyleResolveStrategy$$$InlineStyle$$$CascadedStyle$$$ComputedStyle -->
<h3 class="fn" id="StyleResolveStrategy-enum"><a name="StyleResolveStrategy-enum"></a>enum QWebElement::<span class="name">StyleResolveStrategy</span></h3>
<p>This enum describes how <a href="qtwebkit-bridge.html#qwebelement">QWebElement</a>'s <a href="qwebelement.html#styleProperty">styleProperty</a> resolves the given property name.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QWebElement::InlineStyle</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Return the property value as it is defined in the element, without respecting style inheritance and other CSS rules.</td></tr>
<tr><td class="topAlign"><code>QWebElement::CascadedStyle</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The property's value is determined using the inheritance and importance rules defined in the document's stylesheet.</td></tr>
<tr><td class="topAlign"><code>QWebElement::ComputedStyle</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The property's value is the absolute value of the style property resolved from the environment.</td></tr>
</table></div>
<!-- @@@StyleResolveStrategy -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QWebElement[overload1]$$$QWebElement -->
<h3 class="fn" id="QWebElement"><a name="QWebElement"></a>QWebElement::<span class="name">QWebElement</span>()</h3>
<p>Constructs a null web element.</p>
<!-- @@@QWebElement -->
<!-- $$$QWebElement$$$QWebElementconstQWebElement& -->
<h3 class="fn" id="QWebElement-1"><a name="QWebElement-1"></a>QWebElement::<span class="name">QWebElement</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>other</i>)</h3>
<p>Constructs a copy of <i>other</i>.</p>
<!-- @@@QWebElement -->
<!-- $$$~QWebElement[overload1]$$$~QWebElement -->
<h3 class="fn" id="dtor.QWebElement"><a name="dtor.QWebElement"></a>QWebElement::<span class="name">~QWebElement</span>()</h3>
<p>Destroys the element. However, the underlying DOM element is not destroyed.</p>
<!-- @@@~QWebElement -->
<!-- $$$addClass[overload1]$$$addClassconstQString& -->
<h3 class="fn" id="addClass"><a name="addClass"></a><span class="type">void</span> QWebElement::<span class="name">addClass</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>)</h3>
<p>Adds the specified class with the given <i>name</i> to the element.</p>
<!-- @@@addClass -->
<!-- $$$appendInside[overload1]$$$appendInsideconstQString& -->
<h3 class="fn" id="appendInside"><a name="appendInside"></a><span class="type">void</span> QWebElement::<span class="name">appendInside</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>markup</i>)</h3>
<p>Appends the result of parsing <i>markup</i> as the element's last child.</p>
<p>Calling this function on a null element does nothing.</p>
<p><b>See also </b><a href="qwebelement.html#prependInside">prependInside</a>(), <a href="qwebelement.html#prependOutside">prependOutside</a>(), and <a href="qwebelement.html#appendOutside">appendOutside</a>().</p>
<!-- @@@appendInside -->
<!-- $$$appendInside$$$appendInsideconstQWebElement& -->
<h3 class="fn" id="appendInside-1"><a name="appendInside-1"></a><span class="type">void</span> QWebElement::<span class="name">appendInside</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>element</i>)</h3>
<p>Appends the given <i>element</i> as the element's last child.</p>
<p>If <i>element</i> is the child of another element, it is re-parented to this element. If <i>element</i> is a child of this element, then its position in the list of children is changed.</p>
<p>Calling this function on a null element does nothing.</p>
<p><b>See also </b><a href="qwebelement.html#prependInside">prependInside</a>(), <a href="qwebelement.html#prependOutside">prependOutside</a>(), and <a href="qwebelement.html#appendOutside">appendOutside</a>().</p>
<!-- @@@appendInside -->
<!-- $$$appendOutside[overload1]$$$appendOutsideconstQString& -->
<h3 class="fn" id="appendOutside"><a name="appendOutside"></a><span class="type">void</span> QWebElement::<span class="name">appendOutside</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>markup</i>)</h3>
<p>Inserts the result of parsing <i>markup</i> after this element.</p>
<p>Calling this function on a null element does nothing.</p>
<p><b>See also </b><a href="qwebelement.html#appendInside">appendInside</a>(), <a href="qwebelement.html#prependInside">prependInside</a>(), and <a href="qwebelement.html#prependOutside">prependOutside</a>().</p>
<!-- @@@appendOutside -->
<!-- $$$appendOutside$$$appendOutsideconstQWebElement& -->
<h3 class="fn" id="appendOutside-1"><a name="appendOutside-1"></a><span class="type">void</span> QWebElement::<span class="name">appendOutside</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>element</i>)</h3>
<p>Inserts the given <i>element</i> after this element.</p>
<p>If <i>element</i> is the child of another element, it is re-parented to the parent of this element.</p>
<p>Calling this function on a null element does nothing.</p>
<p><b>See also </b><a href="qwebelement.html#appendInside">appendInside</a>(), <a href="qwebelement.html#prependInside">prependInside</a>(), and <a href="qwebelement.html#prependOutside">prependOutside</a>().</p>
<!-- @@@appendOutside -->
<!-- $$$attribute[overload1]$$$attributeconstQString&constQString& -->
<h3 class="fn" id="attribute"><a name="attribute"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">attribute</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>defaultValue</i> = QString()) const</h3>
<p>Returns the attribute with the given <i>name</i>. If the attribute does not exist, <i>defaultValue</i> is returned.</p>
<p><b>See also </b><a href="qwebelement.html#setAttribute">setAttribute</a>(), <a href="qwebelement.html#setAttributeNS">setAttributeNS</a>(), and <a href="qwebelement.html#attributeNS">attributeNS</a>().</p>
<!-- @@@attribute -->
<!-- $$$attributeNS[overload1]$$$attributeNSconstQString&constQString&constQString& -->
<h3 class="fn" id="attributeNS"><a name="attributeNS"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">attributeNS</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>namespaceUri</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>defaultValue</i> = QString()) const</h3>
<p>Returns the attribute with the given <i>name</i> in <i>namespaceUri</i>. If the attribute does not exist, <i>defaultValue</i> is returned.</p>
<p><b>See also </b><a href="qwebelement.html#setAttributeNS">setAttributeNS</a>(), <a href="qwebelement.html#setAttribute">setAttribute</a>(), and <a href="qwebelement.html#attribute">attribute</a>().</p>
<!-- @@@attributeNS -->
<!-- $$$attributeNames[overload1]$$$attributeNamesconstQString& -->
<h3 class="fn" id="attributeNames"><a name="attributeNames"></a><span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> QWebElement::<span class="name">attributeNames</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>namespaceUri</i> = QString()) const</h3>
<p>Return the list of attributes for the namespace given as <i>namespaceUri</i>.</p>
<p><b>See also </b><a href="qwebelement.html#attribute">attribute</a>() and <a href="qwebelement.html#setAttribute">setAttribute</a>().</p>
<!-- @@@attributeNames -->
<!-- $$$classes[overload1]$$$classes -->
<h3 class="fn" id="classes"><a name="classes"></a><span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> QWebElement::<span class="name">classes</span>() const</h3>
<p>Returns the list of classes of this element.</p>
<!-- @@@classes -->
<!-- $$$clone[overload1]$$$clone -->
<h3 class="fn" id="clone"><a name="clone"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> QWebElement::<span class="name">clone</span>() const</h3>
<p>Returns a clone of this element.</p>
<p>The clone may be inserted at any point in the document.</p>
<p><b>See also </b><a href="qwebelement.html#appendInside">appendInside</a>(), <a href="qwebelement.html#prependInside">prependInside</a>(), <a href="qwebelement.html#prependOutside">prependOutside</a>(), and <a href="qwebelement.html#appendOutside">appendOutside</a>().</p>
<!-- @@@clone -->
<!-- $$$document[overload1]$$$document -->
<h3 class="fn" id="document"><a name="document"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> QWebElement::<span class="name">document</span>() const</h3>
<p>Returns the document which this element belongs to.</p>
<!-- @@@document -->
<!-- $$$encloseContentsWith[overload1]$$$encloseContentsWithconstQWebElement& -->
<h3 class="fn" id="encloseContentsWith"><a name="encloseContentsWith"></a><span class="type">void</span> QWebElement::<span class="name">encloseContentsWith</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>element</i>)</h3>
<p>Encloses the contents of this element with <i>element</i>. This element becomes the child of the deepest descendant within <i>element</i>.</p>
<p>### illustration</p>
<p><b>See also </b><a href="qwebelement.html#encloseWith">encloseWith</a>().</p>
<!-- @@@encloseContentsWith -->
<!-- $$$encloseContentsWith$$$encloseContentsWithconstQString& -->
<h3 class="fn" id="encloseContentsWith-1"><a name="encloseContentsWith-1"></a><span class="type">void</span> QWebElement::<span class="name">encloseContentsWith</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>markup</i>)</h3>
<p>Encloses the contents of this element with the result of parsing <i>markup</i>. This element becomes the child of the deepest descendant within <i>markup</i>.</p>
<p><b>See also </b><a href="qwebelement.html#encloseWith">encloseWith</a>().</p>
<!-- @@@encloseContentsWith -->
<!-- $$$encloseWith[overload1]$$$encloseWithconstQString& -->
<h3 class="fn" id="encloseWith"><a name="encloseWith"></a><span class="type">void</span> QWebElement::<span class="name">encloseWith</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>markup</i>)</h3>
<p>Encloses this element with the result of parsing <i>markup</i>. This element becomes the child of the deepest descendant within <i>markup</i>.</p>
<p><b>See also </b><a href="qwebelement.html#replace">replace</a>().</p>
<!-- @@@encloseWith -->
<!-- $$$encloseWith$$$encloseWithconstQWebElement& -->
<h3 class="fn" id="encloseWith-1"><a name="encloseWith-1"></a><span class="type">void</span> QWebElement::<span class="name">encloseWith</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>element</i>)</h3>
<p>Encloses this element with <i>element</i>. This element becomes the child of the deepest descendant within <i>element</i>.</p>
<p><b>See also </b><a href="qwebelement.html#replace">replace</a>().</p>
<!-- @@@encloseWith -->
<!-- $$$evaluateJavaScript[overload1]$$$evaluateJavaScriptconstQString& -->
<h3 class="fn" id="evaluateJavaScript"><a name="evaluateJavaScript"></a><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QWebElement::<span class="name">evaluateJavaScript</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>scriptSource</i>)</h3>
<p>Executes <i>scriptSource</i> with this element as <code>this</code> object and returns the result of the last executed statement.</p>
<p><b>Note: </b>This method may be very inefficient if <i>scriptSource</i> returns a DOM element as a result. See <a href="qwebframe.html#evaluateJavaScript">QWebFrame::evaluateJavaScript</a>() for more details.</p><p><b>See also </b><a href="qwebframe.html#evaluateJavaScript">QWebFrame::evaluateJavaScript</a>().</p>
<!-- @@@evaluateJavaScript -->
<!-- $$$findAll[overload1]$$$findAllconstQString& -->
<h3 class="fn" id="findAll"><a name="findAll"></a><span class="type"><a href="qwebelementcollection.html">QWebElementCollection</a></span> QWebElement::<span class="name">findAll</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>selectorQuery</i>) const</h3>
<p>Returns a new list of child elements matching the given CSS selector <i>selectorQuery</i>. If there are no matching elements, an empty list is returned.</p>
<p><a href="http://www.w3.org/TR/selectors/">Standard CSS selector</a> syntax is used for the query.</p>
<p>This method is equivalent to Element::querySelectorAll in the <a href="http://www.w3.org/TR/selectors-api/">DOM Selectors API</a>.</p>
<p><b>Note: </b>This search is performed recursively.</p><p><b>See also </b><a href="qwebelement.html#findFirst">findFirst</a>().</p>
<!-- @@@findAll -->
<!-- $$$findFirst[overload1]$$$findFirstconstQString& -->
<h3 class="fn" id="findFirst"><a name="findFirst"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> QWebElement::<span class="name">findFirst</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>selectorQuery</i>) const</h3>
<p>Returns the first child element that matches the given CSS selector <i>selectorQuery</i>.</p>
<p><a href="http://www.w3.org/TR/selectors/">Standard CSS selector</a> syntax is used for the query.</p>
<p>This method is equivalent to Element::querySelector in the <a href="http://www.w3.org/TR/selectors-api/">DOM Selectors API</a>.</p>
<p><b>Note: </b>This search is performed recursively.</p><p><b>See also </b><a href="qwebelement.html#findAll">findAll</a>().</p>
<!-- @@@findFirst -->
<!-- $$$firstChild[overload1]$$$firstChild -->
<h3 class="fn" id="firstChild"><a name="firstChild"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> QWebElement::<span class="name">firstChild</span>() const</h3>
<p>Returns the element's first child.</p>
<p><b>See also </b><a href="qwebelement.html#lastChild">lastChild</a>(), <a href="qwebelement.html#previousSibling">previousSibling</a>(), and <a href="qwebelement.html#nextSibling">nextSibling</a>().</p>
<!-- @@@firstChild -->
<!-- $$$geometry[overload1]$$$geometry -->
<h3 class="fn" id="geometry"><a name="geometry"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QWebElement::<span class="name">geometry</span>() const</h3>
<p>Returns the geometry of this element, relative to its containing frame.</p>
<p><b>See also </b><a href="qwebelement.html#tagName">tagName</a>().</p>
<!-- @@@geometry -->
<!-- $$$hasAttribute[overload1]$$$hasAttributeconstQString& -->
<h3 class="fn" id="hasAttribute"><a name="hasAttribute"></a><span class="type">bool</span> QWebElement::<span class="name">hasAttribute</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>) const</h3>
<p>Returns true if this element has an attribute with the given <i>name</i>; otherwise returns false.</p>
<p><b>See also </b><a href="qwebelement.html#attribute">attribute</a>() and <a href="qwebelement.html#setAttribute">setAttribute</a>().</p>
<!-- @@@hasAttribute -->
<!-- $$$hasAttributeNS[overload1]$$$hasAttributeNSconstQString&constQString& -->
<h3 class="fn" id="hasAttributeNS"><a name="hasAttributeNS"></a><span class="type">bool</span> QWebElement::<span class="name">hasAttributeNS</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>namespaceUri</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>) const</h3>
<p>Returns true if this element has an attribute with the given <i>name</i>, in <i>namespaceUri</i>; otherwise returns false.</p>
<p><b>See also </b><a href="qwebelement.html#attributeNS">attributeNS</a>() and <a href="qwebelement.html#setAttributeNS">setAttributeNS</a>().</p>
<!-- @@@hasAttributeNS -->
<!-- $$$hasAttributes[overload1]$$$hasAttributes -->
<h3 class="fn" id="hasAttributes"><a name="hasAttributes"></a><span class="type">bool</span> QWebElement::<span class="name">hasAttributes</span>() const</h3>
<p>Returns true if the element has any attributes defined; otherwise returns false;</p>
<p><b>See also </b><a href="qwebelement.html#attribute">attribute</a>() and <a href="qwebelement.html#setAttribute">setAttribute</a>().</p>
<!-- @@@hasAttributes -->
<!-- $$$hasClass[overload1]$$$hasClassconstQString& -->
<h3 class="fn" id="hasClass"><a name="hasClass"></a><span class="type">bool</span> QWebElement::<span class="name">hasClass</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>) const</h3>
<p>Returns true if this element has a class with the given <i>name</i>; otherwise returns false.</p>
<!-- @@@hasClass -->
<!-- $$$hasFocus[overload1]$$$hasFocus -->
<h3 class="fn" id="hasFocus"><a name="hasFocus"></a><span class="type">bool</span> QWebElement::<span class="name">hasFocus</span>() const</h3>
<p>Returns true if the element has keyboard input focus; otherwise, returns false</p>
<p><b>See also </b><a href="qwebelement.html#setFocus">setFocus</a>().</p>
<!-- @@@hasFocus -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn" id="isNull"><a name="isNull"></a><span class="type">bool</span> QWebElement::<span class="name">isNull</span>() const</h3>
<p>Returns true if the element is a null element; otherwise returns false.</p>
<!-- @@@isNull -->
<!-- $$$lastChild[overload1]$$$lastChild -->
<h3 class="fn" id="lastChild"><a name="lastChild"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> QWebElement::<span class="name">lastChild</span>() const</h3>
<p>Returns the element's last child.</p>
<p><b>See also </b><a href="qwebelement.html#firstChild">firstChild</a>(), <a href="qwebelement.html#previousSibling">previousSibling</a>(), and <a href="qwebelement.html#nextSibling">nextSibling</a>().</p>
<!-- @@@lastChild -->
<!-- $$$localName[overload1]$$$localName -->
<h3 class="fn" id="localName"><a name="localName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">localName</span>() const</h3>
<p>Returns the local name of the element. If the element does not use namespaces, an empty string is returned.</p>
<!-- @@@localName -->
<!-- $$$namespaceUri[overload1]$$$namespaceUri -->
<h3 class="fn" id="namespaceUri"><a name="namespaceUri"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">namespaceUri</span>() const</h3>
<p>Returns the namespace URI of this element. If the element has no namespace URI, an empty string is returned.</p>
<!-- @@@namespaceUri -->
<!-- $$$nextSibling[overload1]$$$nextSibling -->
<h3 class="fn" id="nextSibling"><a name="nextSibling"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> QWebElement::<span class="name">nextSibling</span>() const</h3>
<p>Returns the element's next sibling.</p>
<p><b>See also </b><a href="qwebelement.html#firstChild">firstChild</a>(), <a href="qwebelement.html#previousSibling">previousSibling</a>(), and <a href="qwebelement.html#lastChild">lastChild</a>().</p>
<!-- @@@nextSibling -->
<!-- $$$parent[overload1]$$$parent -->
<h3 class="fn" id="parent"><a name="parent"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> QWebElement::<span class="name">parent</span>() const</h3>
<p>Returns the parent element of this elemen. If this element is the root document element, a null element is returned.</p>
<!-- @@@parent -->
<!-- $$$prefix[overload1]$$$prefix -->
<h3 class="fn" id="prefix"><a name="prefix"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">prefix</span>() const</h3>
<p>Returns the namespace prefix of the element. If the element has no namespace prefix, empty string is returned.</p>
<!-- @@@prefix -->
<!-- $$$prependInside[overload1]$$$prependInsideconstQString& -->
<h3 class="fn" id="prependInside"><a name="prependInside"></a><span class="type">void</span> QWebElement::<span class="name">prependInside</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>markup</i>)</h3>
<p>Prepends the result of parsing <i>markup</i> as the element's first child.</p>
<p>Calling this function on a null element does nothing.</p>
<p><b>See also </b><a href="qwebelement.html#appendInside">appendInside</a>(), <a href="qwebelement.html#prependOutside">prependOutside</a>(), and <a href="qwebelement.html#appendOutside">appendOutside</a>().</p>
<!-- @@@prependInside -->
<!-- $$$prependInside$$$prependInsideconstQWebElement& -->
<h3 class="fn" id="prependInside-1"><a name="prependInside-1"></a><span class="type">void</span> QWebElement::<span class="name">prependInside</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>element</i>)</h3>
<p>Prepends <i>element</i> as the element's first child.</p>
<p>If <i>element</i> is the child of another element, it is re-parented to this element. If <i>element</i> is a child of this element, then its position in the list of children is changed.</p>
<p>Calling this function on a null element does nothing.</p>
<p><b>See also </b><a href="qwebelement.html#appendInside">appendInside</a>(), <a href="qwebelement.html#prependOutside">prependOutside</a>(), and <a href="qwebelement.html#appendOutside">appendOutside</a>().</p>
<!-- @@@prependInside -->
<!-- $$$prependOutside[overload1]$$$prependOutsideconstQString& -->
<h3 class="fn" id="prependOutside"><a name="prependOutside"></a><span class="type">void</span> QWebElement::<span class="name">prependOutside</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>markup</i>)</h3>
<p>Inserts the result of parsing <i>markup</i> before this element.</p>
<p>Calling this function on a null element does nothing.</p>
<p><b>See also </b><a href="qwebelement.html#appendInside">appendInside</a>(), <a href="qwebelement.html#prependInside">prependInside</a>(), and <a href="qwebelement.html#appendOutside">appendOutside</a>().</p>
<!-- @@@prependOutside -->
<!-- $$$prependOutside$$$prependOutsideconstQWebElement& -->
<h3 class="fn" id="prependOutside-1"><a name="prependOutside-1"></a><span class="type">void</span> QWebElement::<span class="name">prependOutside</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>element</i>)</h3>
<p>Inserts the given <i>element</i> before this element.</p>
<p>If <i>element</i> is the child of another element, it is re-parented to the parent of this element.</p>
<p>Calling this function on a null element does nothing.</p>
<p><b>See also </b><a href="qwebelement.html#appendInside">appendInside</a>(), <a href="qwebelement.html#prependInside">prependInside</a>(), and <a href="qwebelement.html#appendOutside">appendOutside</a>().</p>
<!-- @@@prependOutside -->
<!-- $$$previousSibling[overload1]$$$previousSibling -->
<h3 class="fn" id="previousSibling"><a name="previousSibling"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> QWebElement::<span class="name">previousSibling</span>() const</h3>
<p>Returns the element's previous sibling.</p>
<p><b>See also </b><a href="qwebelement.html#firstChild">firstChild</a>(), <a href="qwebelement.html#nextSibling">nextSibling</a>(), and <a href="qwebelement.html#lastChild">lastChild</a>().</p>
<!-- @@@previousSibling -->
<!-- $$$removeAllChildren[overload1]$$$removeAllChildren -->
<h3 class="fn" id="removeAllChildren"><a name="removeAllChildren"></a><span class="type">void</span> QWebElement::<span class="name">removeAllChildren</span>()</h3>
<p>Removes all children from this element.</p>
<p><b>See also </b><a href="qwebelement.html#removeFromDocument">removeFromDocument</a>() and <a href="qwebelement.html#takeFromDocument">takeFromDocument</a>().</p>
<!-- @@@removeAllChildren -->
<!-- $$$removeAttribute[overload1]$$$removeAttributeconstQString& -->
<h3 class="fn" id="removeAttribute"><a name="removeAttribute"></a><span class="type">void</span> QWebElement::<span class="name">removeAttribute</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>)</h3>
<p>Removes the attribute with the given <i>name</i> from this element.</p>
<p><b>See also </b><a href="qwebelement.html#attribute">attribute</a>(), <a href="qwebelement.html#setAttribute">setAttribute</a>(), and <a href="qwebelement.html#hasAttribute">hasAttribute</a>().</p>
<!-- @@@removeAttribute -->
<!-- $$$removeAttributeNS[overload1]$$$removeAttributeNSconstQString&constQString& -->
<h3 class="fn" id="removeAttributeNS"><a name="removeAttributeNS"></a><span class="type">void</span> QWebElement::<span class="name">removeAttributeNS</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>namespaceUri</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>)</h3>
<p>Removes the attribute with the given <i>name</i>, in <i>namespaceUri</i>, from this element.</p>
<p><b>See also </b><a href="qwebelement.html#attributeNS">attributeNS</a>(), <a href="qwebelement.html#setAttributeNS">setAttributeNS</a>(), and <a href="qwebelement.html#hasAttributeNS">hasAttributeNS</a>().</p>
<!-- @@@removeAttributeNS -->
<!-- $$$removeClass[overload1]$$$removeClassconstQString& -->
<h3 class="fn" id="removeClass"><a name="removeClass"></a><span class="type">void</span> QWebElement::<span class="name">removeClass</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>)</h3>
<p>Removes the specified class with the given <i>name</i> from the element.</p>
<!-- @@@removeClass -->
<!-- $$$removeFromDocument[overload1]$$$removeFromDocument -->
<h3 class="fn" id="removeFromDocument"><a name="removeFromDocument"></a><span class="type">void</span> QWebElement::<span class="name">removeFromDocument</span>()</h3>
<p>Removes this element from the document and makes it a null element.</p>
<p><b>See also </b><a href="qwebelement.html#removeAllChildren">removeAllChildren</a>() and <a href="qwebelement.html#takeFromDocument">takeFromDocument</a>().</p>
<!-- @@@removeFromDocument -->
<!-- $$$render[overload1]$$$renderQPainter* -->
<h3 class="fn" id="render"><a name="render"></a><span class="type">void</span> QWebElement::<span class="name">render</span>(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> *<i>painter</i>)</h3>
<p>Render the element into <i>painter</i> .</p>
<!-- @@@render -->
<!-- $$$render$$$renderQPainter*constQRect& -->
<h3 class="fn" id="render-1"><a name="render-1"></a><span class="type">void</span> QWebElement::<span class="name">render</span>(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> *<i>painter</i>, const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &<i>clip</i>)</h3>
<p>Render the element into <i>painter</i> clipping to <i>clip</i>.</p>
<!-- @@@render -->
<!-- $$$replace[overload1]$$$replaceconstQString& -->
<h3 class="fn" id="replace"><a name="replace"></a><span class="type">void</span> QWebElement::<span class="name">replace</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>markup</i>)</h3>
<p>Replaces this element with the result of parsing <i>markup</i>.</p>
<p>This method will not replace the <html>, <head> or <body> elements.</p>
<p><b>See also </b><a href="qwebelement.html#encloseWith">encloseWith</a>().</p>
<!-- @@@replace -->
<!-- $$$replace$$$replaceconstQWebElement& -->
<h3 class="fn" id="replace-1"><a name="replace-1"></a><span class="type">void</span> QWebElement::<span class="name">replace</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>element</i>)</h3>
<p>Replaces this element with <i>element</i>.</p>
<p>This method will not replace the <html>, <head> or <body> elements.</p>
<p><b>See also </b><a href="qwebelement.html#encloseWith">encloseWith</a>().</p>
<!-- @@@replace -->
<!-- $$$setAttribute[overload1]$$$setAttributeconstQString&constQString& -->
<h3 class="fn" id="setAttribute"><a name="setAttribute"></a><span class="type">void</span> QWebElement::<span class="name">setAttribute</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>value</i>)</h3>
<p>Adds an attribute with the given <i>name</i> and <i>value</i>. If an attribute with the same name exists, its value is replaced by <i>value</i>.</p>
<p><b>See also </b><a href="qwebelement.html#attribute">attribute</a>(), <a href="qwebelement.html#attributeNS">attributeNS</a>(), and <a href="qwebelement.html#setAttributeNS">setAttributeNS</a>().</p>
<!-- @@@setAttribute -->
<!-- $$$setAttributeNS[overload1]$$$setAttributeNSconstQString&constQString&constQString& -->
<h3 class="fn" id="setAttributeNS"><a name="setAttributeNS"></a><span class="type">void</span> QWebElement::<span class="name">setAttributeNS</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>namespaceUri</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>value</i>)</h3>
<p>Adds an attribute with the given <i>name</i> in <i>namespaceUri</i> with <i>value</i>. If an attribute with the same name exists, its value is replaced by <i>value</i>.</p>
<p><b>See also </b><a href="qwebelement.html#attributeNS">attributeNS</a>(), <a href="qwebelement.html#attribute">attribute</a>(), and <a href="qwebelement.html#setAttribute">setAttribute</a>().</p>
<!-- @@@setAttributeNS -->
<!-- $$$setFocus[overload1]$$$setFocus -->
<h3 class="fn" id="setFocus"><a name="setFocus"></a><span class="type">void</span> QWebElement::<span class="name">setFocus</span>()</h3>
<p>Gives keyboard input focus to this element</p>
<p><b>See also </b><a href="qwebelement.html#hasFocus">hasFocus</a>().</p>
<!-- @@@setFocus -->
<!-- $$$setInnerXml[overload1]$$$setInnerXmlconstQString& -->
<h3 class="fn" id="setInnerXml"><a name="setInnerXml"></a><span class="type">void</span> QWebElement::<span class="name">setInnerXml</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>markup</i>)</h3>
<p>Replaces the contents of this element with <i>markup</i>. The string may contain HTML or XML tags, which is parsed and formatted before insertion into the document.</p>
<p><b>Note: </b>This is currently implemented for (X)HTML elements only.</p><p><b>See also </b><a href="qwebelement.html#toInnerXml">toInnerXml</a>(), <a href="qwebelement.html#toOuterXml">toOuterXml</a>(), and <a href="qwebelement.html#setOuterXml">setOuterXml</a>().</p>
<!-- @@@setInnerXml -->
<!-- $$$setOuterXml[overload1]$$$setOuterXmlconstQString& -->
<h3 class="fn" id="setOuterXml"><a name="setOuterXml"></a><span class="type">void</span> QWebElement::<span class="name">setOuterXml</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>markup</i>)</h3>
<p>Replaces the contents of this element as well as its own tag with <i>markup</i>. The string may contain HTML or XML tags, which is parsed and formatted before insertion into the document.</p>
<p><b>Note: </b>This is currently only implemented for (X)HTML elements.</p><p><b>See also </b><a href="qwebelement.html#toOuterXml">toOuterXml</a>(), <a href="qwebelement.html#toInnerXml">toInnerXml</a>(), and <a href="qwebelement.html#setInnerXml">setInnerXml</a>().</p>
<!-- @@@setOuterXml -->
<!-- $$$setPlainText[overload1]$$$setPlainTextconstQString& -->
<h3 class="fn" id="setPlainText"><a name="setPlainText"></a><span class="type">void</span> QWebElement::<span class="name">setPlainText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>text</i>)</h3>
<p>Replaces the existing content of this element with <i>text</i>.</p>
<p>This is equivalent to setting the HTML innerText property.</p>
<p><b>See also </b><a href="qwebelement.html#toPlainText">toPlainText</a>().</p>
<!-- @@@setPlainText -->
<!-- $$$setStyleProperty[overload1]$$$setStylePropertyconstQString&constQString& -->
<h3 class="fn" id="setStyleProperty"><a name="setStyleProperty"></a><span class="type">void</span> QWebElement::<span class="name">setStyleProperty</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>value</i>)</h3>
<p>Sets the value of the inline style with the given <i>name</i> to <i>value</i>.</p>
<p>Setting a value, does not necessarily mean that it will become the applied value, due to the fact that the style property's value might have been set earlier with a higher priority in external or embedded style declarations.</p>
<p>In order to ensure that the value will be applied, you may have to append "!important" to the value.</p>
<p><b>See also </b><a href="qwebelement.html#styleProperty">styleProperty</a>().</p>
<!-- @@@setStyleProperty -->
<!-- $$$styleProperty[overload1]$$$stylePropertyconstQString&StyleResolveStrategy -->
<h3 class="fn" id="styleProperty"><a name="styleProperty"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">styleProperty</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>, <span class="type"><a href="qwebelement.html#StyleResolveStrategy-enum">StyleResolveStrategy</a></span> <i>strategy</i>) const</h3>
<p>Returns the value of the style with the given <i>name</i> using the specified <i>strategy</i>. If a style with <i>name</i> does not exist, an empty string is returned.</p>
<p>In CSS, the cascading part depends on which CSS rule has priority and is thus applied. Generally, the last defined rule has priority. Thus, an inline style rule has priority over an embedded block style rule, which in return has priority over an external style rule.</p>
<p>If the "!important" declaration is set on one of those, the declaration receives highest priority, unless other declarations also use the "!important" declaration. Then, the last "!important" declaration takes predecence.</p>
<p><b>See also </b><a href="qwebelement.html#setStyleProperty">setStyleProperty</a>().</p>
<!-- @@@styleProperty -->
<!-- $$$tagName[overload1]$$$tagName -->
<h3 class="fn" id="tagName"><a name="tagName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">tagName</span>() const</h3>
<p>Returns the tag name of this element.</p>
<p><b>See also </b><a href="qwebelement.html#geometry">geometry</a>().</p>
<!-- @@@tagName -->
<!-- $$$takeFromDocument[overload1]$$$takeFromDocument -->
<h3 class="fn" id="takeFromDocument"><a name="takeFromDocument"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &QWebElement::<span class="name">takeFromDocument</span>()</h3>
<p>Removes this element from the document and returns a reference to it.</p>
<p>The element is still valid after removal, and can be inserted into other parts of the document.</p>
<p><b>See also </b><a href="qwebelement.html#removeAllChildren">removeAllChildren</a>() and <a href="qwebelement.html#removeFromDocument">removeFromDocument</a>().</p>
<!-- @@@takeFromDocument -->
<!-- $$$toInnerXml[overload1]$$$toInnerXml -->
<h3 class="fn" id="toInnerXml"><a name="toInnerXml"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">toInnerXml</span>() const</h3>
<p>Returns the XML content between the element's start and end tags.</p>
<p><b>Note: </b>This is currently implemented for (X)HTML elements only.</p><p><b>Note: </b>The format of the markup returned will obey the namespace of the document containing the element. This means the return value will obey XML formatting rules, such as self-closing tags, only if the document is 'text/xhtml+xml'.</p><p><b>See also </b><a href="qwebelement.html#setInnerXml">setInnerXml</a>(), <a href="qwebelement.html#setOuterXml">setOuterXml</a>(), and <a href="qwebelement.html#toOuterXml">toOuterXml</a>().</p>
<!-- @@@toInnerXml -->
<!-- $$$toOuterXml[overload1]$$$toOuterXml -->
<h3 class="fn" id="toOuterXml"><a name="toOuterXml"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">toOuterXml</span>() const</h3>
<p>Returns this element converted to XML, including the start and the end tags as well as its attributes.</p>
<p><b>Note: </b>This is currently implemented for (X)HTML elements only.</p><p><b>Note: </b>The format of the markup returned will obey the namespace of the document containing the element. This means the return value will obey XML formatting rules, such as self-closing tags, only if the document is 'text/xhtml+xml'.</p><p><b>See also </b><a href="qwebelement.html#setOuterXml">setOuterXml</a>(), <a href="qwebelement.html#setInnerXml">setInnerXml</a>(), and <a href="qwebelement.html#toInnerXml">toInnerXml</a>().</p>
<!-- @@@toOuterXml -->
<!-- $$$toPlainText[overload1]$$$toPlainText -->
<h3 class="fn" id="toPlainText"><a name="toPlainText"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QWebElement::<span class="name">toPlainText</span>() const</h3>
<p>Returns the text between the start and the end tag of this element.</p>
<p>This is equivalent to reading the HTML innerText property.</p>
<p><b>See also </b><a href="qwebelement.html#setPlainText">setPlainText</a>().</p>
<!-- @@@toPlainText -->
<!-- $$$toggleClass[overload1]$$$toggleClassconstQString& -->
<h3 class="fn" id="toggleClass"><a name="toggleClass"></a><span class="type">void</span> QWebElement::<span class="name">toggleClass</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>name</i>)</h3>
<p>Adds the specified class with the given <i>name</i> if it is not present. If the class is already present, it will be removed.</p>
<!-- @@@toggleClass -->
<!-- $$$webFrame[overload1]$$$webFrame -->
<h3 class="fn" id="webFrame"><a name="webFrame"></a><span class="type"><a href="qwebframe.html">QWebFrame</a></span> *QWebElement::<span class="name">webFrame</span>() const</h3>
<p>Returns the web frame which this element is a part of. If the element is a null element, null is returned.</p>
<!-- @@@webFrame -->
<!-- $$$operator!=[overload1]$$$operator!=constQWebElement& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QWebElement::<span class="name">operator!=</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>o</i>) const</h3>
<p>Returns true if this element points to a different underlying DOM object than <i>o</i>; otherwise returns false.</p>
<!-- @@@operator!= -->
<!-- $$$operator=[overload1]$$$operator=constQWebElement& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &QWebElement::<span class="name">operator=</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>other</i>)</h3>
<p>Assigns <i>other</i> to this element and returns a reference to this element.</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQWebElement& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QWebElement::<span class="name">operator==</span>(const <span class="type"><a href="qwebelement.html#QWebElement">QWebElement</a></span> &<i>o</i>) const</h3>
<p>Returns true if this element points to the same underlying DOM object as <i>o</i>; otherwise returns false.</p>
<!-- @@@operator== -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|