关于使用DataVisualization三维显示功能的应用程序复制到其他电脑上Qt5Gui.dll报错的问题

当应用程序在某些电脑上运行时,由于缺少QT环境,特别是Qt5Gui.dll报错,导致3D图像无法正常显示。通过复制Qt安装目录下的特定文件夹到问题机台,并更新环境变量Path,可以解决此问题。此方法简单有效,但未深入探究具体是哪个dll导致的问题。
摘要由CSDN通过智能技术生成

一、问题描述

应用程序中有使用QT的DataVisualization三维显示这个功能,用于开发应用程序的电脑打开三维显示正常,某些机台 也正常显示。

问题在于将同样的应用程序文件复制到其他电脑上,有些电脑Qt5Gui.dll报错(无法访问受保护的内存,这通常指示其他内存已损坏),无法显示3D图像。

二、解决办法

找到安装Qt安装目录下的文件,如下图所示,将其复制到显示异常的机台。
复制文件夹
粘贴好该文件夹后,复制该文件夹路径,如图所示。
复制文件夹路径
复制好 文件夹路径后,桌面找到计算机图标——鼠标右键——属性——高级系统设置——高级——环境变量。
设置环境变量
打开环境变量设置后,找到Path,点击编辑。
编辑变量路径
将前面复制的文件夹路径粘贴到变量值对话框中,记住是 粘贴到最后面因为这里还有其他的系统便变量,加个分号隔开。
在这里插入图片描述
完成更改,重新打开3D显示可正运行。

三、总结

出现该问题的原因是缺少 QT的环境,本文章只是粗略解决该问题,具体是缺少哪个dll没有去深入研究。 目测是这几个dll,如图,发现不配置环境变量把这几个dll放到程序同级目录下也可以正常显示。

--------------------------- Qt Data Visualization 5.7.0 --------------------------- Qt Data Visualization module provides multiple graph types to visualize data in 3D space both with C++ and Qt Quick 2. System Requirements =================== - Qt 5.2.1 or newer - OpenGL 2.1 or newer (recommended) or OpenGL ES2 (reduced feature set) - Manipulating Qt Data Visualization graphs with QML Designer requires Qt Creator 3.3 or newer Building ======== Configure the project with qmake: qmake After running qmake, build the project with make: (Linux) make (Windows with MinGw) mingw32-make (Windows with Visual Studio) nmake (OS X) make The above generates the default makefiles for your configuration, which is typically the release build if you are using precompiled binary Qt distribution. To build both debug and release, or one specifically, use one of the following qmake lines instead. For debug builds: qmake CONFIG+=debug make or qmake CONFIG+=debug_and_release make debug For release builds: qmake CONFIG+=release make or qmake CONFIG+=debug_and_release make release For both builds (Windows/OS X only): qmake CONFIG+="debug_and_release build_all" make After building, install the module to your Qt directory: make install If you want to uninstall the module: make uninstall Building as a statically linked library ======================================= The same as above applies, you will just have to add static to the CONFIG: qmake CONFIG+=static Documentation ============= The documentation can be generated with: make docs The documentation is generated into the doc folder under the build folder. Both Qt Assistant (qtdatavisualization.qch) and in HTML format (qtdatavisualization subfolder) documentation is generated. Please refer to the generated documentation for more information: doc/qtdatavisualization/qtdatavisualization-index.html Known Issues ============ - Some platforms like Android and WinRT cannot handle multiple native windows properly, so only the Qt Quick 2 versions of graphs are available in practice for those platforms. - Shadows are not supported with OpenGL ES2 (including Angle builds in Windows). - Anti-aliasing doesn't work with OpenGL ES2 (including Angle builds in Windows). - QCustom3DVolume items are not supported with OpenGL ES2 (including Angle builds in Windows). - Surfaces with non-straight rows and columns do not always render properly. - Q3DLight class (and Light3D QML item) are currently not usable for anything. - Changing most of Q3DScene properties affecting subviewports currently has no effect. - Widget based examples layout incorrectly in iOS. - Reparenting a graph to an item in another QQuickWindow is not supported. - Android builds of QML applications importing QtDataVisualization also require "QT += datavisualization" in the pro file. This is because Qt Data Visualization QML plugin has a dependency to Qt Data Visualization C++ library, which Qt Creator doesn't automatically add to the deployment package. - Only OpenGL ES2 emulation is available for software renderer (that is, when using QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL))
QtDataVisualizationQt中的一个模块,用于可视化数据,包括3D图形和2D图形。其中,三维散点图是其中的一种类型,可以用于展示三维数据中的散点分布情况。 使用QtDataVisualization绘制三维散点图的步骤如下: 1. 创建一个Q3DScatter对象,用于展示三维散点图。 2. 创建一个QScatterDataArray对象,用于存储散点数据。 3. 将散点数据添加到QScatterDataArray对象中。 4. 创建一个QScatterDataProxy对象,用于将散点数据与Q3DScatter对象关联。 5. 设置Q3DScatter对象的坐标轴范围、主题、标题等属性。 6. 将Q3DScatter对象添加到QWidget中进行展示。 下面是一个简单的示例代码,用于展示如何使用QtDataVisualization绘制三维散点图: ``` #include <QtWidgets/QApplication> #include <QtDataVisualization/Q3DScatter> #include <QtDataVisualization/QScatterDataProxy> #include <QtDataVisualization/QScatterDataArray> using namespace QtDataVisualization; int main(int argc, char *argv[]) { QApplication a(argc, argv); // 创建一个Q3DScatter对象 Q3DScatter *scatter = new Q3DScatter(); // 创建一个QScatterDataArray对象 QScatterDataArray dataArray; // 添加散点数据到QScatterDataArray对象中 for (float x = -10.0f; x <= 10.0f; x += 0.5f) { for (float y = -10.0f; y <= 10.0f; y += 0.5f) { for (float z = -10.0f; z <= 10.0f; z += 0.5f) { dataArray << QVector3D(x, y, z); } } } // 创建一个QScatterDataProxy对象,并将散点数据与Q3DScatter对象关联 QScatterDataProxy *proxy = new QScatterDataProxy(); proxy->addItems(dataArray); scatter->addSeries(proxy); // 设置Q3DScatter对象的坐标轴范围、主题、标题等属性 scatter->activeTheme()->setType(Q3DTheme::ThemeEbony); scatter->axisX()->setTitle("X Axis Title"); scatter->axisY()->setTitle("Y Axis Title"); scatter->axisZ()->setTitle("Z Axis Title"); // 将Q3DScatter对象添加到QWidget中进行展示 QWidget *container = QWidget::createWindowContainer(scatter); container->setMinimumSize(800, 600); container->setWindowTitle("QtDataVisualization - 3D Scatter"); container->show(); return a.exec(); } ``` 运行该示例代码,可以得到一个包含了大量散点的三维散点图,如下图所示: ![QtDataVisualization - 3D Scatter](https://blog.csdn.net/qq_41453285/article/details/107261516)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值