显示图片修复
This commit is contained in:
@@ -60,10 +60,10 @@ void camera::run()
|
||||
if (lastUpdateTime.elapsed() > 200)//显示在界面
|
||||
{
|
||||
lastUpdateTime.start(); // 记录本次更新时间
|
||||
QPixmap pixmap;
|
||||
cvMatToQPixMap(data->oriImgs[0], pixmap);
|
||||
QPixmap* pixmap;
|
||||
cvMatToQPixMap(data->oriImgs[0], *pixmap);
|
||||
showImgPack* pack = new showImgPack();
|
||||
pack->img = std::make_shared<QPixmap>(pixmap);
|
||||
pack->img = pixmap;
|
||||
pack->type = imgWidgetOri;
|
||||
pack->index = data->oriShowIndex;
|
||||
emit S1(pack);
|
||||
|
||||
@@ -121,10 +121,10 @@ void threadManager::resultHandle(std::shared_ptr <detData> data)
|
||||
//发送图片
|
||||
if (data->resultImgs.size() > 0)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
cvMatToQPixMap(data->resultImgs[0], pixmap);
|
||||
QPixmap* pixmap;
|
||||
cvMatToQPixMap(data->oriImgs[0], *pixmap);
|
||||
showImgPack* pack = new showImgPack();
|
||||
pack->img = std::make_shared<QPixmap>(pixmap);
|
||||
pack->img = pixmap;
|
||||
pack->type = imgWidgetRes;
|
||||
pack->index = data->resShowIndex;
|
||||
emit _backEndManager->sendPixmapImageWidget(pack);
|
||||
@@ -132,10 +132,10 @@ void threadManager::resultHandle(std::shared_ptr <detData> data)
|
||||
}
|
||||
if (data->resultImgs.size() > 1)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
cvMatToQPixMap(data->resultImgs[1], pixmap);
|
||||
QPixmap* pixmap;
|
||||
cvMatToQPixMap(data->oriImgs[0], *pixmap);
|
||||
showImgPack* pack = new showImgPack();
|
||||
pack->img = std::make_shared<QPixmap>(pixmap);
|
||||
pack->img = pixmap;
|
||||
pack->type = imgWidgetRes;
|
||||
pack->index = data->resShowIndex+1;
|
||||
emit _backEndManager->sendPixmapImageWidget(pack);
|
||||
|
||||
@@ -44,7 +44,7 @@ enum imgWidgetShowType
|
||||
};
|
||||
struct showImgPack
|
||||
{
|
||||
std::shared_ptr<QPixmap> img;
|
||||
QPixmap* img;
|
||||
imgWidgetShowType type;
|
||||
int index = -1;
|
||||
QString name = "";
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
"}");
|
||||
mutex.unlock();
|
||||
}
|
||||
void setImg(std::shared_ptr<QPixmap> pixmap)
|
||||
void setImg(QPixmap* pixmap)
|
||||
{
|
||||
showImg(pixmap);
|
||||
}
|
||||
@@ -150,7 +150,7 @@ protected:
|
||||
vBar->setValue(vBar->value() - delta.y());
|
||||
}
|
||||
private:
|
||||
void showImg(std::shared_ptr<QPixmap> img)
|
||||
void showImg(QPixmap* img)
|
||||
{
|
||||
mutex.lock();
|
||||
setEnabled(true);
|
||||
@@ -237,7 +237,7 @@ public:
|
||||
label->setText(text);
|
||||
}
|
||||
//set不一定显示,要根据当前显示的类型决定
|
||||
void setOriImg(std::shared_ptr<QPixmap> oriImgInput)
|
||||
void setOriImg(QPixmap* oriImgInput)
|
||||
{
|
||||
pixOriImg = oriImgInput;
|
||||
if (pixOriImg->isNull()) {
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
showImgOnGraphicsView(pixOriImg);
|
||||
}
|
||||
//set不一定显示,要根据当前显示的类型决定
|
||||
void setResImg(std::shared_ptr<QPixmap> resImgInput)
|
||||
void setResImg(QPixmap* resImgInput)
|
||||
{
|
||||
pixResImg = resImgInput;
|
||||
if (pixResImg->isNull()) {
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
showImgOnGraphicsView(pixResImg);
|
||||
}
|
||||
//无视当前类型直接显示
|
||||
void showImgOnGraphicsView(std::shared_ptr<QPixmap> imageMat) {
|
||||
void showImgOnGraphicsView(QPixmap* imageMat) {
|
||||
view->setImg(imageMat);
|
||||
}
|
||||
void switchOriAndRes()//切换原图和结果图
|
||||
@@ -313,8 +313,8 @@ private:
|
||||
switchOriAndRes();
|
||||
}
|
||||
}
|
||||
std::shared_ptr<QPixmap> pixOriImg;
|
||||
std::shared_ptr<QPixmap> pixResImg;
|
||||
QPixmap* pixOriImg;
|
||||
QPixmap* pixResImg;
|
||||
|
||||
bool MatType = false;//false ori true Res
|
||||
int in = 0;
|
||||
@@ -351,7 +351,7 @@ public:
|
||||
QList< ImageWidget*>ImageWidgetList;
|
||||
std::unordered_map<QString, ImageWidget*>map;
|
||||
|
||||
bool showImg(std::shared_ptr<QPixmap> img, imgWidgetShowType _type, int index)
|
||||
bool showImg(QPixmap* img, imgWidgetShowType _type, int index)
|
||||
{
|
||||
if (index > ImageWidgetList.size())
|
||||
return false;
|
||||
@@ -368,7 +368,7 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool showImg(std::shared_ptr<QPixmap> img, imgWidgetShowType _type, QString nickName)
|
||||
bool showImg(QPixmap* img, imgWidgetShowType _type, QString nickName)
|
||||
{
|
||||
if (map.find(nickName) == map.end())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user