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

Feel free to ask any question here
yjf27281181
Posts: 16
Joined: Mon Sep 26, 2016 12:46 am

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

Post 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.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

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

Post 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.
Daniel, CloudCompare admin
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

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

Post 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).
Daniel, CloudCompare admin
suyufeng
Posts: 47
Joined: Wed May 26, 2021 7:04 am

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

Post 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.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

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

Post 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).
Daniel, CloudCompare admin
suyufeng
Posts: 47
Joined: Wed May 26, 2021 7:04 am

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

Post 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).
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

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

Post by daniel »

Sorry, instead of jog, it was 'job' ;)
Daniel, CloudCompare admin
suyufeng
Posts: 47
Joined: Wed May 26, 2021 7:04 am

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

Post 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!
suyufeng
Posts: 47
Joined: Wed May 26, 2021 7:04 am

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

Post 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.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

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

Post 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...
Daniel, CloudCompare admin
Post Reply