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. Starting an application and view its GUI inside QWidget (Linux)
Forum Updated to NodeBB v4.3 + New Features

Starting an application and view its GUI inside QWidget (Linux)

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 4 Posters 2.2k Views 2 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.
  • B belal

    How to create a C++ application that runs on Linux that can execute processes given their paths and view the GUI of these processes inside the Qt application (Qwidget) as tabs.

    JonBJ Online
    JonBJ Online
    JonB
    wrote on last edited by JonB
    #2

    @belal said in Starting an application and view its GUI inside QWidget (Linux):

    that can execute processes given their paths

    That's easy: QProcess.

    and view the GUI of these processes inside the Qt application (Qwidget) as tabs

    What "GUI" do these unspecified processes have under Linux?

    B 1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #3

      rfb protocol. remote-frame-buffer.

      B 1 Reply Last reply
      0
      • JonBJ JonB

        @belal said in Starting an application and view its GUI inside QWidget (Linux):

        that can execute processes given their paths

        That's easy: QProcess.

        and view the GUI of these processes inside the Qt application (Qwidget) as tabs

        What "GUI" do these unspecified processes have under Linux?

        B Offline
        B Offline
        belal
        wrote on last edited by
        #4

        @JonB Thanks very much for your help. The GUI of the processes like genome-calculator or FireFox

        Belal Hamdy,
        Software Development Engineer.

        JonBJ 1 Reply Last reply
        0
        • Kent-DorfmanK Kent-Dorfman

          rfb protocol. remote-frame-buffer.

          B Offline
          B Offline
          belal
          wrote on last edited by
          #5

          @Kent-Dorfman
          Thanks for the hint.

          Belal Hamdy,
          Software Development Engineer.

          1 Reply Last reply
          0
          • B belal

            @JonB Thanks very much for your help. The GUI of the processes like genome-calculator or FireFox

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #6

            @belal
            You can run these via QProcess from your Qt application. They will open their own windows as they normally do.

            Firefox is a web browser. Qt offers the chromium embedded into a widget via QWebEngine, giving you a Chrome-like browser window if you would accept that instead of Firefox.

            If you can do any embedding of external windows have a look at e.g. https://stackoverflow.com/questions/33699258/qt-5-5-embed-external-application-into-qwidget, https://stackoverflow.com/questions/52608457/qt-5-11-embed-external-application-into-qwidget, etc.

            B 2 Replies Last reply
            1
            • JonBJ JonB

              @belal
              You can run these via QProcess from your Qt application. They will open their own windows as they normally do.

              Firefox is a web browser. Qt offers the chromium embedded into a widget via QWebEngine, giving you a Chrome-like browser window if you would accept that instead of Firefox.

              If you can do any embedding of external windows have a look at e.g. https://stackoverflow.com/questions/33699258/qt-5-5-embed-external-application-into-qwidget, https://stackoverflow.com/questions/52608457/qt-5-11-embed-external-application-into-qwidget, etc.

              B Offline
              B Offline
              belal
              wrote on last edited by
              #7

              @JonB Great. Thanks very much for your help. I will try the mentioned solutions.

              Belal Hamdy,
              Software Development Engineer.

              1 Reply Last reply
              0
              • JonBJ JonB

                @belal
                You can run these via QProcess from your Qt application. They will open their own windows as they normally do.

                Firefox is a web browser. Qt offers the chromium embedded into a widget via QWebEngine, giving you a Chrome-like browser window if you would accept that instead of Firefox.

                If you can do any embedding of external windows have a look at e.g. https://stackoverflow.com/questions/33699258/qt-5-5-embed-external-application-into-qwidget, https://stackoverflow.com/questions/52608457/qt-5-11-embed-external-application-into-qwidget, etc.

                B Offline
                B Offline
                belal
                wrote on last edited by
                #8

                @JonB said in Starting an application and view its GUI inside QWidget (Linux):

                QProcess

                The mentioned answers tends to move the started process GUI to the widget. I want to start a process and view the process GUI only inside the widget but the process will work out of my application.

                Belal Hamdy,
                Software Development Engineer.

                JonBJ jsulmJ 2 Replies Last reply
                0
                • B belal

                  @JonB said in Starting an application and view its GUI inside QWidget (Linux):

                  QProcess

                  The mentioned answers tends to move the started process GUI to the widget. I want to start a process and view the process GUI only inside the widget but the process will work out of my application.

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by
                  #9

                  @belal Don't know what you mean, or what the distinction is.

                  1 Reply Last reply
                  0
                  • B belal

                    @JonB said in Starting an application and view its GUI inside QWidget (Linux):

                    QProcess

                    The mentioned answers tends to move the started process GUI to the widget. I want to start a process and view the process GUI only inside the widget but the process will work out of my application.

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

                    @belal said in Starting an application and view its GUI inside QWidget (Linux):

                    I want to start a process and view the process GUI only inside the widget but the process will work out of my application.

                    That is exactly what it does!

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

                    1 Reply Last reply
                    1
                    • B Offline
                      B Offline
                      belal
                      wrote on last edited by
                      #11

                      @JonB
                      I need to display the GUI of the running QProcess inside the QWidget only. Not to embed the whole process inside the widget. For example I want to start detatched gnome-calculator from QProcess and this will run gnome-calculator normally. Then display the GUI of the process inside a QWidget so whenever a change happens to the process gnome-calculator I should see it inside the widget.

                      Belal Hamdy,
                      Software Development Engineer.

                      JonBJ jsulmJ 2 Replies Last reply
                      0
                      • B belal

                        @JonB
                        I need to display the GUI of the running QProcess inside the QWidget only. Not to embed the whole process inside the widget. For example I want to start detatched gnome-calculator from QProcess and this will run gnome-calculator normally. Then display the GUI of the process inside a QWidget so whenever a change happens to the process gnome-calculator I should see it inside the widget.

                        JonBJ Online
                        JonBJ Online
                        JonB
                        wrote on last edited by
                        #12

                        @belal said in Starting an application and view its GUI inside QWidget (Linux):

                        I need to display the GUI of the running QProcess inside the QWidget only. Not to embed the whole process inside the widget.

                        Don't know what you mean, and will be surprised if @jsulm does either :)

                        Something run via QProcess is a separate process, period. The example code shows how you can cause its UI to appear inside a widget of yours in your app instead of its own window quite outside your Qt app.

                        1 Reply Last reply
                        0
                        • B belal

                          @JonB
                          I need to display the GUI of the running QProcess inside the QWidget only. Not to embed the whole process inside the widget. For example I want to start detatched gnome-calculator from QProcess and this will run gnome-calculator normally. Then display the GUI of the process inside a QWidget so whenever a change happens to the process gnome-calculator I should see it inside the widget.

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

                          @belal said in Starting an application and view its GUI inside QWidget (Linux):

                          Not to embed the whole process inside the widget

                          You can't embed a process in a widget!
                          You can only embed the GUI of another application running in its own process in a widget.
                          And that is what @JonB suggested.
                          Really don't know what else to say here.

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

                          1 Reply Last reply
                          1
                          • B Offline
                            B Offline
                            belal
                            wrote on last edited by belal
                            #14

                            @jsulm @JonB
                            I will show you the error that I get.

                            #include "mainwindow.h"
                            
                            #include <QApplication>
                            #include<QProcess>
                            #include<QDesktopServices>
                            #include<QUrl>
                            #include<QWindow>
                            int main(int argc, char *argv[])
                            {
                                QApplication a(argc, argv);
                                QMainWindow *w = new QMainWindow();
                                w->setWindowTitle("Genome Embedded Calculator");
                                QWindow* window = QWindow::fromWinId(41943047); // Hardcoded Window Id for Genome Calculator
                                window->setFlags(Qt::FramelessWindowHint);
                                QWidget *widget = QWidget::createWindowContainer(window);
                                w->setCentralWidget(widget);
                                w->show();
                                return a.exec();
                            }
                            

                            Here is the code that I am trying to run. I run the genome calculator and get it's WinId by using this command

                            xdotool search --pid [Genome_Calculator_Process_ID]
                            

                            When I run the application I get an error in the terminal says:

                            (gnome-calculator:7284): Gtk-WARNING **: 16:03:49.869: gtk_widget_size_allocate(): attempt to allocate widget with width -33 and height 46
                            
                            (gnome-calculator:7284): Gtk-WARNING **: 16:03:49.869: Negative content width -25 (allocation 1, extents 13x13) while allocating gadget (node button, owner GtkMenuButton)
                            
                            (gnome-calculator:7284): Gdk-WARNING **: 16:03:57.145: GdkWindow 0x2800007 unexpectedly destroyed
                            
                            (gnome-calculator:7284): GLib-GObject-WARNING **: 16:03:57.145: invalid (NULL) pointer instance
                            
                            (gnome-calculator:7284): GLib-GObject-CRITICAL **: 16:03:57.145: g_signal_handler_disconnect: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
                            
                            (gnome-calculator:7284): Gdk-CRITICAL **: 16:03:57.145: gdk_frame_clock_end_updating: assertion 'GDK_IS_FRAME_CLOCK (frame_clock)' failed
                            
                            

                            Belal Hamdy,
                            Software Development Engineer.

                            JonBJ 1 Reply Last reply
                            0
                            • B belal

                              @jsulm @JonB
                              I will show you the error that I get.

                              #include "mainwindow.h"
                              
                              #include <QApplication>
                              #include<QProcess>
                              #include<QDesktopServices>
                              #include<QUrl>
                              #include<QWindow>
                              int main(int argc, char *argv[])
                              {
                                  QApplication a(argc, argv);
                                  QMainWindow *w = new QMainWindow();
                                  w->setWindowTitle("Genome Embedded Calculator");
                                  QWindow* window = QWindow::fromWinId(41943047); // Hardcoded Window Id for Genome Calculator
                                  window->setFlags(Qt::FramelessWindowHint);
                                  QWidget *widget = QWidget::createWindowContainer(window);
                                  w->setCentralWidget(widget);
                                  w->show();
                                  return a.exec();
                              }
                              

                              Here is the code that I am trying to run. I run the genome calculator and get it's WinId by using this command

                              xdotool search --pid [Genome_Calculator_Process_ID]
                              

                              When I run the application I get an error in the terminal says:

                              (gnome-calculator:7284): Gtk-WARNING **: 16:03:49.869: gtk_widget_size_allocate(): attempt to allocate widget with width -33 and height 46
                              
                              (gnome-calculator:7284): Gtk-WARNING **: 16:03:49.869: Negative content width -25 (allocation 1, extents 13x13) while allocating gadget (node button, owner GtkMenuButton)
                              
                              (gnome-calculator:7284): Gdk-WARNING **: 16:03:57.145: GdkWindow 0x2800007 unexpectedly destroyed
                              
                              (gnome-calculator:7284): GLib-GObject-WARNING **: 16:03:57.145: invalid (NULL) pointer instance
                              
                              (gnome-calculator:7284): GLib-GObject-CRITICAL **: 16:03:57.145: g_signal_handler_disconnect: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
                              
                              (gnome-calculator:7284): Gdk-CRITICAL **: 16:03:57.145: gdk_frame_clock_end_updating: assertion 'GDK_IS_FRAME_CLOCK (frame_clock)' failed
                              
                              
                              JonBJ Online
                              JonBJ Online
                              JonB
                              wrote on last edited by
                              #15

                              @belal
                              No idea. Maybe a problem with Gtk/Gdx/gnome-calculator running in the way. Maybe Firefox would work, maybe not. That stackoverflow post shows you what you can do run an external application with input/output to a widget, that's all I know.

                              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