# Source: qt.adoc

*Note: This file could not be automatically converted from AsciiDoc.*

=== Use `libcamera` with Qt

Qt is a popular application framework and GUI toolkit. `rpicam-apps` includes an option to use Qt for a camera preview window.

Unfortunately, Qt defines certain symbols (such as `slot` and `emit`) as macros in the global namespace. This causes errors when including `libcamera` files. The problem is common to all platforms that use both Qt and `libcamera`. Try the following workarounds to avoid these errors:

* List `libcamera` include files, or files that include `libcamera` files (such as `rpicam-apps` files), _before_ any Qt header files whenever possible.

* If you do need to mix your Qt application files with `libcamera` includes, replace `signals:` with `Q_SIGNALS:`, `slots:` with `Q_SLOTS:`, `emit` with `Q_EMIT` and `foreach` with `Q_FOREACH`.

* Add the following at the top of any `libcamera` include files:
+
[source,cpp]
----
#undef signals
#undef slots
#undef emit
#undef foreach
----

* If your project uses `qmake`, add `CONFIG += no_keywords` to the project file.
* If your project uses `cmake`, add `SET(QT_NO_KEYWORDS ON)`.