求助QGraphicsScene QGraphicsView 图形框架问题

明卿 明卿 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
QGraphicsScene QGraphicsView 图形框架中 继承的QGraphicsScene类 里面的drawBackground接口贴了背景图,可以正常显示QGraphicsScene的背景图,然后在继承的QGraphicsView 类里面也实现了drawBackground后就看不到QGraphicsScene贴的背景图片了,把QGraphicsView 的drawBackground注释掉才能看到图片,什么原因跪求大神指点


class MyQGraphicsScene : public QGraphicsScene
{
public:
MyQGraphicsScene( QObject* pParent = 0 );
// QGraphicsScene interface
protected:
void drawBackground(QPainter *painter, const QRectF &rect);
void drawForeground(QPainter *painter, const QRectF &rect);
};

class MyQGraphicsView : public QGraphicsView,
protected QOpenGLFunctions
{
public:
MyQGraphicsView( QWidget* pParent = 0 );

// QGraphicsView interface
protected:
void drawBackground(QPainter *painter, const QRectF &rect);

void InitGL();
void ResizeGL(int width, int height);
void PaintGL();
};


...全文
评论 2
收藏 已收藏
分享
返回顶部
明卿
Qt 21,503 成员 26,693 内容