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. Help needed with embedding an application in Qt application
Forum Updated to NodeBB v4.3 + New Features

Help needed with embedding an application in Qt application

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.4k 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.
  • W Offline
    W Offline
    wehrlen
    wrote on last edited by
    #1

    Hello,

    I've tried to embed a Windows application in Qt application.
    I've used the following code to do that:
    @
    wind = FindWindow("some class", "some window");
    QWindow* w = QWindow::fromWinId(reinterpret_cast<WId>(wind));
    QWidget* window = QWidget::createWindowContainer(w);
    window->setParent(this);
    layout->addWidget(m_window);
    @

    I've used QTimer to sample the existence of the window and embed it into my QMainWindow whenever it is being opened.

    The problem is when I'm using the controls of the embedded window (it's a tabbed display based on WIndows API), it's not being redrawn automatically.

    Can anyone help me with that?

    Best regards,
    Alex

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      Never tried anything like this, but maybe setting QWidget::DrawChildren in the container widgets RenderFlags?

      Just a complete guess though. Can you test with something else? Make sure it's not something that the application you are embedding is doing. I.e. use notepad or better yet another simple Qt app. There is a notepad like example in the Qt examples folder.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • W Offline
        W Offline
        wehrlen
        wrote on last edited by
        #3

        Hey,

        I've tried that, but it's not working.
        I think the problem is much deeper and the WinAPI application is not receiving the signals (messages) it is supposed to from the qt application, since I see that it doesn't react to the function keys being pressed as well.

        1 Reply Last reply
        0
        • JKSHJ Online
          JKSHJ Online
          JKSH
          Moderators
          wrote on last edited by
          #4

          Hi,

          There are unfortunately some issues with embedding external applications in Windows. Please add your issues to the comments at https://bugreports.qt-project.org/browse/QTBUG-40320

          Anyway,

          What is m_window?

          Why do you give window a parent without putting it in a layout?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wehrlen
            wrote on last edited by
            #5

            Hi,

            Thanks for the link, I will post the issue there, however:

            1. It's a typo, it's supposed to be window
            2. I already removed that line, just one of the things I've tried. It is a part of a layout though as you can see there.

            I'm continuing to try and find a workaround this issue.
            I've reimplemented the nativeEvent() function in my QMainWindow inheriting class.
            I've tried to see which messages my application receives when I'm using the mouse in the embedded application and from what I've seen the problem is that the embedded application is constantly inactive and that's why it doesn't respond until I do something extreme as changing the layout forcing it redraw itself completely.
            Any ideas as to keep it active?

            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