Results 1 to 12 of 12

Thread: How to initialize a QProcess in the following windows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: How to initialize a QProcess in the following windows

    Try m_opc_ua_server->state() == QProcess::Running instead.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  2. The following user says thank you to jefftee for this useful post:

    Max Fleischer (10th March 2017)

  3. #2
    Join Date
    Mar 2017
    Posts
    12
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to initialize a QProcess in the following windows

    Thanks, that's working.

  4. #3
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: How to initialize a QProcess in the following windows

    Great, also, to "share" the QProcess with other classes, either pass the QProcess pointer to the other class' constructor or create a getter method in the class that creates/owns the QProcess, for example:

    Qt Code:
    1. QProcess* control_window::get_process()
    2. {
    3. return m_opc_ua_server;
    4. }
    To copy to clipboard, switch view to plain text mode 
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  5. #4
    Join Date
    Mar 2017
    Posts
    12
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to initialize a QProcess in the following windows

    How can I pass the QProcess Pointer to the constructor?
    I tried to use a getter function but the UI still crashes when I write to the process from control_window. I've put the getter function in the header of configuration_window.

    configuartion window header:

    Qt Code:
    1. #ifndef CONFIGURATION_WINDOW_H
    2. #define CONFIGURATION_WINDOW_H
    3.  
    4. #include <QMainWindow>
    5. #include <QProcess>
    6.  
    7. class version_selection;
    8. class control_window;
    9.  
    10. namespace Ui {
    11. class configuration_window;
    12. }
    13.  
    14. class configuration_window : public QMainWindow
    15. {
    16. Q_OBJECT
    17.  
    18. public:
    19. explicit configuration_window(QWidget *parent = 0);
    20. ~configuration_window();
    21.  
    22. void send_input_to_server();
    23.  
    24. QProcess *get_process()
    25. {
    26. return m_opc_ua_server;
    27. }
    28. void set_process(QProcess *server)
    29. {
    30. m_opc_ua_server = server;
    31. }
    32.  
    33. private slots:
    34. void on_configuration_window_Exit_clicked();
    35.  
    36. void on_configuration_window_Back_clicked();
    37.  
    38. void on_configuration_window_Start_clicked();
    39.  
    40. private:
    41. Ui::configuration_window *ui;
    42.  
    43. version_selection *m_version_selection;
    44.  
    45. control_window *m_control_window;
    46.  
    47. QProcess *m_opc_ua_server;
    48. };
    49.  
    50. #endif // CONFIGURATION_WINDOW_H
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QProcess and Windows CreateProcessAsUser
    By dswartz in forum Qt Programming
    Replies: 0
    Last Post: 8th March 2012, 18:18
  2. Qt3/Windows: QProcess and php-cli
    By zaphod.b in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2012, 15:15
  3. Problem using QProcess on Windows XP
    By shopov in forum Newbie
    Replies: 3
    Last Post: 29th April 2010, 12:28
  4. need help for QProcess under windows
    By patcito in forum Qt Programming
    Replies: 4
    Last Post: 26th May 2006, 19:54
  5. Qprocess never end in MS windows
    By antonio.r.tome in forum Qt Programming
    Replies: 12
    Last Post: 23rd February 2006, 12:35

Tags for this Thread

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.