1 Star 10 Fork 6

刘杰/QPictureBox

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
qpicturebox.h 983 Bytes
一键复制 编辑 原始数据 按行查看 历史
#ifndef QPICTUREBOX_H
#define QPICTUREBOX_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions_3_3_Core>
#include <QOpenGLShaderProgram>
#include <QVector>
#include <QMatrix4x4>
#include <QOpenGLBuffer>
#include <QOpenGLTexture>
class QPictureBox : public QOpenGLWidget, private QOpenGLFunctions_3_3_Core
{
Q_OBJECT
public:
QPictureBox(QWidget *parent = 0);
enum ScaleType{
fitXY,
fitCenter,
CenterCorp
};
void setImage(const QImage& image);//读取文件
void setImage(const QString& filename);
void setScaleType(enum ScaleType);
void setBackGround(QColor color);
private:
QVector<GLfloat> data;
QOpenGLBuffer VBO;
QOpenGLShaderProgram program;
QOpenGLTexture *texture = nullptr;
QImage image_data;
QColor background;
enum ScaleType image_Scale_Type = ScaleType::fitCenter;
// QOpenGLWidget interface
protected:
void initializeGL();
void paintGL();
};
#endif // QPICTUREBOX_H
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/upcliujie/qpicturebox.git
git@gitee.com:upcliujie/qpicturebox.git
upcliujie
qpicturebox
QPictureBox
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385