【问题标题】:QGraphicsPixmapItem not showed in QGraphicsScene in deployed modeQGraphicsPixmapItem 在部署模式下未显示在 QGraphicsScene 中
【发布时间】:2011-01-05 11:31:59
【问题描述】:

使用以下代码,在我的工作站(QtCreator 一个“手动”运行)上一切正常。但是在另一台没有安装 Qt 的电脑上,我的应用程序不显示 QGraphicsPixmapItem。

图像 = 新 QGraphicsPixmapItem(QPixmap(urlFile)); 图像->setZValue(-5000.0); 场景->setSceneRect(QRectF(0, 0, image->pixmap().width() + 200, image->pixmap().height() + 200)); 场景->添加项目(图像); view->setMaximumWidth(image->pixmap().width() + 200); 视图->setMaximumHeight(图像->pixmap().height() + 200); qreal centerX = (scene->width() / 2.0) - (image->pixmap().width() /2.0); qreal centerY = (scene->height() / 2.0) - (image->pixmap().height() /2.0);; 图像->setOffset(QPointF(centerX, centerY));

你知道为什么吗?

【问题讨论】:

    标签: qt qgraphicsview


    【解决方案1】:

    我知道为什么:)

    使用jpg和gif需要以下dll:qgif4.dll、qjpeg4.dll。
    事实上,一个部署的应用程序默认支持,只有以下格式:bmp、pbm、png、ppm、xbm、xpm。

    之前的dll可以在QTDIR/qt/plugins/imageformats/中找到

    要为您部署的应用程序添加对其他图像格式的支持,请在可执行文件的同一级别上创建一个 imageformats/ 目录并将您想要的 dll 放入其中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-15
      • 1970-01-01
      • 2019-02-11
      • 2020-10-17
      • 1970-01-01
      • 2014-11-20
      • 1970-01-01
      • 2020-02-04
      相关资源
      最近更新 更多