以下是我的代码,哪里出了问题?
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QPushButton>
#include <QtGui/QLineEdit>
#include <QtGui/QTextEdit>
#include <QtGui/QWidget>
//#include <qmultilineedit.h>
#include <qstring.h>
#include <QFile>
#include <QTextStream>
class Test:public QWidget
{
public:
Test();
private:
QPushButton *pushButton;
QPushButton *pushButton_2;
QPushButton *pushButton_3;
QPushButton *pushButton_4;
QPushButton *pushButton_5;
QPushButton *pushButton_6;
QLineEdit *textEdit;
QLineEdit *textEdit_2;
QPushButton *pushButton_7;
};
Test::Test()
{
if (this->objectName().isEmpty())
this->setObjectName(QString::fromUtf8("this"));
this->resize(400, 300);
pushButton = new QPushButton("copy",this);
pushButton->setObjectName(QString::fromUtf8("pushButton"));
pushButton->setGeometry(QRect(10, 20, 51, 27));
pushButton_2 = new QPushButton("cut",this);
pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));
pushButton_2->setGeometry(QRect(70, 20, 51, 27));
pushButton_3 = new QPushButton("paste",this);
pushButton_3->setObjectName(QString::fromUtf8("pushButton_3"));
pushButton_3->setGeometry(QRect(130, 20, 51, 27));
pushButton_4 = new QPushButton("paste",this);
pushButton_4->setObjectName(QString::fromUtf8("pushButton_4"));
pushButton_4->setGeometry(QRect(330, 20, 51, 27));
pushButton_5 = new QPushButton("cut",this);
pushButton_5->setObjectName(QString::fromUtf8("pushButton_5"));
pushButton_5->setGeometry(QRect(270, 20, 51, 27));
pushButton_6 = new QPushButton("copy",this);
pushButton_6->setObjectName(QString::fromUtf8("pushButton_6"));
pushButton_6->setGeometry(QRect(210, 20, 51, 27));
textEdit = new QLineEdit(this);
textEdit->setObjectName(QString::fromUtf8("textEdit"));
textEdit->setGeometry(QRect(10, 60, 171, 181));
//textEdit->setLineWidth(6);
textEdit_2 = new QLineEdit(this);
textEdit_2->setObjectName(QString::fromUtf8("textEdit_2"));
textEdit_2->setGeometry(QRect(210, 60, 171, 181));
//textEdit_2->setLineWidth(6);
pushButton_7 = new QPushButton("browse",this);
pushButton_7->setObjectName(QString::fromUtf8("pushButton_7"));
pushButton_7->setGeometry(QRect(40, 250, 80, 27));
QFile f("/root/readme");
f.open(QIODevice::ReadOnly);
QTextStream stream(&f);
QString str;
while(stream.atEnd()==0)
{
str=stream.readLine();
textEdit->insert(str);
}
//textEdit->setReadOnly(true);
connect(pushButton,SIGNAL(clicked()),textEdit,SLOT(copy()));
connect(pushButton_2,SIGNAL(clicked()),textEdit,SLOT(cut()));
connect(pushButton_3,SIGNAL(clicked()),textEdit,SLOT(paste()));
connect(pushButton_6,SIGNAL(clicked()),textEdit,SLOT(copy()));
connect(pushButton_5,SIGNAL(clicked()),textEdit,SLOT(cut()));
connect(pushButton_4,SIGNAL(clicked()),textEdit_2,SLOT(paste()));
}
int main(int argc,char **argv)
{
QApplication a(argc,argv);
Test demo;
demo.show();
return a.exec();
}