QWebInspector Class | Qt 5.9

Qt 5.9 | QWebInspector

Qt 5.9.2 Reference Documentation

# QWebInspector Class

The QWebInspector class allows the placement and control of a QWebPage's inspector. The inspector can display a page's hierarchy, its loading statistics and the current state of its individual elements. It is mostly used by web developers. More...

Header: | #include <QWebInspector>
qmake: | QT += webkitwidgets
Since: | Qt 4.6
Inherits: | QWidget

- List of all members, including inherited members

## Public Functions

| QWebInspector(QWidget *parent = Q_NULLPTR)
| ~QWebInspector()
bool | event(QEvent *ev)
QWebPage * | page() const
void | setPage(QWebPage *page)

## Reimplemented Public Functions

virtual QSize | sizeHint() const

- 216 public functions inherited from QWidget

## Reimplemented Protected Functions

virtual void | closeEvent(QCloseEvent *event)
virtual void | hideEvent(QHideEvent *event)
virtual void | resizeEvent(QResizeEvent *event)
virtual void | showEvent(QShowEvent *event)

- 35 protected functions inherited from QWidget

### Additional Inherited Members

- 59 properties inherited from QWidget
- 19 public slots inherited from QWidget
- 3 signals inherited from QWidget
- 5 static public members inherited from QWidget
- 35 protected functions inherited from QWidget
- 1 protected slot inherited from QWidget

## Detailed Description

The QWebInspector class allows the placement and control of a QWebPage's inspector. The inspector can display a page's hierarchy, its loading statistics and the current state of its individual elements. It is mostly used by web developers.

The QWebPage to be inspected must be specified using the setPage() method.

A typical use of QWebInspector follows:

          // ...
          QWebPage *page = new QWebPage;
          // ...

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

A QWebInspector can be made visible either programmatically using setVisible(), or by the user through the attached QWebPage's context menu.

Note: A QWebInspector will display a blank widget if either:

- page() is null
- QWebSettings::DeveloperExtrasEnabled is false

### Resources

This class acts mostly as a container and a controller for the inspector. Most of the resources needed by the inspector are owned by the associated QWebPage and are allocated the first time that:

- an element is inspected
- the QWebInspector is shown.

### Inspector configuration persistence

The inspector allows the user to configure some options through its user interface (e.g. the resource tracking "Always enable" option). The inspector UI is itself a web page and is using HTML local storage to persist those settings. Since the internal QWebPage used by the inspector isn't exposed in the API, the only way to enable those settings to be persisted is currently to enable local storage globally through QWebSettings::globalSettings().

See also QWebSettings::localStoragePath() and QWebSettings::LocalStorageEnabled.

## Member Function Documentation

### QWebInspector::QWebInspector(QWidget *parent = Q_NULLPTR)

Constructs an unbound QWebInspector with parent as its parent.

### QWebInspector::~QWebInspector()

Destroys the inspector.

### `[virtual protected]` void QWebInspector::closeEvent(QCloseEvent *event)

Reimplemented from QWidget::closeEvent().

### bool QWebInspector::event(QEvent *ev)

### `[virtual protected]` void QWebInspector::hideEvent(QHideEvent *event)

Reimplemented from QWidget::hideEvent().

### QWebPage *QWebInspector::page() const

Returns the inspected QWebPage. If no web page is currently associated, a null pointer is returned.

See also setPage().

### `[virtual protected]` void QWebInspector::resizeEvent(QResizeEvent *event)

Reimplemented from QWidget::resizeEvent().

### void QWebInspector::setPage(QWebPage *page)

Bind this inspector to the QWebPage to be inspected.

Notes:

- There can only be one QWebInspector associated with a QWebPage and vice versa.
- Calling this method with a null page will break the current association, if any.
- If page is already associated to another QWebInspector, the association will be replaced and the previous QWebInspector will become unbound

See also page().

### `[virtual protected]` void QWebInspector::showEvent(QShowEvent *event)

Reimplemented from QWidget::showEvent().

### `[virtual]` QSize QWebInspector::sizeHint() const

Reimplemented from QWidget::sizeHint().