Important: Please read the Qt Code of Conduct -

Concept of Loading a Java UI inside a Qt Window

  • Hello everyone,

    I am trying to write a Qt application that requires a User Interface (UI) written in Java.
    I read about QProcess, but creating a new object with QProcess will create a new window out of the Qt Widget.
    Do you have any idea to wrapp the java executable inside a Qt application?

    Thanks in advance.

  • Moderators

    If the host OS is linux then how about using QX11EmbedContainer for embedding the java UI.

  • This is a good idea... Any example of how I can do it?

  • I am trying to do this :
    #include <QApplication>
    #include <QProcess>
    #include <QString>
    #include <QStringList>
    #include <QX11EmbedContainer>
    #include <QVBoxLayout>
    #include <QPushButton>

    int main(int argc, char *argv[])
    QApplication app(argc, argv);

    QX11EmbedContainer frame;
    QWidget *win = new QWidget();

    QPushButton *button = new QPushButton("Qt");
    QProcess mplayer;
    //mplayer.start("java", QStringList("-wid") << QString::number(frame.winId()) << "MyFirstTest.jar");
    mplayer.start("java -jar MyFirstTest.jar");

    QVBoxLayout *layout = new QVBoxLayout(win);


    return app.exec();
    But it still creates another window.

  • Help please

Log in to reply