首页 > 编程学习 > qt开发遇到的问题记录

qt开发遇到的问题记录

发布时间:2022/10/1 2:01:50

qt qml安装需要

sudo apt-get install qt5-default qt5-qmake g++ qtcreator

apt-get install qtdeclarative5-dev

qt 打包

windeployqt.exe xx.exe

windeployqt.exe --qmldir qmlPath xx.exe

设置依赖加载路径

QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'"

QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN/lib\'"

QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN/../lib\'"

CMake使用qt


find_package(Qt5 COMPONENTS Core Gui Xml Multimedia Network MultimediaWidgets Widgets REQUIRED)

include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS}
        ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS}  ${Qt5Network_INCLUDE_DIRS}  ${Qt5MultimediaWidgets_INCLUDE_DIRS}  ${Qt5Widgets_INCLUDE_DIRS})
 

target_link_libraries(MyApp
  PRIVATE Qt5::Core Qt5::Gui Qt5::Xml Qt5::Multimedia Qt5::Network Qt5::MultimediaWidgets Qt5::Widgets)

Linux 设置debug日志输出

export QT_DEBUG_PLUGINS=1

qt 5.15遇到 not found xcb

编译qt是设置 -bundled-xcb-xinput

-bundled-xcb-xinput

Correct as described here: https://doc.qt.io/qt-5/linux-requirements.html

Note: From Qt 5.15 onwards, Qt does require libxcb 1.11. Also, the -qt-xcb configure option got removed that was bundling some of the libs below. Anyhow, you can now configure with -bundled-xcb-xinput to avoid a dependency to system xcb-xinput.

qt5.11中qml调用C++崩溃

qml使用C++对象,会被前端释放导致程序崩溃,5.14 5.15版本没问题

Copyright © 2010-2022 mfbz.cn 版权所有 |关于我们| 联系方式|豫ICP备15888888号