QT接口类设计
1.接口类vcall、video类、videoWidget类
使用过程中设计接口类vcall,使video和videoWidget独立
class vcall
{
public:
virtual void init(int nw,int nh)= 0;
virtual void repaint(QImage *pImg) = 0;
}
class videoWidget:public QWidget,public vcall
{
public:
virtual void init(int nw,int nh);
virtual void repaint(QImage *pImg);
}
class video
{
public:
vcall *m_pcall = NULL;
bool openVideo(QString strPath,vcall *pcall,int nw,int nh)
{
m_pcall = pcall;
m_pcall ->init(nw,nh);
}
void showImg(QImage *pImg)
{
m_pcall->repaint(pImg);
}
}
var foo = 'bar';