|
象下面的qt程序应该如何编译呀,下面这段代码也是我拷贝下来的
/* chinese.h */
#include <qapplication.h>
#include <qwidget.h>
#include <qlabel.h>
#include <qlineedit.h>
class Chinese: public QWidget
{
Q_OBJECT
public:
Chinese();
private:
QLabel *label;
QLineEdit *input;
private slots:
void display();
};
void slot display()
/* chinese.cpp */
#include "chinese.moc"
#include <iostream.h>
Chinese::Chinese()
{
resize(200,100);
label=new QLabel( "Input Line:", this);
label->setGeometry(10,10,90,30);
input=new QLineEdit(this);
input->setGeometry(10, 40, 180, 30);
input->setFocus();
connect(input, SIGNAL(returnPressed()), this, SLOT(display()));
}
void Chinese::display()
{
QCString string;
string=input->text();
cout<<string<<endl;
}
/* main.cpp */
#include <qapplication.h>
#include "chinese.h"
main (int argc, char **argv)
{
QApplication a(argc, argv);
Chinese w;
a.setMainWidget (&w);
w.show();
return a.exec();
}
我用的是redhat 8.0 我用qmake -project ,qmake ,make 去编辑这个程序行不通,谁知道应该如何编译 |
|