SVG5/qopengltexturebutton.cpp
2025-10-12 13:55:56 +09:00

52 lines
1.0 KiB
C++

#include "qopengltexturebutton.h"
QOpenGLTextureButton::QOpenGLTextureButton(QObject *parent) : QObject(parent)
{
m_pNormal = NULL;
m_pClicked = NULL;
}
QOpenGLTextureButton::~QOpenGLTextureButton()
{
if(m_pNormal!=NULL)
{
m_pNormal->destroy();
delete m_pNormal;
m_pNormal = NULL;
}
if(m_pClicked!=NULL)
{
m_pClicked->destroy();
delete m_pClicked;
m_pClicked = NULL;
}
}
void QOpenGLTextureButton::LoadImage(QString strNormal, QString strClicked)
{
if(strNormal.isEmpty()==false)
{
QImage imageNormal(strNormal);
imageNormal = imageNormal.convertToFormat(QImage::Format_ARGB32);
m_pNormal = new QOpenGLTexture(imageNormal);
}
if(strClicked.isEmpty()==false)
{
QImage imageClicked(strClicked);
m_pClicked = new QOpenGLTexture(imageClicked);
}
}
QOpenGLTexture *QOpenGLTextureButton::GetTextureNormal()
{
return m_pNormal;
}
QOpenGLTexture *QOpenGLTextureButton::GetTextureClicked()
{
return m_pClicked;
}