Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. India
  4. Need help with some code
QtWS25 Last Chance

Need help with some code

Scheduled Pinned Locked Moved India
9 Posts 5 Posters 3.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    santhosh
    wrote on last edited by
    #1

    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.....

    1 Reply Last reply
    0
    • S Offline
      S Offline
      santhosh
      wrote on last edited by
      #2

      This is my code is this correct please help me

      [Edit: Removed code which is duplicated below -- mlong]

      1 Reply Last reply
      0
      • S Offline
        S Offline
        santhosh
        wrote on last edited by
        #3

        @
        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");

        }
        @

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

          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.

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            santhosh
            wrote on last edited by
            #5

            Hi Iam facing some problem in qtablewidget.
            My program is to display some calculated values in the table widget but l'm not getting the table....
            I need a table with 3columns and some rows.
            Please help me with some code

            1 Reply Last reply
            0
            • JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              There is some example code at http://qt-project.org/doc/qt-5.0/qtwidgets/qtablewidget.html#details -- start with that

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              0
              • S Offline
                S Offline
                santhosh
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  koahnig
                  wrote on last edited by
                  #8

                  [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.

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    KA51O
                    wrote on last edited by
                    #9

                    "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.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved