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. Concept of Loading a Java UI inside a Qt Window
Forum Updated to NodeBB v4.3 + New Features

Concept of Loading a Java UI inside a Qt Window

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.7k Views 1 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.
  • G Offline
    G Offline
    godbod
    wrote on last edited by
    #1

    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.

    L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

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

      157

      1 Reply Last reply
      0
      • G Offline
        G Offline
        godbod
        wrote on last edited by
        #3

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

        L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          godbod
          wrote on last edited by
          #4

          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);
          layout->addWidget(&frame);
          layout->addWidget(button);
          win->setLayout(layout);

          //frame.resize(300,400);
          frame.show();
          win->show();

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

          L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            godbod
            wrote on last edited by
            #5

            Help please

            L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

            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