logplus/logPlus/MyGraphicsView.h
2026-06-12 11:57:17 +08:00

24 lines
617 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// MyGraphicsView.h
#ifndef MYGRAPHICSVIEW_H
#define MYGRAPHICSVIEW_H
#include <QGraphicsView>
#include <QResizeEvent>
class MyGraphicsView : public QGraphicsView
{
Q_OBJECT
public:
// 构造函数,可根据需要传入 proxy 等参数
explicit MyGraphicsView(QGraphicsScene *scene, QWidget *parent = nullptr);
void setGraphicsProxyWidget(QGraphicsProxyWidget* proxy);
protected:
// 重写 resizeEvent 方法
void resizeEvent(QResizeEvent *event) override;
private:
QGraphicsProxyWidget *m_proxy; // 用于存储您之前添加的 proxy以便在 resizeEvent 中访问
};
#endif // MYGRAPHICSVIEW_H