【发布时间】:2011-06-05 20:33:11
【问题描述】:
只是一个简单的程序,可以在单击按钮时将文本添加到 textedit... 这里有什么问题吗??
#include<QPushButton>
#include<QApplication>
#include<QTextEdit>
#include<QWidget>
#include<QHBoxLayout>
#include<QLabel>
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
QHBoxLayout *layout=new QHBoxLayout;
QTextEdit *text = new QTextEdit();
QWidget window;
QPushButton *button;
layout->addWidget(text);
button = new QPushButton();
button->setText(QChar(i+48));
QObject::connect(button,SIGNAL(clicked()),text,SLOT(setPlainText("hai")));
layout->addWidget(button);
window.setLayout(layout);
window.resize(500, 500);
window.show();
return app.exec();
}
【问题讨论】: