Hi,

I am using Qt for the last two years without any real problems but now I am stuck...

It is about the communication about two Qt programs under Windows.
One program, let's call him Client, is developed for Linux and can also run under Windows for test purposes (thank you Qt for the multi platform ).
The other program, called Server, has to run only under Windows. This is a 'Host' program which has several functionality (more like small programs), each placed in a separate tabs using a QTabWidget.

The situation:
Now I want to place the Client inside a new QTab in the Server. With other words: I want to run the executable (using QProcess) and show it on top of a tab of the QTabWidget. Windows already supplies some nice methods for removing the decoration (border,title bar etc..) and change the parent of a window so repainting,resizing,window activation is all taken care by Windows.
When I start my Client using a QProcess I wait for it to be launched, so that there is a window I can talk to. Then I remove the decoration and set the tab of the QTabWidget of the Server as parent.
All done with this code:

Qt Code:
  1. HWND window = findEmbeddedWindow(); // Get/Find the HWND of the 'Client'
  2. if (!window) return;
  3.  
  4. HWND parent = winId(); // HWND of tab of the 'Server'
  5.  
  6. SetParent(window,parent); // WINDOWS CALL
  7.  
  8. long style = GetWindowLong(window,GWL_STYLE); // WINDOWS CALL
  9.  
  10. style &= ~WS_CHILD;
  11. style |= WS_POPUP; // owned window of this one...
  12.  
  13. style &= ~WS_CAPTION;
  14. style &= ~WS_BORDER;
  15. style &= ~WS_THICKFRAME;
  16.  
  17. SetWindowLong(window,GWL_STYLE,style); // WINDOWS CALL
  18.  
  19. QPoint pos = this->mapToGlobal(QPoint(0,0));
  20. QSize size = this->size();
  21.  
  22. SetWindowPos(window,HWND_TOP,0,0,size.width(),size.height(),SWP_FRAMECHANGED); // WINDOWS CALL
To copy to clipboard, switch view to plain text mode 

This all works perfectly, my Client is nicely placed on top of my tab and all the repainting etc. is working perfect.
When I load notepad.exe through the QProcess it's being located on top of my tab and i can open files, edit save, exit etc... everything works fine.

Problem:
However... there is a problem, otherwise I would not post anything...
When I load my Client, or any other QApplication instead of notepad.exe the execatuable is being loaded and nicely placed on the tab.
But my pushbuttons of Client do not respond (slot is never called). When I hoover over a button with my mouse the button get's selected. Which should be. But a press on the mouse has no respond.
Even when I make a small QApplication, containing a QPushButton and a QLineEdit. When the button is pressed, the lineedit says "clicked". This does also not work.

I have set some debugging and I can see that the events for mousePressEvent and mouseReleaseEvent for my QMainWindow are called. However not in the QPushButtons or any other QWidget of the QMainWindow. Installing an eventFilter on the QWidget shows that it receives the QEvent::MouseButtonPress but just doesn't do anything with it.
When i put a QLineEdit in the QMainWindow i can just type stuff in it, that's making it even more stranger for me... Because this means that I can select the LineEdit with my mouse but not click on a PushButton.

I hope someone knows anything about this because I have been testing, debugging and searching the web for some time now...

Ps. Already thanks for reading my first post!