【问题标题】:Qt: QGraphicObject and QImageQt:QGraphicObject 和 QImage
【发布时间】:2012-06-14 13:50:47
【问题描述】:

我有一个 QGraphicsObject 派生类,它包含一个 QImage 和 ovveride

paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)

在痛苦中我成功绘制了QImageQGraphicsObjectQGraphicsScene 的一个项目,后者在QGraphicsView 内部。 QImage 维度超过了 QGraphicsScene 维度。我的目的是dragQImage(或QGraphicsObject)以显示QImage 的超出部分。我怎样才能做到这一点?一定要translateQImage画布吗?

能给我一些文档或示例吗?

谢谢

【问题讨论】:

    标签: qt qgraphicsview qgraphicsscene qimage


    【解决方案1】:

    使用 QGraphicsPixmapItem 并让 QGraphicsView 为您处理拖动可能更容易: http://qt-project.org/doc/qt-4.8/qgraphicsview.html#dragMode-prop

    【讨论】:

    • 实际上我让 QGraphicsView 管理触摸事件,并将 QTransform 应用于 QGraphicObject。你在想什么?
    猜你喜欢
    • 2020-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多