What is qt equalient of normal win32 window



  • Hi,

    I am writting one dll using qt that I wanted to make it run ina cross plattform way(both windows and Linux).
    From this dll I am loading external adobe flash plugin dll(.so in LINUX). My question is I have to pass a HWND to adobe flash plugin from my dll, earlier I was doing it using RegisterWindow(), and CreateWindow() function and was paasing HWND to adobe flash plugin.
    SInce I am moving to make my dll work in both plattofrom, so what qt class will suit best for my window handling.
    Additionally , is it possible to subclass the wndproc of qt window so that I can get the messages posted to that window.?

    Regards
    Ashish


  • Moderators

    I think you can use QWidget::winId() for that. Check documentation for "QWidget":http://developer.qt.nokia.com/doc/qt-4.7/qwidget.html#id-9aaf347d-ee0d-451e-be64-0d82023e7c74.



  • The equivalent is QWidget, which becomes a seperate window if it is shown without a parent. You might receive a native handle using winId() and native messages by reimplementing winEvent().



  • Hi,

    Thanks for your reply. I got the window showing just like a normal win32 window using QWidget, but I have one doubt here.

    To make this window work , First I have created one QApplication object. but I have not called exce() method on that QApplication object because it never returns.

    I am pretty confused from where I should make a call to exec() function.
    My working scenario is mentioned below.

    I wrote one dll, and this dll is getting loaded by Mozilla browser.
    There is some exposed function that is called by Mozilla first, there I am creating QApplication object instance using new. I declare pointer to QApplication as null as a global variable.

    after some function calls sequence goes on Mozilla calls SetWindow() function in my dll , from there I am creating QWidget.

    But I am not getting from where I should cal exec method on QApplication.

    Please help!!!

    Regards
    Ashish



  • The whole point of QApplication::exec() is that it doesn't return. It starts up the eventloop.

    However, I am not sure how to integrate that with writing a plugin for mozilla.



  • Hi,

    I wonder to see that how come I am getting the winEvent and paintEvent in my class that is derived from QWidget.

    As per documentation exec() will run the event loop and will dispatch the message to appropriate Widget , since I didnt call exec() methos neverthless I am getting this events.

    Any suggestions please share.
    Morever, if I will use getDC() function of QWidet to pass DC to some other app of QWidet to draw on widget, can we use same code for Linux also, since it is wriiten like this function is not portable. If not then what could be the other alternative.?



  • [quote author="Ashish Mittal" date="1322728419"]Hi,
    Morever, if I will use getDC() function of QWidet to pass DC to some other app of QWidet to draw on widget, can we use same code for Linux also, since it is wriiten like this function is not portable. If not then what could be the other alternative.?
    [/quote]

    If you use stuff like getDC, winID etc, the code is not portable. This is platform specific stuff and must be implemented for each platform using #if


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.