How to create modeless dialog with electron? - atom-editor

I want to create a modeless dialog with electron, but I found nothing about this topic in the official documents. Can anybody help me?

As it says in its Quick Start guide:
Electron enables you to create desktop applications with pure JavaScript by providing a runtime with rich native (operating system) APIs. You could see it as a variant of the Node.js runtime that is focused on desktop applications instead of web servers.
This doesn't mean Electron is a JavaScript binding to graphical user interface (GUI) libraries. Instead, Electron uses web pages as its GUI, so you could also see it as a minimal Chromium browser, controlled by JavaScript.
So, just use HTML, CSS and javascript! By instance you can use the dialog native element or any other library like Bootstrap, Vex, Bootbox.js, etc.

Related

Using a Shiny html application within a Qt application

Just a general question: is it possible to display & interact with a Shiny-generated html page with charts, dropdown menus and other elements, within a Qt application? I've browsed at some documentation and videos for QtWebKit and WebView, and while mentions of basic html display are covered, I'm just wondering about more-involved uses.
The R code which I have on a VPS displays the Shiny app in html already, and is accessed via direct URL.
It depends on what you mean by "interact": who does the interaction?
A human user interacts directly with the page - that's the easy case. Use the web view.
Qt bundles a complete Chromium web engine. Anything Chrome can do, so can Qt's web view. As long as your page works in the Chrome version that uses the same Chromium version as Qt does, it will be fine in Qt's web view.
Your code interacts with the page - that's more involved. You'll have to add a remote control channel working on top of websockets to interact with the page. It could be as simple as the Qt application sending javascript to execute on the page, and receiving back the json-serialized results. That gives you the most power at the lowest implementation cost (a few dozen lines of javascript and C++).

Is it possible to auto-update native JavaFX apps?

I'd like to have a JavaFX application with native packaging (Windows as well as Linux) where the user can click a button to update to the latest version of the app (or have the update take place automatically). This functionality doesn't appear to be built in. Is there some way to do it?
There is a feature request RT-22211 to allow self-contained JavaFX applications to be updated automatically. This feature request is currently scheduled for implementation for Java 9. In the meantime, take a look at the comments on the feature request which discuss various alternate mechanisms for auto-updating JavaFX applications.

Why should I use Flex instead of JQuery?

I'm working in a webapp with Spring and I always used JSP and Jquery, In a recent conversation, some guy commented: You should use Flex instead.
Would Flex be a good choice for a web app? What are the advantages of using it vs. just JSP and Jquery?
I think you really mean to ask; why should I use Flex instead of JQuery.
JSP is a server side language. Flex or JQuery are client side languages. Flex is not a replacement for JSP any more than JQuery is a replacement for JSP.
Flex can be used to create a Flash Application; which can be deployed in a few different ways.
It can be used to create a browser based application that run in Adobe Flash Player. The Flash Player is only supported on desktop browsers, and there are no viable options to deploy a Flash Platform app to current mobile browsers. I would only recommend this if you had tight control over the machines accessing your application.
It can be used with Adobe AIR to create a desktop application for Windows or Mac machines. I, personally, think the use case for this is even smaller than creating browser based applications.
It can be used with Adobe AIR to create a Native Application on iOS, Android, and Blackberry Playbook. If you are tasked with building a Native Application that needs to be deployed on multiple mobile OSes; I think that Adobe AIR presents an intriguing option.
if you need to build Native mobile applications, and you already know JQuery, I'd recommend investigating options to build your JQuery apps as Native Applications. I know options are out there to convert HTML into Native Applications, but can't comment on them. I see no need to switch your technology unless you are running into limitations. To evaluate Flex ;you'd have to define what those limitations are and then decide whether Flex will help solve them. Usually the time savings of "use what you know" outweigh any benefit that comes from switching technologies.
That said; Flex provides some things that I don't see yet in the "HTML5/JavaScript" space. It has a robust UI Framework that works identically across all the platform targets, a step through debugger, and a memory profiler just to name a few.
The two technologies are completely different. JSP/jQuery would give you a web application. Flex would give you a Flash application.
Personally, if JSP/jQuery would work for you then you should go that route. If you don't need the features of Flex, there's no reason to require the user install the plugin.

Is it possible to create web application using Qt?

How to create web application using Qt?
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.
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.
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.
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.
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.
Since this is 11 years old, I thought I'd come here to tell you that it does indeed seem possible now that qt supports webassembly. The newest version, 6.4 (newest version as of today jan 31 2023), now offers support for webassembly and their website has various examples of apps built with qt that run in the browser.
https://www.qt.io/qt-examples-for-webassembly

Access qt application as web page

I have a qt main-window application from which several dialogs are accessed.
I implemented the server and client versions of the application using tcp/ip using c socket programming.
But now I have been told to make the application accessible to any web browser after username and password have been given using QHttp or any appropriate class.
I'm a beginner and have no idea of implementing this. Could anyone give some tips or examples.
I'm using qt 4.6.2
I'm not sure I understand you. You have a Qt main window which contains some widgets arranged in a GUI. You want those same widgets to be accessible inside a web browser? Then you need to re-create all your GUI code in HTML, CSS and JS.
Your Qt app can use QHttp to listen for incoming client connections. When one of those comes, you reply with a webpage (written in HTML, CSS, JS). When this webpage is received by the user, his browser will display it. When the user interacts with the webpage, you'll probably want to send some data back to the Qt server eventually. You can do this either via form posting or via XMLHttpRequest.
You should know client-side web development is not that simple. Even when you know your languages, there's lots of things to learn about browser compatibility, security, accessiblity, JS app architecture, etc.
You want to make your application into an Http server. Here is an example using Qt to get you started:
http://doc.qt.nokia.com/solutions/4/qtservice/qtservice-example-server.html
As Stefan notes, this means putting your GUI into HTML/CSS/JS and more.

Resources