Qt is a commonly used cross-platform application development framework. If you are building a Qt application for Windows, you can easily embed Insight3D in your application using the Qt Windows Forms Interop Framework.
Once you have added the Qt Windows Forms Interop framework to your Qt project, adding Insight3D is easy. First, open your Qt project’s properties, and ensure that Common Language Runtime support is enabled:
Next, navigate to the Framework and References property panel, and add the AGI.Foundation.Graphics assembly to the References section of the panel. The AGI.Foundation.Graphics.dll can be found in the Assemblies directory of the AGI Components install location. You can also add references to other AGI Components assemblies if you want to use them within your application:
Before you can use the Windows Forms Interop framework for Qt, you need to initialize it. You can do this by adding the line highlighted below to the entry point for your application:
#include <qtwinforms.h>
...
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QtWinFormsUtils::initWindowsFormsForQt();
...
}
In the QWidget that will host the Insight3D control, add members for the Insight3D control and a QtControlHost widget:
#include <QWidget>
#include <qtwinformscontrolhost.h>
class Insight3DWidget : public QWidget
{
Q_OBJECT
public:
Insight3DWidget();
private:
gcroot<AGI::Foundation::Graphics::Insight3D ^> Insight3D;
QtControlHost *Insight3DHost;
};
Then, when you are ready to instantiate the Insight3D control, you can activate your AGI Components license, create a new Insight3D control, and construct a QtControlHost widget with the Insight3D control and the parent widget:
#include "mainwindow.h"
#include <QVBoxLayout>
Insight3DWidget::Insight3DWidget()
{
AGI::Foundation::Licensing::ActivateLicense("Cut and paste the contents of your .lic file here");
Insight3D = gcnew AGI::Foundation::Graphics::Insight3D();
Insight3DHost = new QtControlHost(Insight3D, this);
QVBoxLayout *vl = new QVBoxLayout();
vl->addWidget(Insight3DHost);
setLayout(vl);
}
At this point, when you construct your widget, you are able to fully use and interact with the Insight3D control in your Qt application. You can continue to build your application utilizing AGI Components as you would with any C++/CLI application.
Hi Mike,
Do you think that Insight3D could be used in a Flash application?
Bruno
ps: congratulation for your great posts. I love the one regarding Insight3D in a web application. That was working in 5min when I expimented that at home