Choosing a cross-platform GUI technology - qt

We are currently exploring technologies for our new cross-platform GUI;
So far, the strong options on the table are QT and Java, and lately, HTML-5 was put on the table as well.
Our application description (in short):
It's a client-server; it's internal (only employees use it), we have a vpn, so no wqorries regarding security in terms of web-app
The server side is written in C++, and runs on variable possible platforms (Windows, Linux, Unix)
The (GUI) client side should also run on all the above platforms, it's a different process and it communicates with the server via tcp-ip
GUI requirements (in high level):
The GUI client should support drop down menus, buttons, data grids;
The GUI should be dynamic: Widgets' data should be able to change, or be affected by the choosing of options in other widgets; Also, we will need an auto-complete for search boxes, in which the data should be retrieved from the server side or other data source in our control.
So far, we are thinking of writing the new GUI in QT, but we'd like to know if we should seriously consider HTML-5 instead, and make the GUI a web app;
In light of the GUI requirement presented above:
What's the Pros? Cons? Risks?
Thanks,
Gal

Qt comes with QWebView which provides support for HTML5, you can create the basics(login/help etc) in Qt and create the rest of the code in HTML5 displayed via webview avoiding using a browser to do so.
You can even try and explore about JavaFX, its relatively new but has great GUI effects and controls. The dynamic data features will be easy to implement in Java based APIs.

Related

Kotlin FX - Can a TornadoFx App be deploy as a web app?

I am interested in Kotlin GUI system and I found Tornado FX.
I noticed that we can transform javaFX app as a webapp, so my question is : Can we do the same with Tornado FX and if we can, How should we do that?
Anything you can do with JavaFX, you can do with TornadoFX, as it is basically a higher level API on top of JavaFX.
JavaFX itself has no rendering capability that targets the web, but JPro has rather geniously made that possible by "rendering" the JavaFX UI as SVG directly to the browser using WebSockets.
Infact, TornadoFX has special support to make it easier to create JPro based apps.
Your starting point would be https://www.jpro.one/
The TornadoFX guide contains information about how to use JPro as well:
https://github.com/edvin/tornadofx-guide/blob/master/part2/Scopes.md#using-tornadofx-with-jpro
JPro is a commercial offering, starting av 99 EURO per month for one server with 8GB memory at the time of writing (2018-11-20). Each user would get their own instance of the application, though still running within the same JVM.
While this system works remarkably well, it is best suited for situations where there is low latency and preferably high bandwidth between the client and the server, as every event will be transferred over the WebSocket connection. It would typically be a bad choice for a public facing web page, but it is doable. In fact, http://jpro.one is actually a JavaFX app!
Disclaimer: I am not affiliated with JPro, I'm merely telling you about the (only) way to make JavaFX apps available through the browser.

QTP Writing test on Win32 app ObjectSpy not finding object id

I am experienced writing automation tests for web apps using Selenium.
However I now have to automate a Windows Desktop app which I'm new to.
I'm using QTP 11 (old version) and I can get QTP to login type username/password to the desktop app. However when the app loads there are icons like a Windows desktop. I tried using ObjectSpy on the Actions folder icon but it can't find the object ID and it thinks the icon is a WinObject("COMPOSITE")
Also tried using QTP Record feature but the code that it generates uses hardcoded x and y values. I don't want to use x,y values as if the Actions icon moves 3cms left or right in future the test will fail.
e.g.
Window("Loan IQ").WinObject("COMPOSITE").Click 369,33
Need help finding the object ID in a Win32 app. Thanks
First of all you should make sure that UFT is configured to test your application. In the Record and Run Settings dialog, make sure that either _any windows application__ is selected or your app is explicitly listed.
If this doesn't improve the situation you can try using image based testing (aka Insight).
WIN32 Apps can be a nightmare to automate especially with QTP 11, as it is a kinda outdated version. If you want to get stable automation I propose the following:
Upgrade to a newer version of UFT (14+)
This will most probably not help you indentify the objects but will have a lot of new technologies supported that may help you as described in the following steps
Use Image Based Recognition
Even if your screen resolution changes UFT is still able to identify pictures.IT does not use absolute vectors to compare bitmaps but a different technology which I won't go in detailed (long story short, screen resolution changes are okay)
Provide support for your Widgets
Microsoft has 2 frameworks that can be used to provide UI Automation capabilities (initially for people with accessibility needs, but now is used for RPA and GUI Testing). UFT supports the MSAA and UIA frameworks of Microsoft so if your company is ready to implement support for the UI widgets via one of these Technologies, you are on your way for a smooth Test Automation Experience. Please note: This is mostly a huge investment, so if the tool is something internal and not planned for longer term usage, go with the image based Recognition

Does Qt have general-purpose classes besides GUI-related classes?

I have recently regained some interest in learning Qt, but have the following doubt:
Does Qt have enough classes that are not GUI-related?
For example, Python is "batteries-included", .NET is definitely "batteries-included", and as far as I have seen, Android API also has a lot of classes to design and implement application/domain logic, not directly related to visual presentation.
The main reason I am asking is because I don't know C++ and don't plan to learn it deeply (too much time needed), so if I had to take third party C++ libraries all the time and struggle to use them inside Qt projects that would be a strong point against going ahead.
The intended use is mostly to create small desktop apps for personal use while gaining insight on software design good practices - a profession I am slowly migrating to.
I have already used some Python/Pygtk (without IDE) and WPF (in VStudio/ExpressionBlend). In both platforms, most of my work is related to scientific computations, image processing and interactive scientific visualization, and there are good libraries for that either in Python (Numpy, Scipy, Matplotlib, Pandas, PIL, cairo) and .NET(AForge, alglib, System.Media.Media3D). I wonder if the Qt ecosystem is so complete in that regard.
Qt isn't a language in itself, so you can't compare it to Python or .NET. With that being said, Qt does provide general-purpose classes like containers, a Unicode string class, character set encoders/decoders, multimedia, device and file I/O, etc. All these modules are fully documented.
There are also some external modules available for Qt, like Qwt which provides widgets for technical applications.
For other functionality where something Qt-specific isn't available, you can obviously use another appropriate library. Like OpenCV.
Oh, and you can use Qt in Python too, through PyQt.
As far as I know, Qt doesn't have image processing libraries. For that, you'll need to use something like OpenCV. Qt does have libraries for loading most common image types.
However, Qt does extend beyond just GUI classes.
There is a database module that's quite convenient. The concurrency/threading classes are nice. I've enjoyed making use of the Qt Networking classes. The FileIO classes are alright.
These classes/modules are all useful for making platform-independent code. Things like image processing are mostly algorithmic and tend to be platform-independent by nature. So I think they fall out of the scope of the Qt framework. It shouldn't be too difficult, however, to simply find a library that does what you need and link that in to your project.
A lot of the Qt Core services that heltonbiker and Nikos C. mentioned, can be thought of as extensions to C++, a little like std. Although I often prefer the Qt implementations myself. But Qt has gone much further with their libraries, with the I/O, and web services etc...
The QtXML library provides reading and writing of XML files. Traditionally we had always used xerces, but the Qt XML library is almost as simple as .NETs.
The QtNetwork library offers TCP/IP and other networks services
The QtMultimedia library performs playback and recording of audio
and video content to the use of available devices like cameras and
radios.
The QtSQL library interfaces with SQL databases.
And there is much more than that. Although these are probably services that are used to most. The other benefit is that for the most part the implementations are cross platform. So for example using the I/O services does not require you to write separate code for Linux and Windows. That is a general rule, and there are exceptions. But I am sure most people would agree that any of the services they offer are easy to use, and well documented.
Happy coding.
Qt provides ample abstraction besides UI - it comes with a set of functionality enhancing features that come with certain usage paradigms.
Container classes - shallow copy by value, copy on write
Implicit sharing for containers and certain data types
Event driven, signals and slots
A powerful and usable metasystem
Properties
Platform abstraction for a lot of functionality, from file access to network and multithreading
Cross platform atomics (not that important since C++11 atomics)
Settings API
Undo API
OpenGL abstraction (not necessarily UI, custom graphics)
Basic image formats and basic image manipulations
Qt Declarative, a.k.a QtQuick and QML markup (usable for all kind of structure markup BTW)
Dynamic plugin API
Platform abstraction and portability - same code, multiple platforms
High and low level multimedia - audio, video
Sensors and serial port
Unit test
XML, JSON, SQL
An outdated and hopefully soon updated OpenCL abstraction
Last but not least, a lot of 3rd party modules built around Qt fitting a wide range of applications
Honestly, all its missing is support for some more popular formats for file, media encoding/decoding and containers, some parallel and vector abstraction, USB, WIFI/NFC (in the works in an addon module) and it will be 100% versatile.
Note that you can also use Python with Qt, although I have no experience with that, Qt is a very versatile tool that allows for quick and easy application development - and since 5.1 supports pretty much the entire market, with the addition of Android and iOS to the list of supported platforms. It is very useful for creating custom use applications for creative or research purposes.
Although not perfect for every task, Qt is easily the "best of the bunch" of tools you can use in this regard. Unbeatable in terms of portability and very thorough, if not a little bloated for the set of functionality it provides. And finally, it is free, you can even develop commercial applications under LGPL as long as you link dynamically. All in all, it is well worth the investment to learn, the only downside is it lacks uniformity between the old C++ native APIs and the QML runtime, which is actively worked on and is based on JS, so the APIs are a bit different and some glue APIs are required to fuse C++ with JS and QML.
(just for the record, from the official site):
The Foundation: Qt Core Module
The Qt Core module forms the foundation of all Qt-based applications
with core non-graphical classes used by other modules.
Key Functions
File IO, event and object handling
Multi-threading and concurrency
Plugins, setting management
Signals and Slots inter-object communications mechanism
Benefits
Reduce development time and cost by leveraging a complete set of application building blocks
Develop portable code from the ground up with cross-platform functionality

What are the pros and cons in C++ Qt vs Eclipse RCP for cross-platform GUI development?

I am going to develop a new GUI for an existing C++ application. The application works on Windows and Linux, and the communication with GUI is through client/server.
What are the pros and cons between Eclipse RCP and Qt?
Some pros of Qt:
C++ stuff will generally perform better; however, this is arguable.
Qt is the base of Meego, the mobile platform sponsored by Intel, AMD and others; however, its current momentum seems not too high to me. This means you can also create applications for various mobile and generally embedded devices
There are a lot of Qt-based applications out there.
It has a WYSIWYG designer.
Good for small to large projects especially because of QtQuick, which allows the creation of small applications in no time and with almost zero knowledge about C++
Qt has an amazing wrapper in Python called PyQt (there is also the PySide of course), which allows rapid development and slick prototyping. People often use PyQt (or PySide) for the UI-side of a Qt application because of that. You can of course combine with ease Python and Qt in the same application taking advantage of all their strengths (but also weaknesses). This allows relatively fast and smooth development cycles even for large projects
Some cons of Qt:
The code of Qt-based applications make use of some elements that are not part of C++, which have to be converted into C++ by a special preprocessor called moc (Meta-Object Compiler) prior to the actual compilation. You and your build system have to take that into account.
Nokia (former owner of Qt, since it acquired Trollech) has sold it to Digia. However, this does not imply their involvement in the development of the open source Qt has changed.
Some pros of Eclipse RCP:
Eclipse RCP is far more than a graphical toolkit:
It sports a plugin-based architecture that can help distributing functionality among different components (plugins) and keeping control over dependencies among such components (plugins). Eclipse plugin system relies on their own implementation of the Java component system specification called OSGi.
It provides a mechanism to enable decoupled application extensibility called extension points.
There are many Eclipse plugins that you can use in your application and many of them have distribution licenses that are friendly to commercial products.
It has a WYSIWYG designer.
Some cons of Eclipse RCP:
Eclipse uses a custom windowing toolkit called SWT; on each platform it relies on the native graphical layer. On Linux, it relies on Gtk+ (although it's also possible to use Motif), which in my experience (and other's) has performance problems, mostly with widgets that are updated at high rates. Actually many of us embed Swing elements in Eclipse RCP applications to overcome performance problems while keeping Eclipse's extensible architecture; this, however, can bring integration problems. There's a version of SWT that uses Qt as backend, but its incorporation into Eclipse's codebase seems stagnated since October 2010.
Startup time (understood as the time elapsed since the application is launched until it shows up a window) of Eclipse RCP applications can be very long.
If you intend to integrate C++ stuff with Java by means of JNI, be aware that some people find it difficult.
Eclipse has lots and lots of bugs. Eclipse's bugzilla is a very useful resource for the RCP developer.
The more you want you Eclipse RCP application's look&feel and behaviour to differ from Eclipse IDE, the more troubles you will get into.
Eclipse RCP development has a big learning curve, in my opinion.
Using Eclipse RCP for small projects is basically a suicide (unless you are restricting yourself to only creating a plugin or similar). It is meant for medium to large and very large projects due to the complexity of its infrastructure, resource requirements and the above mentioned steep learning curve.
Eclipse RCP is not for mobile development because...it's RCP (Rich Client Platform). If you want to go mobile, this is not for you.
Both their distribution licenses (LGPL/GPL/commercial for Qt, EPL for Eclipse) are flexible enough for most uses, in my opinion. Nevertheless, I am not a lawyer, so I may be mistaken about that.
And of course, other factors like the experience of the developers, their technical skills, the size of the team, concrete requirements, etc, should be taken into account.
BTW, I have much experience in Eclipse RCP but only theoretical knowledge on Qt, so I may be biased/mistaken in my statements.
Now that Qt has an LGPL license I would choose Qt any day of the week over Eclipse RCP.
I have used both to create fairly complex applications.
Since you can use eclipse to develop c++, I am assuming that we are comparing mostly swt/jface vs Qt, and not the eclipse development environment itself.
Some things I have noticed having used both:
1) Qt has better documentation and samples
Other than some half-baked examples on the web, I could find little useful eclipse documentation.
2) Qt has a lot more 'professional' users
There are many professional companies out there using Qt as their UI framework. Given it's three platform support (Windows, Linux, Mac), it is very flexible, and has a lot of backing.
3) Qt tends to be more complete and mature -
Using Eclipse I noticed that quite often the controls, and packages that were available were only partially done, and not quite complete. They were typically developed for someone's use, and only coded as far as that. Qt's controls were almost always a complete design.
4) Styling.
Both Qt and Eclipse render using local platform libraries, so your UI will 'look' like other UIs on the platform you are running on (i.e. Linux vs Windows). However, Qt also provides fairly sophisticated styling functionality that allows you to easily alter the look of any control, and gives you much more control over the look of your application.
With the new declarative language (Qt 4.7.*) you are approaching WPF level of control which is really amazing.
5) UI Designer:
Qt has a much richer Designer that allows you to layout your form, and do basic testing without having to compile any code. The designer also gives you the capability to add interactions between the controls on your form. Ex. Click this button - disable this option
Eclipse also has a form designer, although my experience with it is limited. I did try to use it a couple of times with very limited success. Finally I coded every form by hand through code. That is painful.
6) Interfacing with existing source code
If you don't have this problem, then you are very lucky. Because Qt is c++ based it integrates seamlessly with legacy C and C++ code. Integrating Java and C is not easy.
7) Drawing Libraries
I tried coding some hand-drawn shapes using the swt libraries and was forced to bypass large parts of the swt drawing library, because of the cludge that was in there. Using Qt to do something similar was no trouble at all.
8) Tree and List Models
Eclipse does provide some nice out of the box functionality for propagated data into trees, and lists and things. It is almost as good in Qt, although a little trickier to set up.
9) Application Layout
Eclipse provides some nice functionality to manage 'view's (dock panels), and 'perspectives' (workflows) that if you decide to use them makes life nice and easy. Qt requires you to do this yourself. Qt does have dock panel functionality, but when building a rich application you have to set this up yourself.
Extra Note:
Qt has also provided some extra libraries to support things like xml, etc... So this helps bridge the gap a little between c++ and java for things like this.

How to foster Qt Style sheets use at work?

I'm working with a PyQt application.
My workmates work with Java and they developed a whole framework (java code + xml files) to set different and new UIs to their desktop application.
I told them that Qt has styles sheets. I showed them by example how cool style sheets are.
I did not convince them. They want me to port their java framework to python.
I want to persuade them to use qt style sheets, but I need "serious" and technical arguments.
Examples are not enough.
By using Qt, you are using a commercially backed library that has a full support staff dedicated to maintaining it, not to mention the open source community that also supports it. You do not need to spend time and effort maintaining the UI framework so you can spend more time developing UI components specific to your applications.
Trying to develop a whole UI internally is a lot of work not only in implementation but also testing and maintenance. For such complicated systems, I would always recommend using an established library over doing an internal implementation.

Resources