【问题标题】:Qt png images not showing up in deployment appQt png图像未显示在部署应用程序中
【发布时间】:2019-01-07 15:20:18
【问题描述】:

我的 .png 图像显示在 Qt Creator 中,并且当我在调试和发布情况下构建我的项目时。当我尝试部署我的 exe 并运行它时,我的图像不显示。

我的 .pro 文件:

QT       += core gui multimedia multimediawidgets

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = WinSim
TEMPLATE = app

DEFINES += QT_DEPRECATED_WARNINGS


SOURCES += main.cpp\
    mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui


RESOURCES += \
resourcefile.qrc
win32:RC_ICONS += icons\uokicon.ico

我的资源文件:

<RCC>
<qresource prefix="/">
    <file>icons/ico.png</file>
    <file>icons/ppicon.png</file>
    <file>icons/cricon.png</file>
    <file>icons/bgim.png</file>
    <file>icons/button.png</file>
    <file>icons/startmenu.png</file>
    <file>icons/power.png</file>
    <file>icons/uokicon.ico</file>
</qresource>
</RCC>

【问题讨论】:

  • 可以指出部署后附加了哪些文件,您使用的是windeployqt吗?
  • 我没有使用 windeployqt。我只是将必要的 dll 与 exe 放在一个文件夹中。我一直都是这样做的,而且效果很好。
  • 如果它工作得很好,因为你认为你有那个错误?,它不工作。 Qt 是一个复杂的库,因此建议使用 windeployqt 进行部署,检查:doc.qt.io/qt-5/windows-deployment.html
  • 我会尝试,如果它有效,我会告诉你
  • 天哪,我真傻哈哈。谢谢,它有效!

标签: c++ qt deployment resources png


【解决方案1】:

我需要做的就是使用 windeployqt 部署我的程序。感谢@eyllanesc 指出这一点!

【讨论】:

    猜你喜欢
    • 2014-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-14
    • 1970-01-01
    • 2020-07-15
    • 2011-02-28
    相关资源
    最近更新 更多