How to make a dialog?

Feel free to ask any question here
Post Reply
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

How to make a dialog?

Post by Eiji Kurihara »

In the function doAction() in the plugin, it is written that
--> you may want to start by asking parameters( with a custom dialog, etc.) .
However to try to add MFC class in QMY_PLUGIN, by the message
"MFC class is added only on MFC project",
I cannot make a MFC dialog . If I check your CloudCompare, there is a QDialog.
But I did not know how to use it.
I am sorry so many questions. But surely I become familiar with your CloudCompare.
Sincerely,
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How to make a dialog?

Post by daniel »

Indeed, we don't use MFC (so as to be portable on Linux and Mac OS).

You have to use Qt for everything that is related to the graphical user interface. You should learn a little bit about Qt first (http://doc.qt.io/qt-5/gettingstarted.html).

And once again you can copy and update the code of other plugins (qPCV, qHPR and qRansacSD have dialogs for instance).
Daniel, CloudCompare admin
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

Re: How to make a dialog?

Post by Eiji Kurihara »

Thank you for your reply. I must study more about Qt.
Probably, I will start this tommorow.
Sincerely,
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

Re: How to make a dialog?

Post by Eiji Kurihara »

I am still strugging to make a dialog. By copying ccPcvDlg.cpp, ccPcvDlg.h, pcvDlg.ui in the qPCV directory, I made qMyPluginDlg.cpp, qMyPluginDlg.h and qMyPluginDlg.ui. Since there is a QtCreator, by changing pcvDlg.ui using the QtCreator, I could make qMyPluginDlg.ui.
For opening and reading ppPcvDlg.h, it needs ui_MyPluginDlg.h corresponding to ui_pcvDlg.h. If I look at ui_pcvDlg.h, it is written,
'Form generated from reading UI file pcvDlg.ui'. So I think there is an easist way to make ui_MyPluginDlg.h from qMyPluginDlg.ui.
Please give me a good advice.
Sincerely,
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How to make a dialog?

Post by daniel »

Indeed you don't have to create the 'ui_XXX.h' files. You just have to run CMake once (it will detect the .ui files in your directory) and then run the compilation of the project once (it will create the 'ui_XXXX.h' files on the first run).
Daniel, CloudCompare admin
Eiji Kurihara
Posts: 24
Joined: Mon Mar 14, 2016 1:35 am

Re: How to make a dialog?

Post by Eiji Kurihara »

Thank you for your teaching. Since my first dialog is so simple, and I have an experience to make a dialog in the unix,
I can make ui_MyPluginDlg.h without running CMake. My dialog is appeared after picking myPlugin dialog.
I try to do your advice when making another dialog.
Sincerely,
Post Reply