Embedding PCL Viewer on a Qt GUI Main Window - qt

I am trying to develop a user interface using QtCreator on a Windows 7 64-bit machine. This user interface will be deployed on a 32-bit Windows 7 machine, and will control a projector and a camera for a structured-light application. For reasons beyond my control (compatibility with camera and projector's APIs), I will use the MS VS 2010 32bit compiler for this. After a couple of weeks trying to have everything I need working together (Qt 4.8.4, QtCreator and Point Cloud Library), I am now facing a slight problem.
Is there a way that I can embed the PCL Point Cloud Viewer inside my main Qt GUI window? The problem is that when I use the PCL viewer, it brings up a separate window. I want this window to be embedded inside my main window, and I want to still be able to interact with it (rotate, pan, zoom, etc.).
As you may be able to tell from my post, I am a newbie on Qt/PCL/etc., so any example with minimal code to do this would be greatly appreciated. I have done weeks of research on this and I have not been able to find a solution, although I get the impression that a Qt Widget might be the way to go.

You can simply use PCL's PCLVisualizer, which is extensively described here, via the QVTKWidget. This is the setup I'm currently running. So you would end up doing something along the lines of the following (pseudo-)code:
In your header:
class PointCloudWidget : public QVTKWidget
{
//Whatever comes before (constructor, methods, etc.)
private:
pcl::visualization::PCLVisualizer m_visualizer;
};
And in your cpp:
PointCloudWidget::PointCloudWidget(QWidget *parent) : QVTKWidget(parent)
{
this->SetRenderWindow(m_visualizer.getRenderWindow());
}
You can then use the visualizer to achieve the same functionality as the PCL viewer has.

Look at the kind of minimal code I put here (PCL Viewer with Qt GUI minimal code).
There are some redundancies, but the code I believe is pretty straightforward.
The main idea is to put the files in the one folder and start project from CMakeLists.txt (Qt cmake wizard).
I use build directory inside project dir. (this is important, because in pclwindow.cpp I hardcoded the path to the generated file #include "build/ui_pclwindow.h"
If app builds, but crashes you'll probably need to add some dependencies (e.g. dll files on Win platform)
I hope it will give you fast and simple start!

Related

Qt6 integration of 3dconnexion spacemouse devices

hope this finds you well.
I have been wondering if there are any updates regarding qt integration of the spacemouse sdk.
I found this old post https://forum.3dconnexion.com/viewtopic.php?f=19&t=4968 but all the source code files are not present anymore and I don't think I'm skilled enough to rewrite it given the information present in the forum (here's the updated link to the post https://www.codegardening.com/post/2011/2011-02-05-using-the-3dconnexion-mouse-with-a-qt-application/) and honestly it looks strange to me that Qt has not yet made any integration packages for 3d connexion devices.
I am using Visual Studio 16 on a Windows machine in a Qt6 VTK9.2 OpenCV project
I have tried the basic windows way using window handlers but I can't make it work (no input read) as soon as I pass the handler to the qMainWindow as HWND(mainWindow.winId()), while it works fine if I create a dedicated window to read the data.
Could you please give me some suggestions or point me to some resources?

Qt error with reMarkable tablet app

I have a reMarkable tablet , which I mostly love except for the lack of linux support (surprising given it is a linux-based OS). However, I've managed to find a version of a linux application that is now unofficial. This github is actually a Qt docker app, but if you look in the code for the 'Dockerfile' you can find where to download the app, which is apparently still on the server even though there's not a link from the main web page. Anyway, I downloaded it and got it mostly working, figuring out a few dependencies based on same Dockerfile code. But, I can't seem to get file dialogs to work, which is the main reason for using the app.
The error I get is:
ERROR: No native FileDialog implementation available.
Qt Labs Platform requires Qt Widgets on this setup.
Add 'QT += widgets' to .pro and create QApplication in main().
I'm not a Qt developer, so I'm lost. I'd love to get this to work. Thanks.
In the .pro file of you project you should add this line QT += widgets
or just add widgets to the line with QT += ...
Qt can use native file dialogs on some platforms, and will fall back to its own implementation if none is available. But that requires that the application is built including the QtWidgets module, and using a QApplication.
If you don't have the source code of the app and a possiblity to rebuild it, there's no chance to fix this from a binary

How use Point Cloud Library (PCL) in Qt creator?

As part as a master project, I need to create a post-processing app for a 3D scan.
I discovered PCL and I managed to use it on MSVC 2015 and performed few operations with sucess without any GUI.
Now I would like to use PCL with Qt creator.
(like in http://pointclouds.org/documentation/tutorials/qt_visualizer.php).
I am a noob with Qt and I don't know how to include PCL in a project.
If anybody can help me by giving me an orientation on setting up that kind of project, or a property sheet, It'll be great,
I'm working on Windows 7 , 64 bits.
To import a libary (dll) into your Qt project, simply right-click on your Qt solution, choose "Add libary", then extern libary and add the libary path and the include path. This will make the header files accessable for the IDE.
Now you can code!

Show a QWidget in win32 MDI area

I am trying to extend a legacy win32 application functionalities. The legacy application has a Multiple Document Interface(MDI) as it's main window and is purely written in win32 API. Is it possible to show a QWidget in win32 MDI area as a child?
Are you using MFC?
What's important to understand is that running Qt always requires you have a running Qt event loop. So what you need is to properly process your MFC/win32 events an the Qt events.
There is the Qt solution QtWinMigrage for that supports Qt 4 and Qt >= 5.4 (Qt 5.0-5.3 are broken). Examples also show your use case.
This is certainly a good starting point if your application is based on CWinApp.
Further details can be found by searching the internet and reading about the QAbstractEventDispatcher. Hope this helps!

Modify Qt's shared library code while application starts

I'm trying to create some kind of a server which allows me to start Qt's applications on remote machine via web browser.
I'm wondering it is possible to change/hide some symbols from Qt library (I thought about QApplication or QCoreApplication) without making any changes in code of application (I assume that it is already compiled and uses Qt shared library) and compiling my whole tailor-made Qt libs?
The reason why I need to do this is because I want to install my own specific EventFilter to QApplication and also be able to push my own created events to Qt application.
It also would be great if the solution could be used on all platforms :D
P.S. I know that it will not be possible I could subclass QApplication and modify all Qt apps to use my derived class but I would like to do this more craftily. ;-)
The tool GammaRay does all kinds of injecting code into Qt methods at runtime to attach and debug running Qt applications. You might want to have a look at its code base to see how it is done.

Resources