Page 1 of 2

If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Sun Oct 02, 2016 5:34 am
by yjf27281181
Hi:

I want to use class ccOverlayDialog in own plugin, when I read the code, I found that cloudcompare use a function called registerMDIDialog which is a protected function to add overlay dialog onto main dialog. However, because the priviledge of this function is protected, I could not call it in my own plugin even I have obtained the pointer of mainWindow. So, if I want to add my own overlay dialog onto mainWindow, what should I do?

ps: I want to write a plugin just like segmentationTools.

Re: If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Mon Oct 03, 2016 8:21 am
by daniel
We need to add the mechanism to let plugins create and register their own 'ccOverlayDialog' instances. That's already in the pipe. I'll try to add this quickly.

Re: If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Thu Oct 06, 2016 5:38 pm
by daniel
Okay,

You can now create your own implementations of ccOverlayDialog (just inherit this class). And then you can 'register' them to the main window (with ccMainAppInterface::registerOverlayDialog).

See how this is done in mainwindow.cpp with other overlay dialogs (see MainWindow::activateSegmentationMode for instance).

Re: If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Fri Jun 11, 2021 9:33 am
by suyufeng
happy weekend!
I am so excited that I found this post.
My plug-in uses qt code to create a Qwidget form, with buttons, labels and other controls on it.
Your registerOverlayDialog() function needs ccOverlayDialog type, but I am qwidget, I don’t know what to do

Qwidget *widget = new Qwidget();
registerOverlayDialog(widget,Qt::TopRightCorner);

For example, I want to hang my form in the upper right corner.

Re: If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Sat Jun 12, 2021 8:29 am
by daniel
Well, the whole purpose of ccOverlayDialog is to let CloudCompare manage it as an overlay widget, repositioning it whenever necessary, etc. ;)

I bet the only solution is to make your widget do the jog (registering to the all the useful signals the various components of CC involved in this process may emit).

Re: If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Tue Jun 15, 2021 1:50 am
by suyufeng
I'm sorry, I can't understand what you mean. Could you explain it?

I bet the only solution is to make your widget do the jog (registering to the all the useful signals the various components of CC involved in this process may emit).

Re: If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Tue Jun 15, 2021 11:03 am
by daniel
Sorry, instead of jog, it was 'job' ;)

Re: If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Tue Jun 15, 2021 12:12 pm
by suyufeng
Hahaha!

I need to fix my plug-in form in the upper right corner. Does cloudcompare currently have plug-ins that I can refer to? Do you have any suggestions? Thank you!

Re: If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Tue Jun 15, 2021 12:28 pm
by suyufeng
I'm sorry, I have so many questions.
I'm in the process of plug-in development, and I'm about to finish, but cc warned!

[Qt WARNING] [] QAbstractItemModel::endInsertRows: Invalid index ( 5 , 0 ) in model ccDBRoot(0x55b5ab379f50)

I can't find a reason for the error.

Re: If I want to use ccOverlayDialog in my own plugin, what should I do?

Posted: Tue Jun 15, 2021 1:13 pm
by daniel
Well, first it's just a warning (not an error). And then, it might mean that you inserted objects in the database that have disappeared afterwards (while still being referenced in the database). This may lead to a crash...