Results 1 to 2 of 2

Thread: how to use qApp inside a dll?

  1. #1
    Join Date
    Feb 2006
    Posts
    31

    Default how to use qApp inside a dll?

    Hi,

    I have a QT application with a lot of QT widgets. I implement my own MyApplication which inherits from QApplication. In there, I override winEventFilter(). Also, I have some installTranslator code in there.

    The main reason I override winEventFilter() is because I'd like to catch win32 Ctrl+F4 key event.

    My question is if I'd like to convert my application into a DLL, it means I will not have my own MyApplication, how can I catch Ctrl+F4 event before microsoft close my hwnd? And, how do I install my own translation files? Then I'll handle my DLL to my co-workers because he is going to implement a QT application which will then link against my DLL? Can he pass his qApp to my DLL?

    And, where should I put my initialization code (used to be in main()) in a DLL?


    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to use qApp inside a dll?

    Quote Originally Posted by oob2
    The main reason I override winEventFilter() is because I'd like to catch win32 Ctrl+F4 key event.
    Perhaps QShortcut (a.k.a QAccel) will be enough?

    Quote Originally Posted by oob2
    And, how do I install my own translation files?
    Qt defines a global pointer to QApplication instance --- qApp. In Qt4 you can also use QApplication::instance(). All you have to do is to write a function (or a method of singleton class) that will be called to initialize your DLL (note that this should happen after QApplication instance was created).

Similar Threads

  1. [SOLVED] DirectShow Video Player Inside Qt
    By ToddAtWSU in forum Qt Programming
    Replies: 16
    Last Post: 3rd November 2011, 07:47
  2. [Qt4.1] How to insert an image inside a Form?
    By Gonzalez in forum Qt Tools
    Replies: 5
    Last Post: 23rd September 2008, 11:20
  3. Replies: 1
    Last Post: 18th March 2006, 10:18
  4. QScrollArea problem positioning a QWidget inside
    By Spectator in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 22:59
  5. Finding QObjcects in a qApp
    By rianquinn in forum Qt Programming
    Replies: 4
    Last Post: 6th February 2006, 12:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.