Need help with some code
-
Hii I have to do a program Im unable to do some implementations so please help me....
The program is that we give two angle values 'az' and 'el' it should take those values as input and it should convert these values to some other angles like 'x' and 'y'......
I have the code part for these conversion....
Where should i add this code part in the program.....
and how to accept input values and give those values to conversion code...... please help me..... -
@
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");}
@ -
I have split your new messages into their own thread. Please use new topics for new issues. Also, I have wrapped your code in @ tags.
Your code has a number of issues.
At a very quick glance, I can see the following (though it probably isn't a complete list):
- You have an extraneous QLineEdit (which is missing a semicolon)
- Your variables are all integer types. This won't work, especially when dealing with sin/cos/etc.
- You are using a couple of trig functions which do not exist.
- You are not converting from QStrings to numerical angle values properly.
- When setting text, you are setting the line edits to the literal strings "x" and "y".
I'll leave the corrections to these issues as an exercise for you, but I hope this points you in the right direction.
Aside from that, if you have other issues, please ask specific questions. If you have error messages when compiling, be sure and read them and they will tell you where your specific errors are.
-
There is some example code at http://qt-project.org/doc/qt-5.0/qtwidgets/qtablewidget.html#details -- start with that
-
[quote author="santhosh" date="1370587501"]Hey hii
I need to create a tablewidget with 3 columns and multiple rows...
I was able to create the columns and headers but Iam unable to enter data into the table...
So please help me as soon as possible...
Thankyou[/quote]It would be better to give this thread a more appropriate title indicating the issue. As it is at the moment it applies to 99.99% of the posts.
Probably you need also to share some of your code for others to see where your problem is.
-
"This introduction to the model/view concept":https://qt-project.org/doc/qt-4.8/model-view-programming.html in Qt was very helpful to me when I first had to use the associated classes.
Also, please start a new thread for each of your new problems. If neccessary you can cross link to older threads.