qt# problem: Many qml files of QT4 do not have header files such as QQuickView, QQuickWidget, QQmlApplicationEngine to solve this problem

dm2213692 注册会员
2023-02-28 08:16
< div class = "md_content_show e397 data - v - 3967" = "" >

I try thank you

DDN911 注册会员
2023-02-28 08:16
dailiben 注册会员
2023-02-28 08:16

qt5 has

dulongsb 注册会员
2023-02-28 08:16

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > in Qt 4 Qt Quick and QML and not as a built-in module provides. Instead, you need to use the header file and classes provided by the QDeclarative module.

To use QML in Qt 4, you need to ensure that you have added the following lines to your project file(.pro file) :

QT += declarative

Then include the header file provided by the QDeclarative module in your source code. For example, you can include the QDeclarativeView header file with the following statement:


Note that the version of QML used in Qt 4 is 1.0, which is different from the version used in Qt 5(usually 2.x). In addition, Qt Quick and QML have replaced QDeclarative in Qt 5.

In Qt 4, you can use QDeclarativeItem and QDeclarativeEngine to expose custom C++ objects to QML. For more information on how to use these classes, see the QML Integration section in the Qt 4 documentation.

Aaronz85 注册会员
2023-02-28 08:16

Please accept
QT4 does not support QML, so there is no corresponding header file. If you want to use QML, it is recommended that you upgrade to QT5, which supports QML and provides the appropriate header files. Alternatively, you can build QML applications using Qt Creator, which automatically generates header files.

cth1117 注册会员
2023-02-28 08:16
< div class = "md_content_show e397 data - v - 3967" = "" >

have written in QT4.8.4

About the Author

Question Info

Publish Time
2023-02-28 08:16
Update Time
2023-02-28 08:16

Related Question

Qt c++同时http get






mac QT Mysql postgresql


NoSuchElementException . python文本框

QT信号槽相对于const ref参数的行为