[Interest] Fwd: External Application window title is missing in QWindow

Sujan Dasmahapatra yellowlemontree0821 at gmail.com
Mon Mar 23 10:46:30 CET 2020


hi Rainer
Thanks for citing the error. Yes I corrected it, but still error is not
going. The problem is that, My window is being shown, but without the
header and menus on top.

It is showing only the central part. On header I have MGL as title which I
am using here to get the window handle

HWND id = FindWindow(NULL, L"MGL");


Is it some thing that the title being used for catching the app, will be
lost when fitting on the widget. My title was originally there on the app
MGL, but when I am
using this with the handle and trying to deploy then it is being lost as
the header and also the menu bar menus not coming. It may be losing in 3
steps possibly,

either FindWindow, or QWindow or QWidget is losing it. But I am unable to
identify it.

Only QWindow is it possible to show on a centralwidget ? if so then how.
Can you give me some code snippet.

regards
sujan




On Mon, 23 Mar 2020 at 11:40, Rainer Wiesenfarth <
rainer_wiesenfarth at trimble.com> wrote:

> Hi Sujan,
>
> I did not follow the rest of the discussion, but at least your sample code
> contains an error:
>
> On Sat, Mar 21, 2020 at 7:38 AM Sujan Dasmahapatra <
> yellowlemontree0821 at gmail.com> wrote:
>
>> [...]
>>
>> /////////////////////////////////////////////////////////////////////////////////////////////////////////
>>
>> int main(int argc, char *argv[])
>>
>> {
>>
>>     QApplication a(argc, argv);
>>
>>     QProcess *process_fusion = new QProcess();
>>
>>     process_fusion->startDetached(".\\MGL.exe  C:\\T1.nii");
>>
>>     Sleep(20000);
>>
>>     //0.00289917 0.28096 -0.180618 = 343    // Windows: Find HWND by window title
>>
>>     HWND id = FindWindow(NULL, L"MGL");
>>
>>     if (!id)
>>
>>         return -1;
>>
>>
>>     // Linux: Find Window ID by running xwininfo externally before compiling this test
>>
>>     //WId id = 0x4600085
>>
>>     QTimer t;
>>
>>     t.start(2500);
>>
>>     // Part 1
>>
>>     QWindow *window = new QWindow;
>>
>>     window->setFlags(Qt::Desktop | Qt::ForeignWindow | Qt::WindowTitleHint);
>>
>>     window = QWindow::fromWinId((WId)id);
>>
>>
> The above line *replaces *your previously created window, including the
> flags you set on it. Maybe this works:
>
> ...
> // Part 1
> QWindow *window = QWindow::fromWinId((WId)id);
> window->setFlags(Qt::Desktop | Qt::ForeignWindow | Qt::WindowTitleHint);
> QWidget *widget = QWidget::createWindowContainer(window);
> ...
>
>
>     QWidget  *widget = QWidget::createWindowContainer(window);
>>
>>     widget->show();
>>
>>     return a.exec();
>>
>> }
>> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>>
>> [...]
>>
>>
> Cheers, Rainer
>
> --
> Software Engineer | Trimble Imaging Division
> Rotebühlstraße 81 | 70178 Stuttgart | Germany
> Office +49 711 22881 0 | Fax +49 711 22881 11
> http://www.trimble.com/imaging/ | http://www.inpho.de/
>
> Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim
> Eingetragen beim Amtsgericht Darmstadt unter HRB 83893,
> Geschäftsführer: Rob Reeder, Jürgen Kesper
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200323/2f19ca73/attachment.html>


More information about the Interest mailing list