Results 1 to 4 of 4

Thread: How to embed external program in main window.

  1. #1
    Join Date
    Jul 2019
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows

    Question How to embed external program in main window.

    I am using qt creator and i want to embed the external program in main window. I created the codes but if i click push button for external program, then the ui is closed and it says "External WM_DESTROY received for QWidgetWindow(0x1fd65538, name="MainWindowWindow") , parent: QWindow(0x0) , transient parent: QWindow(0x0)". Can anyone help me to figure it out?

    This is my code.

    void MainWindow:n_pushButton_8_clicked()
    {
    QString program = "D:\\my program name.exe";
    QProcess *wicdProgram;
    wicdProgram = new QProcess(this);
    wicdProgram->setProgram(program);
    WId id = QWidget::winId();
    QWindow *window = QWindow::fromWinId(id);
    window->setFlags(Qt::FramelessWindowHint);
    window->show();
    QWidget *widget = QWidget::createWindowContainer(window)

    widget->show();

    setCentralWidget(widget);

    ui->gridLayout->addWidget(widget);
    wicdProgram->start();

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    503
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to embed external program in main window.

    Quote Originally Posted by hajh90 View Post
    ...
    WId id = QWidget::winId();
    ...
    This does not look correct to me. I would think you need the Id of you wicdProgram, but that line gets the Id of your MainWindow.

    Ginsengelf
    Last edited by Ginsengelf; 1st August 2019 at 08:14. Reason: spelling corrections

  3. #3
    Join Date
    Jul 2019
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to embed external program in main window.

    Quote Originally Posted by Ginsengelf View Post
    This does not look correct to me. I would think you need the Id of you wicdProgram, but that line gets the Id of your MainWindow.

    Ginsengelf
    Thank you for reply. Then how can i get the right id?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to embed external program in main window.

    Quote Originally Posted by hajh90 View Post
    Thank you for reply. Then how can i get the right id?
    User shame already answered that in the other thread you posted.

    Cheers,
    _

Similar Threads

  1. QT program start without proper main window
    By s_eye in forum Qt Programming
    Replies: 6
    Last Post: 2nd July 2014, 14:06
  2. embed qt exe in external application
    By rattanas in forum Newbie
    Replies: 0
    Last Post: 5th May 2013, 08:59
  3. Replies: 4
    Last Post: 4th December 2010, 02:52
  4. Embed dialog in main window
    By The_Fallen in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2010, 16:06
  5. Embed external application
    By zeldaknight in forum Qt Programming
    Replies: 0
    Last Post: 21st August 2009, 01:34

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.