Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. API Implementation from Existing GUI Qt Application.
Forum Updated to NodeBB v4.3 + New Features

API Implementation from Existing GUI Qt Application.

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 3 Posters 1.8k Views 1 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #6

    In addition to what @jsulm wrote, you should take a look at the documentation of QCommandLineParser. There is shown how to properly check for the availability of an option.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    2
    • S Offline
      S Offline
      shivaVMC
      wrote on last edited by shivaVMC
      #7

      Hi Team,
      I m plannig to implement API for the exixting code as mentioned in the begininng of the topic.
      Instead of entering the values from GUI,I want to make the API for the motor function and want to pass the values to that API.The reason to make the API are I want to use these API's in another application where I wanat to calll this API by passing the M1 and M2 values.
      Please any suggestion on this.

      Now I m planning for API implementation for the same.
      Thing is I m using 2 fields like
      Motor1: A text box here which is editable
      Motor2: A text box here which is editable
      Values for motor rotation (30,60,90,180 degree)I m entering from GUI.

      Now,In same way I want to do it through API to rotate Motor1 and Motor2
      Like,
      ./Motor 30 60 (It should rotate as per mentioned value)
      ./Motor 30
      ./Motor 0 60

      Can I get a support on doing this API.

      jsulmJ 1 Reply Last reply
      0
      • S shivaVMC

        Hi Team,
        I m plannig to implement API for the exixting code as mentioned in the begininng of the topic.
        Instead of entering the values from GUI,I want to make the API for the motor function and want to pass the values to that API.The reason to make the API are I want to use these API's in another application where I wanat to calll this API by passing the M1 and M2 values.
        Please any suggestion on this.

        Now I m planning for API implementation for the same.
        Thing is I m using 2 fields like
        Motor1: A text box here which is editable
        Motor2: A text box here which is editable
        Values for motor rotation (30,60,90,180 degree)I m entering from GUI.

        Now,In same way I want to do it through API to rotate Motor1 and Motor2
        Like,
        ./Motor 30 60 (It should rotate as per mentioned value)
        ./Motor 30
        ./Motor 0 60

        Can I get a support on doing this API.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #8

        @shivaVMC What exactly is your question now?
        You need a function with following parameters (if I understood your description correctly):

        • Motor to use (should be enum)
        • Rotation (it looks like you have fix degrees for rotation in this case you can use enum as well)
        enum class Motor
        {
            Motor_1,
            Motor_2
        };
        enum class Rotation
        {
            Rotate_30,
            Rotate_60,
            Rotate_90,
            Rotate_180
        };
        void rotate(Motor motor, Rotation rotation);
        

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        S 1 Reply Last reply
        1
        • jsulmJ jsulm

          @shivaVMC What exactly is your question now?
          You need a function with following parameters (if I understood your description correctly):

          • Motor to use (should be enum)
          • Rotation (it looks like you have fix degrees for rotation in this case you can use enum as well)
          enum class Motor
          {
              Motor_1,
              Motor_2
          };
          enum class Rotation
          {
              Rotate_30,
              Rotate_60,
              Rotate_90,
              Rotate_180
          };
          void rotate(Motor motor, Rotation rotation);
          
          S Offline
          S Offline
          shivaVMC
          wrote on last edited by
          #9

          @jsulm
          Exactly,perfect understanding of my problem.
          Now I want to remove the GUI option for entering the values from GUI,how can I disable that option ?

          jsulmJ 1 Reply Last reply
          0
          • S shivaVMC

            @jsulm
            Exactly,perfect understanding of my problem.
            Now I want to remove the GUI option for entering the values from GUI,how can I disable that option ?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #10

            @shivaVMC I don't understand: in the code I posted there is nothing at all related to any GUI. What do you want to remove?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            S 1 Reply Last reply
            0
            • jsulmJ jsulm

              @shivaVMC I don't understand: in the code I posted there is nothing at all related to any GUI. What do you want to remove?

              S Offline
              S Offline
              shivaVMC
              wrote on last edited by shivaVMC
              #11

              @jsulm
              I want to disable from my application,any option to disable?becasue I want to test this application through another application just by calling this api as ./motor M1,30

              jsulmJ 1 Reply Last reply
              0
              • S shivaVMC

                @jsulm
                I want to disable from my application,any option to disable?becasue I want to test this application through another application just by calling this api as ./motor M1,30

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #12

                @shivaVMC The I would say your API should be a shared library which you can use in any other project. See http://doc.qt.io/qt-5/sharedlibrary.html

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                S 2 Replies Last reply
                3
                • jsulmJ jsulm

                  @shivaVMC The I would say your API should be a shared library which you can use in any other project. See http://doc.qt.io/qt-5/sharedlibrary.html

                  S Offline
                  S Offline
                  shivaVMC
                  wrote on last edited by
                  #13

                  @jsulm
                  Yeah,Exactly right
                  I will check the link and try to create a shared lib.Get back you soon for the doubts if any .

                  :)
                  :)

                  1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @shivaVMC The I would say your API should be a shared library which you can use in any other project. See http://doc.qt.io/qt-5/sharedlibrary.html

                    S Offline
                    S Offline
                    shivaVMC
                    wrote on last edited by
                    #14

                    @jsulm
                    Hi :)
                    I have implemented the library in Qt and have called in C language.
                    facing with the error as,

                    fatal error: QtCore/qglobal.h: No such file or directory
                    #include <QtCore/qglobal.h>

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #15

                      You're likely missing the include path to Qt's includes.

                      How are you building that C project ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      2

                      • Login

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