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++).
Related
Problem statement: I have a web page which has widgets on top of it (basically these are injected using JavaScript into the web application). I would like to know if we can find any accessibility violations (WCAG 2.0) in my widgets.
Most of the tools available in the market are capable of scanning through the browser content and give a report of the violations as per WCAG 2.0 (A, AA, AAA).
So I'm specifically looking for a tool which can tell me the violations happening in widgets which are actually not part of web page itself. They are injected into the web application through JavaScript injection.
I would recommend using the Wave tool:
https://chrome.google.com/webstore/detail/wave-evaluation-tool/jbbplnpkjmmeebjpijfedlgcdilocofh
The widget should still be able to capture errors if something is inject to the website since the wave tool only triggers the scan once you initiate it.
If it's an iframe, you can possibly visit the iframe link directly and run the wave tool on the iframe URL page.
However, please note that it is a tool so it can still fail or show some false positives. Manual auditing for accessibility is always recommended.
There is a plugin called Axe - Web Accessibility Testing for Google Chrome.
You can run the audit at any particular point, so as long as you run it after the widgets have initialised it will work.
If you experience issues testing with this tool then there is something actually preventing those widgets being accessed in the first place as I have used this for numerous projects with dynamically loaded content without issue.
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.
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.
I have a customer requirement where they would like to have different windows of a web application on 2 different displays (monitors): data lookup and entry on one screen and a document viewer on the other. The document viewer will be Flash or Silverlight based and loaded in a webpage. The app will be at least partially based on SharePoint. There is a need for communication between the two windows: when for instance a new task is clicked in the "data" view, the accompanying document needs to be opened in the other one.
The difficulties as far as I can determine:
Opening the two windows from within a web app
Actively position the windows on the 2 displays
communication between the two windows
as robust a solution as possible from a user perspective (e.g., re-opening a closed window, tracking changes between them, etc.)
I am looking for pointers in getting this done. I understand that I can launch the second window from Javascript, but that does not give me a lot of control over it. This solution will run in a closed, controlled environment, so limiting the solution to a specific browser (preferably IE8+) or the need to install additional software/components is no problem.
If i were you i would implement this with silverlight and asp.net mvc.
create a state object which describes the state of the 2 windows, this can be consumed and updated by both the silverlight app via web services, and the mvc app via javascript, postbacks or web services.
I have a problem where a Web Application needs to (after interaction from the user via Javascript)
1) open a Windows Forms Application
2) send a parameter to the app (e.g. an ID)
Correspondingly, the Windows Forms Application should be able to
1) send parameters back to the Web Application (updating the URL is ok)
2) open the Web App in a new brower, if it does not exist
If many browser windows are open it's important that the correct one is updated.
Windows Forms Application is in ASP.NET
Browser is IE6+
The applications are controlled and internal for a specific organisation so it's not a question of launching a custom app.
Question A) Is this possible?
Question B) How do I send parameters to an open Windows Forms Application from a Web App?
Question C) If updating the Web App, how do I make sure the right browser is targeted?
What you're asking for is possible but seems awkward.
Trying to call an application from a web page is not something you could do due to security considerations. You could however make a desktop application which would be associated with a certain type of files and then use content-type on the web page to make sure that your app is called when a URL with this type is opened. It would be similar to the way MS Office handles .doc or .xls documents or the Media Player opens the .mp3 or .wmv files.
The second part (opening a particular web page from your application) is easier.
As you should know the address of your web page create a URL string with the parameters you want and open it in default browser (there are plenty of examples on how to do that, a sample is below).
System.Diagnostics.Process.Start("http://example.com?key=value");
If you want to update the page in the already opened browser or use a browser of your choice (i.e. always IE6 instead of Opera or Chrome) then you'll have to do some homework but it's still quite easy.
PokeIn library connects you desktop application to your web application in real time/per user. Moreover, due to its reverse ajax state management, you could consider both of your applications as one.
Check out
http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx
Using VBScript in your Web Page you can call an open Windows Forms application and send keys to it.
This only works on IE though and you need to adjust the security settings to allow ActiveX.
Have a look into "registered protocols" (for example here and here). I know Skype does this to make outward phone calls from a web page. But probably some changes will be needed in the win application to intercept the parameters from the url.
I haven't tried this but it should be possible
No I don't think it's possible.
Think of viruses/trojans/spyware. If it were possible to launch an application from a mere HTML page, it would be very easy to install malware.
Browsers are designed to prevent you from doing that.
You could use clickonce to deploy and start the forms app - this should take care of sending the parameter to the app.
While this may not perfectly fit with your application, what about using a web service and the form?
Also, you can pass parameters to ensure IE6, not Firefox opens.
System.Diagnostics.Process.Start("c:\ie6\ie6.exe http://www.example.com/mypage");
Ok, so I actually found a clue to the web -> winform part.
The following code was handed to me from an web application that sends a parameter to a winform app. I assume this solution has some security factors in play (such as allowing running VBScript (and ActiveX?) in the webpage. That's ok for me though.
The code:
<script type="text/vbscript" language="vbscript">
<!--
Function OpenWinformApp(chSocialSecurityNumber)
Dim oWinformAppWebStart
Set oWinformAppWebStart = CreateObject("WinformAppWebStart.CWinformAppWebStart")
oWinformAppWebStart.OpenPersonForm CStr(chSocialSecurityNumber)
End Function
-->
</script>