Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to create web application using Qt?

Tags:

qt

How to create web application using Qt?

like image 882
yamunamathew123 Avatar asked Aug 03 '11 08:08

yamunamathew123


People also ask

Is Qt good for web development?

Is it a desktop app with web features? If so, yes Qt in general is very good for that. If you mean a kind of server that outputs HTML, then you should use something else because you would have to reinvent many wheels to make it work.

Is Qt good for desktop application?

C++ with Qt are a solid base to build a desktop application. You will have speed, relatively small memory footprint and portability between platforms. You may also use Python and PySide (Qt python binding) at least at the prototype stage, to explore design alternatives.


5 Answers

This depends on what you mean by "web application". If you mean an application that can show parts of a web page in its interface as rendered HTML, like a browser can...yes. Qt incorporates something called QtWebKit:

http://doc.qt.io/qt-5/qtwebkit-index.html

(Note: Back in the olden days it was Microsoft--I think--who first made an embeddable Internet Explorer control so that you could fetch a URL into the midst of some MFC or VB application and run a browser in the midst of your otherwise-form-based application. The event hooks for Microsoft's solution sucked, Qt's are much better.)

Anyway, this is great if you want people to install your application on their machine, where it fetches web data but takes advantages of native features to be richer than a browser could. But be careful because these days native apps have to be really outstanding to surpass the advantage of something that runs in a browser they already have.

HOWEVER If you are trying to use QtCore to push server-side content out and fulfill web requests, that'll be an uphill battle. You might find some related examples if you look hard enough:

https://web.archive.org/web/20100922075100/http://labs.qt.nokia.com/2006/12/20/whats-this-cgi/

Very few people use C++ (much less Qt) to generate web pages server-side. Yet there are still some doing it, even in pretty cool ways:

http://www.webtoolkit.eu/wt

...regardless, QtCreator will be no help in that kind of pursuit.

like image 92
HostileFork says dont trust SE Avatar answered Oct 03 '22 04:10

HostileFork says dont trust SE


The functionality you are asking for does not exist within Qt itself. However, there exists (at least) one third party library that allows some of the Qt code for a desktop app to be re-used to a certain extent for serving up a web app:

http://cutelyst.org/

However, this does not magically allow you to write a QML interface with QML Widgets and have a visual interface accessible via a web browser.

like image 23
Phrogz Avatar answered Sep 29 '22 04:09

Phrogz


What do you mean by "web application"? Is it a desktop app with web features? If so, yes Qt in general is very good for that.

If you mean a kind of server that outputs HTML, then you should use something else because you would have to reinvent many wheels to make it work.

like image 25
laurent Avatar answered Sep 29 '22 04:09

laurent


You'd require to run or embed web server. It would be more whise to turn to a Apache Web Server or Apache Tomcat based approach. Otherwhise you'd run somewhat against the odds.

like image 41
Michael-O Avatar answered Sep 29 '22 04:09

Michael-O


Consider also using some HTTP server library like libonion or Wt. Wt is close in spirit to Qt. However, you won't use Qt itself. libonion is lower level (and you may want to use browser-side Web frameworks like e.g. JQuery or AngularJS with it).

If you already have some Web server, you could consider developing some FastCGI application in C++.

You surely need a good understanding of HTTP protocol and of HTML5 & AJAX.

like image 36
Basile Starynkevitch Avatar answered Oct 02 '22 04:10

Basile Starynkevitch