首页 > 其他 > 详细

QT -- 对数据的判断(总结)

时间:2021-05-14 15:48:30      阅读:7      评论:0      收藏:0      [点我收藏+]

一、判断Mat是否为空

if(img.empty())return -1; //是否加载成功

if(!img.data)return -1;//判断是否有数据

二、判断QImage、QPixmap是否为空

if(m_currentImage.isNull()) return; 

三、QString判断空

isEmpty

Returns true if the string has no characters; otherwise returns false.

 QString().isEmpty();            // returns true
 QString("").isEmpty();          // returns true
 QString("x").isEmpty();         // returns false
 QString("abc").isEmpty();       // returns false

isNull

Returns true if this string is null; otherwise returns false.

 QString().isNull();             // returns true
 QString("").isNull();           // returns false
 QString("abc").isNull();        // returns false

 

QT -- 对数据的判断(总结)

原文:https://www.cnblogs.com/zzzsj/p/14768167.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!