#include "planprotect.h"
#include <tchar.h>
PlanProtect::PlanProtect(QWidget *parent, Qt::WindowFlags flags)
: QMainWindow(parent, flags)
{
ui.setupUi(this);
}
PlanProtect::~PlanProtect()
{
}
void PlanProtect::on_OpenImage_clicked()
{
QString filename = _T("C:\\lena.jpg");
if(filename.isEmpty())
{
return;
}
else
{
QImage* img=new QImage;
QImage* imgScaled=new QImage;
if(! ( img->load(filename) ) ) //加载图像
{
QMessageBox::information(this,
tr(_T("打开图像失败")),
tr(_T("打开图像失败!")));
delete img;//内存释放
return;
}
*imgScaled = img->scaled(ui.label_Picture->width(), ui.label_Picture->height());
delete img;//内存释放
ui.label_Picture->setPixmap(QPixmap::fromImage(*imgScaled));
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
VS2012_opencv2.4.8_Qt5.2.0图像显示程序_修改版.rar (8个子文件)
VS2012_opencv2.4.8_Qt5.2.0图像显示程序
planprotect.h 572B
PlanProtect.vcxproj 10KB
planprotect.cpp 818B
planprotect.qrc 71B
planprotect.ui 2KB
PlanProtect.vcxproj.user 630B
main.cpp 181B
PlanProtect.vcxproj.filters 3KB
共 8 条
- 1
资源评论
- qq_172873412015-02-03内容出错 无法运行程序
- orangehahaha2014-12-16刚开始接触Qt+opencv,来借鉴参考一下。
suixin19890311
- 粉丝: 648
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功