Using CCviewer in another project

Feel free to ask any question here
Post Reply
Zigna
Posts: 2
Joined: Tue Feb 19, 2013 3:09 pm

Using CCviewer in another project

Post by Zigna »

Hi everybody,

I face some problems trying to use ccViewer in another project.
I already have a base project in Qt, and I want to use ccviewer to visualize my .ply files.
What I'm trying to do, is to call ccviewer after my current window by using a slot.
I would like to pass as an argument the path of my .ply file in order to open it.

I saw that the argument were passed in the main.cpp of ccviewer however, I did succeed to pass my filename as an argument.
Do you have any solution/help for me?

The second thing is that i'm want ccviewer to be called by a slot after i click a button on my User interface. What should I call for that?

thanks a lot for your help!

Edit : I manage to use CCviewer in my other project, however i'm not able to call ccviewer constructor ( in ccviewer.h) do you know how?

I use that

Code: Select all

ccViewer *ViewerWindow =  new ccViewer();
ViewerWindow->show();
QMainWindow *currentWindow = ViewerWindow;
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Using CCviewer in another project

Post by daniel »

Hi,
I face some problems trying to use ccViewer in another project.
I'm not sure what you think about when you say 'use in another project': do you want to call it as an external program or do you want to fully integrate it in another (Qt) application?

For the first version, it's quite simple: just call the ccViewer executable with the .ply filename (with full path) as argument. You can do this with the C++ 'system' command or you can use Qt's QProcess class:

Code: Select all

        QString program = "[PathToCCViewer]/ccViewer.exe";
        QStringList arguments;
        arguments << "fullPath/myfile.ply";
        QProcess *myProcess = new QProcess();
        myProcess->start(program, arguments);
Either you hardcode the full path to ccViewer, or you add ccViewer installation directory to your PATH (http://en.wikipedia.org/wiki/Environment_variable).

For the second version... it's not possible as is. ccViewer is a standalone application that has not been designed to be used like this. If you want to do it, you'll have to
  • remove the 'main.cpp' file (but you still have to initialize static structures, etc.)
  • change the fact that ccViewer inherits the QMainWindow class (you can't have two instances of QMainApplication in an application). You'll have to make it a standard QDialog for instance, but you may lose menus by doing so (not sure about that).
Zigna
Posts: 2
Joined: Tue Feb 19, 2013 3:09 pm

Re: Using CCviewer in another project

Post by Zigna »

Hi,

first thanks for the reply!

Indeed I wanted to fully integrate CCviewer in another Qt application, but as you say, it seems quite complicated.
So, I think I will chose the first option that you told, just try to call CC viewer executable ( by the way thanks for writing down the methods! )

I think once I finish the first option I will try to fully integrate it but modifying the program itself. I may come back for a few more information :)

P.S. You are french no? I'm using it in a project for Centrale Lyon, and for what I read CloudCompare was developed in Telecom ParisTech,
nice to see a small "cooperation" between two engineering school :)

Thanks a lot again!
Post Reply