3 Attachment(s)
DLL Project + QWidget in external software.
Hello !
First I appologize for my english, I'm french.
I'm building a DLL who contains QWidgets. This DLL is launch by an external software (Flight Simulator X).
I have to SetParent() my Qt window to FSX, but the result is not good ...
I have spent several hours trying to solve this issue but I didn't ...
The problem is that my Qt window is not displaying correctly even not displaying, the style of the Qt window is deleted etc...
If I don't SetParent() my Qt window and FSX main window, my Qt window is displaying correctly.
Code:
HWND lFsxHandle=FindWindow(L"FS98MAIN", NULL);
HINSTANCE hInstance = (HINSTANCE)GetWindowLong(lFsxHandle, GWL_HINSTANCE);
SimConnect_SetSystemState(gSimConnect, "DialogMode", 1, 0, NULL);
qint32 argc = 1;
char *argv[] = {"SDManager"};
int result;
SDManagerFenetre lF;
SetParent(lF.winId(), lFsxHandle);
lF.show();
result = lA.exec();
SimConnect_SetSystemState(gSimConnect, "DialogMode", 0, 0, NULL);
I click on my button who trigger the QtWidget.show() :
Attachment 8377
When I just clik on the Windows Start Button my QtWidget appear :
Attachment 8378
I can find my QtWidget using my mouse to rezize etc .. :
Attachment 8379
I give you my creation code of my Qwidget :
cpp :
Code:
#include "StdAfx.h"
#include "SDManagerFenetre.h"
{
resize(512, 512);
setWindowTitle(tr("SkyDream Manager"));
}
SDManagerFenetre::~SDManagerFenetre()
{
}
void SDManagerFenetre
::showEvent(QShowEvent *event
) {
Q_UNUSED(event);
CenterOnScreen();
}
void SDManagerFenetre::CenterOnScreen()
{
QRect screenGeom
= screen.
screenGeometry(this);
int screenCenterX = screenGeom.center().x();
int screenCenterY = screenGeom.center().y();
move(screenCenterX - width () / 2,
screenCenterY - height() / 2);
}
.h :
Code:
#pragma once
#include <QtGui>
class SDManagerFenetre
: public QWidget{
public:
SDManagerFenetre
(QWidget *parent
= 0);
~SDManagerFenetre(void);
protected:
private:
void CenterOnScreen();
};
Have u an idea ? Thank you in advance.
Re: DLL Project + QWidget in external software.
I thought it was a repaint engine issue, and I tried to use this :
Quote:
AA_MSWindowsUseDirect3DByDefault
public static final Qt.ApplicationAttribute AA_MSWindowsUseDirect3DByDefault
Is a Windows specific attribute, that will make the Direct3D paint engine the default Qt widget paint engine. Note that you can toggle usage of the Direct3D engine on individual QWidgets by setting/clearing the WA_MSWindowsUseDirect3D attribute on a specific widget. This functionality is experimental.
But same thing my window doesn't displaying good when it SetParent with "FS98MAIN"
Thank you.