Using CEF in a QT application

Discussion of current events and participation in intelligent conversation with other CEF users.

Re: Using CEF in a QT application

Postby Mayhew » Tue Nov 27, 2012 5:49 pm

Okay, I'm inching my way forward and am trying to figure things out from your last post but I have a few more questions.
1) I have libcef_dll_wrapper building as a static archive library but am not sure what to do with it. Is it just statically linked to the target app and libcef_dll_wrapper.a?
2) I assume I need to create a new app for the cefclient_helpers. The cefclient_helper source files are almost identical to the cefclient apps. What is needed in the client_helper app and how is it different than the cefclient?

Thanks for the help. Once I get this going I will provide a writeup on how to get CEF integrated for a new Cocoa or Qt app. That would be good to add to the Wiki. Thanks,
John
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: Using CEF in a QT application

Postby magreenblatt » Tue Nov 27, 2012 5:53 pm

Mayhew wrote:1) I have libcef_dll_wrapper building as a static archive library but am not sure what to do with it. Is it just statically linked to the target app and libcef_dll_wrapper.a?

Your executables need to statically link against libcef_dll_wrapper. It provides the C++ wrapper around the C API exposed by the libcef dynamic library.

Mayhew wrote:2) I assume I need to create a new app for the cefclient_helpers. The cefclient_helper source files are almost identical to the cefclient apps. What is needed in the client_helper app and how is it different than the cefclient?

The scripts referenced from the previous post have inline comments explaining this.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Using CEF in a QT application

Postby Mayhew » Wed Nov 28, 2012 3:04 pm

Okay thanks again for the help. I see the comments about how the various helpers are created by that script.

Are the following assumptions correct?
*For my new mac projcect I need to add a new target consisting of a Cocoa application (with no UI) for my helper.
*This helper, at its most basic, would simply contain a subclass for CefClient and CefApp and have a main() entry point.
*I don't currently need to override or modify the browser or renderer processes sp my CefApp subclass can leave out the delegates. For my basic app on Windows my CefApp subclass is basically empty and it seems to be working perfectly so I assume this would be the same for mac/linux.
*In the main function of this helper app I simply call CefExecuteProcess the same way as the main method in process_helper_mac.cpp.
*This helper links against the libcef_dll_wrapper.a that I create as part of my overall project as well as libcef.dylib
*I need to mimic the various post build script calls that are used in the cefclient xcode project for the helper target

If that is all correct then I can simply mimic the various parts and build phases of the main CefClient itself in my main app.
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: Using CEF in a QT application

Postby magreenblatt » Wed Nov 28, 2012 3:13 pm

Mayhew wrote:Okay thanks again for the help. I see the comments about how the various helpers are created by that script.

Are the following assumptions correct?
*For my new mac projcect I need to add a new target consisting of a Cocoa application (with no UI) for my helper.
*This helper, at its most basic, would simply contain a subclass for CefClient and CefApp and have a main() entry point.
*I don't currently need to override or modify the browser or renderer processes sp my CefApp subclass can leave out the delegates. For my basic app on Windows my CefApp subclass is basically empty and it seems to be working perfectly so I assume this would be the same for mac/linux.
*In the main function of this helper app I simply call CefExecuteProcess the same way as the main method in process_helper_mac.cpp.
*This helper links against the libcef_dll_wrapper.a that I create as part of my overall project as well as libcef.dylib
*I need to mimic the various post build script calls that are used in the cefclient xcode project for the helper target

If that is all correct then I can simply mimic the various parts and build phases of the main CefClient itself in my main app.

On Windows and Linux there is no requirement to have a separate helper app. All correct otherwise.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Using CEF in a QT application

Postby Mayhew » Mon Dec 03, 2012 3:56 pm

Okay, I'm getting closer. I have the bundle built and am mimicking all various xcode post processing steps via a shell script. Currently I can launch my Qt app and the CEF browser window appears but I'm seeing the helper apps icons in the system tray. My helper app has its own bundle and info.plist. Am I missing something to keep them from showing in the tray?
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: Using CEF in a QT application

Postby Mayhew » Mon Dec 03, 2012 5:34 pm

Okay, got it. I needed the "Application is Agent" entry in the plist.
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: Using CEF in a QT application

Postby Mayhew » Tue Dec 11, 2012 2:09 pm

After several weeks I'm admitting defeat on the effort to get a Qt app working with CEF. I thought I was pretty close but am blocked getting it to run outside the debugger. For some unknown reason, when launching outside the debugger the helper processes crash and the browser window never shows up. Running in the debugger seems to work fine. The logs do not seem to provide any useful info either. Short of any new ideas I think the Qt solution is just not feasible.
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: Using CEF in a QT application

Postby robs » Fri Aug 09, 2013 4:14 pm

Just came across this post:

After several weeks I'm admitting defeat on the effort to get a Qt app working with CEF. I thought I was pretty close but am blocked getting it to run outside the debugger. For some unknown reason, when launching outside the debugger the helper processes crash and the browser window never shows up. Running in the debugger seems to work fine. The logs do not seem to provide any useful info either. Short of any new ideas I think the Qt solution is just not feasible.


I just hit a similar problem where the helper was crashing on launch when outside the debugger. I found the problem was that I was building the helper app without the -pie flag being passed to the linker. This is set by adding "-Wl,-pie" to xcode's other linker flags setting.

Hope that helps someone, although maybe a bit late for the original poster. :)

Rob
robs
Mentor
 
Posts: 70
Joined: Wed Jun 05, 2013 2:22 pm

Re: Using CEF in a QT application

Postby orng » Fri Sep 13, 2013 12:11 pm

robs wrote:Just came across this post:

After several weeks I'm admitting defeat on the effort to get a Qt app working with CEF. I thought I was pretty close but am blocked getting it to run outside the debugger. For some unknown reason, when launching outside the debugger the helper processes crash and the browser window never shows up. Running in the debugger seems to work fine. The logs do not seem to provide any useful info either. Short of any new ideas I think the Qt solution is just not feasible.


I just hit a similar problem where the helper was crashing on launch when outside the debugger. I found the problem was that I was building the helper app without the -pie flag being passed to the linker. This is set by adding "-Wl,-pie" to xcode's other linker flags setting.

Hope that helps someone, although maybe a bit late for the original poster. :)

Rob


I just signed up to this forum just to say this:

THANK YOU VERY VERY MUCH!

I've been wrestling all day with trying to figure out why my EH helper process kept crashing and this seems to have fixed it.

Again; Thank You <3
orng
Newbie
 
Posts: 3
Joined: Fri Sep 13, 2013 12:04 pm

Re: Using CEF in a QT application

Postby Derek » Fri Sep 27, 2013 10:57 am

Hello,

Do you have any code or guidelines for running CEF3 with Qt (Windows)?

Thanks,

Derek
Derek
Newbie
 
Posts: 4
Joined: Fri Sep 27, 2013 10:46 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 6 guests