- Qt 6.6
- Qt Quick
- Qt Quick Widgets
- Qt 6.6.0 Reference Documentation

# Qt Quick Widgets

The Qt Quick Widgets module is a convenience wrapper for QQuickWindow. It will automatically load and display a QML scene when given the URL of the main `qml` file. Alternatively, you can instantiate QML objects using QQmlComponent and place them in a manually set-up QQuickWidget.

Typical usage:

     QQuickWidget *view = new QQuickWidget;
     view->setSource(QUrl::fromLocalFile("myqmlfile.qml"));
     view->show();

QQuickWidget also manages resizing the view and the root item. By default, the resizeMode is set to SizeViewToRootObject, which will load the component and resize it to fit the view. Alternatively, you can set resizeMode to SizeViewToRootObject, which will resize the view to the root item.

## Using the Module

Using a Qt module's C++ API requires linking against the module library, either directly or through other dependencies. Several build tools have dedicated support for this, including CMake and qmake.

### Building with CMake

Use the `find_package()` command to locate the needed module component in the `Qt6` package:

     find_package(Qt6 REQUIRED COMPONENTS QuickWidgets)
     target_link_libraries(mytarget PRIVATE Qt6::QuickWidgets)

For more details, see the Build with CMake overview.

### Building with qmake quickwidgets

To configure the module for building with qmake, add the module as a value of the `QT` variable in the project's .pro file:

     QT += quickwidgets

## Reference

- Qt Quick Widgets C++ Classes

## Licenses and Attributions

Qt Quick Widget is available under commercial licenses from The Qt Company. In addition, it is available under free software licenses. Since Qt 5.4, these free software licenses are GNU Lesser General Public License, version 3, or the GNU General Public License, version 2. See Qt Licensing for more details.