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);
^ 展开
#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);
^ 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询