Qt错误怎么调试的

#include<QtGui>#include<QApplication>#include<QTableWidget>#include<QLabel>#include<Q... #include<QtGui>
#include<QApplication>
#include<QTableWidget>
#include<QLabel>
#include<QPushButton>
#include<QTextEdit>
#include<QCheckBox>
#include<QGridLayout>
#include<QWidget>

int main(int argc,char*argv[])
{

QApplication app(argc,argv);

QLabel *name = new QLabel(QObject::tr("&Name"));

QLabel *look = new QLabel(QObject::tr("&Look in"));

QTextEdit *te1 = new QTextEdit;

QTextEdit *te2 = new QTextEdit;

QTextEdit *te3 = new QTextEdit(QObject::tr("0 files found"));

QCheckBox *cb = new QCheckBox(QObject::tr("Include subfolders"));

QTableWidget *tableWidget = new QTableWidget(10,3);

QStringList header;

header<<"Name"<<"In Folder"<<"Size";

tableWidget->setHorizontalHeaderLabels(header);

QPushButton *find = new QPushButton(QObject::tr("find"));

QPushButton *stop = new QPushButton(QObject::tr("stop"));

QPushButton *close = new QPushButton(QObject::tr("close"));

QPushButton *help = new QPushButton(QObject::tr("help"));

QGridLayout *leftlayout = new QGridLayout;

leftlayout->addWidget(name,0,0);

leftlayout->addWidget(te1,0,1);

leftlayout->addWidget(look,1,0);

leftlayout->addWidget(te2,1,1);

leftlayout->addWidget(cb,2,0,1,2);

leftlayout->addWidget(tableWidget,3,0,1,2);

leftlayout->addWidget(te3,4,0,1,2);

QVBoxLayout *rightlayout = new QVBoxLayout;

rightlayout->addWidget(find);

rightlayout->addWidget(stop);

rightlayout->addWidget(close);

rightlayout->addStretch();

rightlayout->addWidget(help);

QHBoxLayout *mainlayout = new QHBoxLayout;

mainlayout->addLayout(leftlayout);

mainlayout->addLayout(rightlayout);

setLayout(mainlayout);

return app.exec();

}

D:\visual studio 2010\Projects\6\table\main.cpp:59: error: 'setLayout' was not declared in this scope
setLayout(mainlayout);
^
展开
 我来答
wodeshow119
推荐于2016-08-29 · TA获得超过426个赞
知道小有建树答主
回答量:349
采纳率:87%
帮助的人:209万
展开全部
调试: 左下角有个调试运行, 可以在行数那边加入断点,调试方法与其他编译器相似

setLayout 这个函数是谁的? 是app.setLayout(mainlayout)? 还是你其他定义的类?
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式