2013-03-18 62 views
0

嗨,我是新来的QT我需要一个程序,从行编辑采用输入和使用这些值执行一些操作使用这些值anfd给输出行编辑.. .. 我写了一些代码,但它不工作.... 请检查它。 代码:程序采取行编辑和显示行输入编辑

enter code here 
MainWindow::~MainWindow() 
{ 
delete ui; 
} 

void MainWindow::on_pushButton_clicked() 
{ 
int x,az,el,EL,AZ,a,b,c,d,e,f,g,X,Y,y; 
QLineEdit lineEdit 
QString az=lineEdit1->text(); 
QString el=lineEdit2->text(); 

    AZ=((az*pi)/180); 
    EL=((el*pi)/180); 

     a=sin(AZ); 
     b=cos(AZ); 
     c=cos(EL); 
     d=cot(EL); 
     e=b*d; 
     f=-1*e; 
     X=atan(f); 
     g=c*a; 
     Y=asinn(g); 
    x=(X*180)/pi; 
    y=(Y*180)/pi; 

    this->ui->lineEdit3->setText("x"); 
    this->ui->lineEdit4->setText("y"); 

} 

回答

0

你需要的是执行一些铸造。您已经检索到azel作为QString并没有实际使用它们。

int x,az,el,EL,AZ,a,b,c,d,e,f,g,X,Y,y; 
AZ=((az*pi)/180);// undefined int az is used here 
EL=((el*pi)/180);// undefined int el is used here 

而且setText (const QString &)需要的QString作为参数,所以你需要投int x到QString的