PDA

View Full Version : Best way to open a Qt window from web page?



montylee
16th January 2009, 19:45
I have a web page open in opera browser and on click on a button on the web page, i want to open a Qt window. The web page uses CGI call to start the Qt application. Now, the Qt application to be opened will lay on top of the web page and it will be frameless so that it seems to blend into the web layout. So, i need the window to be frameless.

Now, I want to know how can i open a frameless Qt window from a web page. Should i use QtWebView? or should i just set the window hint to be frameless?
What Qt widget can i use to embed my application window into?

seneca
17th January 2009, 01:14
Not sure how you expect this to work. From a web server you wont be able to display a native operating system window directly on the client pc. Using CGI could only work if the "server" (Apache, IIS) is local, running on the client machine itself. You would than need to locate the browser window and paint the Qt window over it.

IMHO a better approach would be to write a plugin for the browser (using Qt). Still that plugin must first be installed on every client PC that wants to use it.

montylee
17th January 2009, 04:39
Actually my application is on an embedded device. The older version of the application already runs on it and the Qt application is executed from the web browser. The browser is not full fledged Opera but a customized version so i guess they are already using some kind of plugin. The existing application runs full screen from the browser. But my application needs to be of smaller size not full screen.

wysota
17th January 2009, 10:08
If you want to embed your application into some other window, them embed it, not lay it on top of the other application. As already said opera surely has some plugin API available so you can implement your application using that API. Another question is - why not get rid of Opera and switch to WebKit?

montylee
17th January 2009, 23:54
Actually my job is to only build the Qt application. I can't touch Opera and other stuff as it doesn't come under my access. My job is to allow the web page to execute my application by simply calling my application along with some arguments.

Should i just resize the window and set it to frameless and show it on top of web page? If user clicks on the part of the web page behind my application, my application will be hidden and control will be transferred to the web page.

So, is it ok to just resize the window and make it frameless?

wysota
18th January 2009, 01:23
Actually my job is to only build the Qt application. I can't touch Opera and other stuff as it doesn't come under my access. My job is to allow the web page to execute my application by simply calling my application along with some arguments.
So that's not your problem.


Should i just resize the window and set it to frameless and show it on top of web page?
What if the webpage scrolls down or your window's widget take more place than a "hole" in the webpage? What if someone places focus in your application and then wants to scroll down the webpage? Lots of problems...


So, is it ok to just resize the window and make it frameless?

It will work, but the outcome will be... bad. I strongly advise against it. And I really suggest you push the project manager to switch Opera to WebKit. It would solve many problems, this one included.

montylee
18th January 2009, 04:30
Actually there is no scrolling involved. The web page behind my application is a small webpage with no scrolling etc...
Regarding focus, i just need to hide my application if someone clicks outside my application. There is no scrolling etc. involved. Basically the web page won't take any events except click and if user clicks on it my application will be minimized/hidden.

wysota
18th January 2009, 11:49
Why not make that all a single application then? Either get rid of Opera and use QtWebKit which will allow you to embed any widget you like or make your application a plugin to Opera. The current design you have is... sick.

montylee
19th January 2009, 01:37
hmmm, the schedule of this project is tight and i have to provide them my application and an interface to access my application. It's not possible to replace Opera by Qt Webkit at the moment, but in future they might do it.

So, for now, i am thinking of making my Qt window frameless.

wysota
19th January 2009, 09:04
So, for now, i am thinking of making my Qt window frameless.

Suit yourself, just know this bad design will stay as there will always be a deadline for something. I really suggest you implement the application as a plugin to Opera. How hard can it be?

http://www.opera.com/docs/pluginapi/