查看完整版本: [-- 第五章例子求助 --]

QTCN开发网 -> 《C++ GUI Qt 4编程》(第2版)专栏 -> 第五章例子求助 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

lesy 2014-05-30 15:53

第五章例子求助

书中第五章的例子,为什么编译到这句if(!event->region().intersect(rect).isEmpty())时提示.isEmpty的左边必须有类/结构/联合

lesy 2014-05-30 15:55
intersect(rect)这句话有错误,必须改成intersects(rect)才能编译

weiweiqiao 2014-05-31 22:42
应该是打印错误。你是说if语句理解不清楚还是???

lesy 2014-06-01 16:25
weiweiqiao:应该是打印错误。你是说if语句理解不清楚还是??? (2014-05-31 22:42) 

if(!event->region().intersect(rect).isEmpty())这句老是提示.isEmpty的左边必须有类/结构/联合虽然把
intersect(rect)改成intersects(rect)

lesy 2014-06-01 16:26
lesy:intersect(rect)这句话有错误,必须改成intersects(rect)才能编译 (2014-05-30 15:55) 

这个改了,还是提示.isEmpty的左边必须有类/结构/联合

weiweiqiao 2014-06-01 19:46
lesy:
这个改了,还是提示.isEmpty的左边必须有类/结构/联合

应该改成intersected()方法。
因为Qt api中说了:


QRegion QRegion::intersect(const QRegion & r) const

Use intersected(r) instead.



查看完整版本: [-- 第五章例子求助 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled