C++ framework for separating UI design from business logic - c++

Is there a c++ framework for building rich desktop applications?
Essentially the important feature I'm looking for similar to Flex4 MXML to separate the visual presentation and application logic into xml. Does Qt4, for example, allow the visual appearance to be specified in xml definition? This is state based, so on events the UI changes and has new visual content like this and this

Yes.
Using Qt's Designer tool, you can separate the UI design into an XML, and then a UI compiler (uic tool) compiles it into a UI class.
Your code uses that class (either by delegation or by inheritance) to show its own GUI.
And throw in Qt's signal-slot mechanism for event handling and you have a heavenly development framework for C++ GUI apps :)
Edit:
Although Qt has a tool to specify UIs in XML, you don't always have to do so. You can create UIs programmatically, but why would anyone do so, right? The day I learnt to use Qt Designer was the day I stopped creating UIs programmatically.
And I personally feel that Qt's paradigm of separating the UI from the event handling code (unlike netbeans UI designer) is aaawwweeesssooommmeee.

Qt does. The XML is compiled into code at build time, so the UI remains static (i.e., you have to re-compile to change it).
Just FWIW, with wxWidgets and XRC you can specify a dynamic UI in XML -- i.e., the XML file remains separate from application and changing the XML file makes matching changes to the UI (within limits, of course).

Related

Using QT for GUI c++

I Have a question about c++ and graphical user interface.
I'm working for a company and I've implemented a c++ code contaning 6-7 different .cpp file. They all contains only basic c++ stuff (pointers,vectors strings etc.)(It does not required any database access or something like that, I only read a file and make some analysis on it). Finally I almost come to end of my project but today my boss said to me that I need to create a simple GUI for my project which I never did before by c++.Therefore, through a couple hours, I've search on the web and I decided to use qt for creating required GUI. Now here is my question, to do that Do I have to write my all codes from the beginning or could I integrate my code into QT ?
Qt integrates well with existing C++ code, even with STL containers and streams. You probably have to change your build system a little bit, because of some tools (MOC = Meta Object Compiler) you need to compile Qt classes. But this isn't usually a huge problem, because this special QObject classes are only used for the GUI part of your application.
You will need some interfacing/conversion/adaption between standard types and Qt types. But in general you should be able to integrate your existing code into a Qt application.
It will be easier to integrate the existing code into a Qt project than integrating Qt code into your existing project.
Which compiler do you use? You should stick to a compiler that is supported by Qt by a pre-built package.

How to create desktop application using fully customized UI?

Have a look at this figure below, which is a Quick Book Enterprise Solution 2014
Judging by its interface (not its DLL), I don't think you can easily guess with what platform/language does the above application was created. Qt? .NET? Java? It has its own border, custom menu, ... etc. In a simple wording, "it has totally customized UI that make it stand from the rest".
What do we need to be able to create this kind of application with fully customized UI? And what if I add cross platform aspect in this application? Different customized widgets in different OSes... but maintaining the same level of UI appearance...
I have previous experience with Qt, .. but I am not sure Qt can do this.. or is it?
For instance, you can write your own plugin similar to the existing qt style plugins.
Here, you can find an example how to write widget based style plugins with Qt 5:
QtWidgets 5.0: Style Plugin Example
You would work with the QStylePlugin plugin interface.
If you are looking into a bit more modern solution, you may find this qml style and theme support documentation useful.

Qt: UI with c++ vs with xml vs with qml

I have started learning qt today and have a question. When I create a project, it comes with *.ui file which is XML kind of file but in the book, I am only creating UI with pure c++(classes). I have heard there is another way of creating the UI with qml.
So, What are pros and cons of each UI creating way?
Thanks in advance
EDIT: I am using QT 5.1.0
Don't forget that you can also embed a QtWebkit view and use HTML directly as the user interface controls.
A lengthy answer with the specifics of each sub-framework could be provided, but the QT project people have already answered this question with a chart of their own:
http://qt-project.org/doc/qt-5.1/qtdoc/topics-ui.html#comparison
The .ui file is generated for/by "visual" design layout tools such as QtDesigner - I would not suggest you generate or edit them by hand; if you choose not to use "visual" or "RAD" GUI design tools then programmatically instantiating widgets in C++ is probably fine.

Is QT the right solution for my cross-platform application?

My App is supposed to run on both Mac and PC. It needs to access the local file system and manipulate it. I also need to be able to resize images and create watermarked images as well as thumbnails. It's important for my user interfaces to look as similar as possible on both platforms.
Therefore I've been looking at QT which seems to be really up to date but I'm not very familiar with C++. I noticed that QT has support for the Webkit engine and wonder if my application UI can be written in HTML and be controlled using C++?
has anyone done this before? Any pros and cons are really appreciated.
Use Qt
Qt has a strong user community and easy-to-use documentation. All of the platform-specific code is packaged up into C++ clases (QImage, QFile, etc.).
Don't Use HTML for a Qt GUI
Caveat: If you plan on using an HTML interface I don't know if Qt is really a good solution. The default UI for Qt is XML-based (at design-time! - at run-time it uses the native platform GUI).
I haven't personally used WebKit to implement any user interfaces with Qt and that is not the intended design. Usually you'll invoke WebKit to display an embedded web page or help file.
Use QML for an HTML-Like Interface in Qt
As pointed out by gvd below, if you want to design your interface using HTML-like technology, then you will want to use QML.
Sources:
http://doc.qt.nokia.com/latest/qimage.html
http://doc.qt.nokia.com/latest/qfile.html
http://doc.qt.nokia.com/latest/qtscript.html
Develop C++ Qt application GUI interfaces in HTML+javascript?
http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeintroduction.html

What is best GUI toolkit to rewrite .NET WPF application to C++?

We have existing WPF application with complicated graphics (rounded edges of the window, speedometer style indicators etc).
Since we rely on .NET our application needs .NET framework. Some users are unwilling to install .NET and we want to provide them with a version that does not need .NET and runs of Windows only (XP,Vista,W7).
Which graphical toolkit we should use to for this scenario?
So far I think Codejock Toolkit Pro is a good adept as we already have GUI in XAML and it could be easier to port GUI to C++.
However, another aspect is download size of the toolkit. We don't want to end up in the situation where toolkit size is so big (e.g. 20-40MB) that's comparable with .NET 4.0 framework size.
I know some of you might think that going back from WPF to C++ is a bad idea, but for our scenario it is absolutely crucial to make user's installation process as easy as possible and .NET framework is a big stumbling block which we are trying to remove.
Sorry I do not have the answer to your question (and I would never ever even dream that I might do such a thing), but I am compelled to tell you as an advice
implementing all the WPF functionality in C++ will take 10-20 times more
installation of a C++ would not be necessarily easier
if you need to make installation easier, use SilverLight
We used QT in one of our projects in past which is Object Oriented and Multi Platform, but QT is mostly like WinForms
As I remember QT keeps UI in xml files too, try to write XSLT from xaml to QT xml. But I don't thik you can do it in complex WPF structures like Triggers or Animation
Have you evaluated QT? Since this relies on XML for UI definition too, it might be easier to port the code to.
You've already gotten a couple of answers recommending Qt -- and I'd agree that's probably your first choice. Note, however, that while Qt does support an XML-based UI description, they seem to be moving away from it toward QML, which is based on JavaScript instead.
Another possibility would be wxWidgets, which also supports an XML-based description of the widgets using XRC.