Results 1 to 6 of 6

Thread: Best Method for creating Qt GUI with existing C++ script

  1. #1
    Join Date
    Jan 2017
    Posts
    4
    Platforms
    Unix/X11

    Default Best Method for creating Qt GUI with existing C++ script

    Hello everybody

    I am new to Qt and I am enjoying learning about the functionality.

    Although I am not quite sure about how to setup a GUI to work with a script that can already be called as an executable if this is possible.

    I will be running the control code on a RPi 3 and dont know if it would be better to have Qt working with the code on the RPi or the laptop/computer that I will ssh into the RPi from.

    Any help/ direction would be greatly appreciated!

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Best Method for creating Qt GUI with existing C++ script

    At least I can't make much sense of the question, probably others too since no one answered it so far...
    What it is you are trying to do - again - try not to ask yet how (since as you wrote your self you are not really yet sure "how") - but tell us what it is you need, we probably could then point you in the right direction.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jan 2017
    Posts
    4
    Platforms
    Unix/X11

    Default Re: Best Method for creating Qt GUI with existing C++ script

    Ok Thank you for the advice, I will try to improve the clarity of my request.

    I have a C++ control script on a raspberrypi that works through ssh.

    I have a Qt widgets project that displays the two webcam streams from the usb webcams connected to the pi.

    As the C++ control script runs on the pi I can see data in the terminal that I would like to display using an progress bar in Qt GUI and also be able to control the motor speed .

    1. I would like to display the terminal output in the Qt GUI

    2. I would like to use values such as commanded motor speed and actual motor speed (which are refreshed in the terminal output of the control code) to control value indicators (progress bars)

    3. I would like to control the input values (command values of the control code) using text input on the GUI. [When the control is running I can use a command such as "setspeed -motor1 5" to set motor 1 at 5% of maximum rpm] I think this step will be much more difficult as it deals with input.

    What methods would you suggest to a Qt newbie!?

    Thank you for your help.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Best Method for creating Qt GUI with existing C++ script

    Ok, I think I understand *somewhat* now, but still not everything.
    I have a C++ control script on a raspberrypi that works through ssh.
    If its C++ it probably is not a script but an application.
    Maybe you have a script calling a C++ application?
    And, controlling what? - from the following text it seems you mean you want to control camera motors, is that what you mean by "controlling script"?

    The three "I would like" points are clear, good.
    But, what do you mean with suggesting a method?

    The method would be to implement it (not being sarcastic here!).

    I guess what I am missing is the problem description.
    What is the *problem* you are having?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Best Method for creating Qt GUI with existing C++ script

    I have a C++ control script on a raspberrypi that works through ssh.
    This also implies that your Qt program -will not be- running on the RPi, but on the computer you are using to ssh into the RPi. Is that correct? ssh is a separate program from your Qt program and there is no built-in communication between the two. So you will either need to redirect the ssh terminal output to a file, socket, or something else that your Qt program can read from or implement the ssh protocol into your Qt program so you can connect to and run the scripts on your RPi from within the Qt program.

    I do not know enough about Qt's networking libraries to tell you if this is supported already.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  6. #6
    Join Date
    Jan 2017
    Posts
    4
    Platforms
    Unix/X11

    Default Re: Best Method for creating Qt GUI with existing C++ script

    Quote Originally Posted by high_flyer View Post
    The three "I would like" points are clear, good.
    But, what do you mean with suggesting a method?
    I am just not sure if there are multiple ways to do this.
    Could I access the script when running the C Script through QSerialPort or would another function be best suited?

    I saw this thread:

    http://stackoverflow.com/questions/4...ation/40052221

    However, I cannot find the advantages/disadvantages of each method and which method would be easier/more robust solution.
    Also, I am not really sure on how to implement each of these options.

    The control code powers two motors. An RPM value is commanded and the terminal returns the measured rpm of the motors. It is these values I want to command and display in my GUI.

Similar Threads

  1. Qt Script add method
    By bunjee in forum Qt Programming
    Replies: 4
    Last Post: 15th June 2013, 12:35
  2. Replies: 1
    Last Post: 8th September 2012, 06:53
  3. Creating a new form in an existing project
    By raghav in forum Newbie
    Replies: 2
    Last Post: 17th May 2012, 11:06
  4. Replies: 2
    Last Post: 18th May 2011, 10:48
  5. Creating object of other class in Run() method
    By santosh.kumar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 15:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.