2013-03-18 44 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的