simple GUI addon to existing win console app - c++

I've always been developing simple(console) apps. And even then most problems I had was with starting/porting/CMaking/ libraries to work.
I need to find a gui which is added/used by adding #include "somelibrary.h" to EXISTING c++ project. I've downloaded QT, but it seems I have to create a new QTproject,... and thought alone of including all CUDA,OpenCV,others is making me sick.
I've been experimenting with windows forms (.net?) but there is this managed/unmanaged border with its creepy bugs.
So I'd like to add GUI to existing project (where forms can be designed in completely separate designer).
Do you know any?
Or maybe You'd suggest me different approach?

I suggest you to use CMake and Qt. CMake is better than qmake to manage projects and use additional libraries. Currently Qt is the best multi-platform GUI API.

QT and winforms can be added on to an existing project but it's harder that taking a gui application and adding your project to it. Event driven code is organized differently than procedural code.
You don't need CUDA or OpenCV for a GUI.

Related

Loading Qt libs(different versions) inside an application

We have our application developed in Qt 5.4 which is shipped as an SDK (dylib) for integration with other applications. All the dependent libs are shipped along with the SDK(Qt 5.4.x binaries).
However we bumped into an issue when the customer tried to integrate our SDK in his application. That application is making use of a component which has a Qt 5.3.x dependency. Our SDK has not worked with the application. The issue is due to the fact the "libqcocoa" in platforms is shared, which is leading to a crash.
Can an application be able to load two different Qt binaries(with/without namespace) ? If yes, how this can safely taken care ? (application is in Mac)
I also need to address the point that, the components which are using different Qt versions can be updated independently. What are the best practices generally followed ? Please suggest.
Your use of Qt is usually an implementation detail. Hide it by using private frameworks or linking Qt statically.
Alternatively, if you need to interoperate with the user's Qt, add a small open-source interface that forwards relevant Qt APIs to your code. You'll be surprised at how little Qt most code uses. The interface is likely going to be a couple thousand lines at most and you can machine-generate it.

What Project Template do I choose to make a C++ DirectX DLL?

I have a C# XAML UWP project, and I need some 3D stuff in it.
So I figured using DirectX (which requires C++) is the way to go.
So I want to make a new C++ project that builds to a DLL, and use that in my C# project.
But I can't figure out what Project type to use for that. There are types for libraries, and their are other types for creating DirectX apps, but I can't find any that combines the 2.
This may be a stupid question, but I'm really not that familiar with Visual studio, project templates and building dlls.
You don't need C++ to have 3D in your C# project.
Just google 'directx in c# tutorial'. Also DirectX is not your only option for 3D. You may want to look at OpenGL. Make sure you go through a few tutorials to get some understanding of 3D stuff.
I ended up using the "Windows Runtime Component (Universal Windows)" template.
I don't know if it's the best choice, but it works.

dynamically creating GUI in QT without using forms in visual Studio

I have installed QT5 in visual studio.
I want to create my GUI dynamically at run-time. Hence I cannot use any designers or forms. How do I do that? Which template should I create in visual Studio? Also which QT libraries do I have to include to achieve the same?
Designers and forms are only helpers that end up with generating C++ code that you want to write yourself. So you can create a form (in designer), build your project and see generated code, from which you can learn how to create and setup UI objects. You can then leave those forms aside and write your code using generated one as code snippets.
Anyway, the short answer to you question "how to create my GUI dynamically at run-time" is: create objects of UI classes (such as QMainWindow) and manipulate then using Qt API
Which template should I create in visual Studio? - C++, Win32 Project
which QT libraries do I have to include? - Again, use Qt Creator as a "teacher". Once you have a project built in Qt Ctreator, look at its "Compile output" window. From there you will learn what compiler and linker settings are needed
Practice building the forms in Qt Designer. Then go to Form -> View Code and look at the layout code. This is an example of the C++ code that you can use yourself to build widgets at run time.
When you write your own widget without designer, you can simply subclass QWidget and add buttons, dropdowns, etc. Or you can try overriding paint events to do custom painting.

Qt designer and Creator

I have experience in C++, but I am totally new to Linux programming.
I figured out how to build a GUI, in Qt Designer, but I want to subclass QTextEdit before I create the interface, so I can create my own slots. If I use Qt Creator first, then my code doesn't show up when I switch back to Designer.
Could someone please explain the relationship between Designer and Creator, and how I maneuver between the two?
to keep things simple..
QT Creator it's nothing more nothing less then just an IDE (btw it has Qt Designer components build in, but I still prefer standalone designer).. Editor, front-end to GDB, project management.. mostly everything you can find in other IDE's
QT Designer - user interface editor which produce an XML files which can be used in two ways. 1) process them with MOC preprocessor (part of Qt) which generates you C++ classes for your user interface components 2) (which I prefer much more) load them runtime

Working with Existing C++ code tested under Google Test and adding Qt

I am working on a program written in C++ using some c++0x features in Linux (Ubuntu). I have written a bunch of tests in Google Test. I am using g++ and plain makefiles which generate dependencies.
Now I want to work on a completely separate UI.
I have decided that Qt will be good, but found that it is kind of complicated to build. I see that the easiest thing is to use qmake.
I was wondering how I can build Qt into my application while keeping all the underlying classes independent of Qt. I understand how to do that by writing good code, but I want a good build system.
I don't want to switch to using Qt's unit testing framework because I only want to use Qt for the UI and I don't see the point of rewriting my tests.
Should I use qmake and modify it to produce my google test runner as well as the Qt app?
Should I keep my makefile and use qmake to build and link only the UI parts of the code which will depend on the .o files produced in the original makefile?
Should I do something else?
Finally, how would I do any of those above options?
CMake seems to work well with Qt (based on my experiences with my current project). There are a good set of macros to do all the standard Qt things, plus it integrates reasonably well with other tools. Your initial project may be a bit confusing to setup, but I'm sure there are numerous Qt examples available on the net.
You should not need to switch your testing framework to use CMake. I use the boost test framework, but as far as CMake is concerned any program which uses return codes will work just fine.
There is no reason to even partially use qmake if you use cmake.
Cmake is also cross-platform if that is a concern.
BTW, there is also no reason you have to stop using makefiles. Qt's qmake just calls a bunch of command-line tools which you can also do in make.