标题:请教关于QDialogButtonBox与QPushButton的问题
作者:eosin
日期:2011-07-12 10:23
内容:
参照qt4 gui书上的例子,gotocell工程中,使用QtCreator工具创建的界面gotocelldialog.ui,QDialogButtonBox创建的按钮盒名称是buttonBox,在对话框构造函数中,使用buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);禁用OK按钮,编译报错信息说QPushButton前向声明不完整,并且“->setEnabled(false)”这部分用ctrl+空格不能自动补全,如果用QPushButton创建ok和cancel按钮则编译正常,请战友帮忙解答。
#1 [XChinux 07-12 13:59]
post your code and the build error message to here
#2 [eosin 07-15 19:26]
经过多次试验发现了使用QDialogButtonBox必须包含QtGui头文件才能成功编译运行,但不知为什么?
#3 [dugucloud 07-15 19:37]
晕。直接include那个类的名字就可以了。比如说
#include
#4 [eosin 07-25 17:02]
要#include 才行,这样直接包含是不行的,谢谢了
#5 [levichenhh 09-04 21:23]
我也是这个问题,版本Qt6.0,解决方法,在开头调用#include