• Uncategorized

About c++ : Displaying-an-external-application-inside-a-QtWidget—Linux

Question Detail

I want to display an external application as gnome-calculator inside a QtWidget. I tried the below code:

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
    QWidget *widget = QWidget::createWindowContainer(window);
    return a.exec();

and I am using this terminal command to get the Window Id for Genome Calculator Process:

xdotool search --pid [Genome_Calculator_Process_ID]

The above command return 2 IDs when I try the first one nothing happens but when I try the second ID I get the following error inside the terminal:

(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

Question Answer

No answer for now.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.