就这么简单的两行代码,QT提示错误
QTextCursor cr = pDocument->find(keyword); cr.block();
error: calling 'block' with incomplete return type 'QTextBlock'
qtextcursor.h:164:16: note: 'block' declared here
qtextcursor.h:64:7: note: forward declaration of 'QTextBlock'
看QTextCursor的定义没问题啊,也不是private类型啥的,incomplete type 到底什么意思?
答:没有此类型的定义!即没包含QTextBlock的头文件啊傻X
加上
#include <QTextBlock>
警告消失~
发表评论