how the functions of QanalogClockPlugin has been called in qwidgetplugins.
-
@hjohn
Hi
For a Designer plugin. The Designer app load the plugin and calls the methods to
get name of the plugin/widgets and other metadata to show in its Widget list so
they can be using while designing. So those functions are being called when the plugin is being loaded by Designer. ( or the loader part)QDesigner is a normal application. Nothing special there.
However, it expects its plugins to have a certain interface/list
of functions to return the data it wants.
The most important being:
QString includeFile() const override; / what include file to use in the UI code gen.
QString name() const override; // what name to list it under in Widget List
QWidget *createWidget(QWidget *parent) override; // ask it to supply a instance to put on formFor your own application, a plugin could have any interface as you then decide the
rules for being a plugin to your application.@mrjj it meaans by using functions like name() and CreatWidget() ,plugin connect with that particular widget.
if so,then if i want to add another widget then i have to just add new values in these two functions.QString widgetPlugins::domXml() const{}
Is this function important to implement.?
-
@mrjj it meaans by using functions like name() and CreatWidget() ,plugin connect with that particular widget.
if so,then if i want to add another widget then i have to just add new values in these two functions.QString widgetPlugins::domXml() const{}
Is this function important to implement.?
Hi
All the functions showed must be implemented.
Its not optional. All must be implemented.Its possible to have same plugin offer more than one widget.
So if u have multiple widgets, there is a better way than
creating multiple plugins for each widget.
But you should wait with that unless one plugin is ok to handle :) -
Hi
All the functions showed must be implemented.
Its not optional. All must be implemented.Its possible to have same plugin offer more than one widget.
So if u have multiple widgets, there is a better way than
creating multiple plugins for each widget.
But you should wait with that unless one plugin is ok to handle :)@mrjj yeah thanks..one last question:
As i know if we work with Widget if have to callWidget w; w.show();
in main.cpp.
But here in this example from qtdocument
http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.htmlthey are not including main.cpp file. Is this possible to run and display widget without main.cpp file
-
@mrjj yeah thanks..one last question:
As i know if we work with Widget if have to callWidget w; w.show();
in main.cpp.
But here in this example from qtdocument
http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.htmlthey are not including main.cpp file. Is this possible to run and display widget without main.cpp file
-
@hjohn
Hi
You can show a widget from anywhere.
But to prevent out of scope issues, you should new itWidget* w = new Widget(this);
w->show();But normally, a plugin for Designer DO NOT open other widgets.
@mrjj said in how the functions of QanalogClockPlugin has been called in qwidgetplugins.:
But normally, a plugin for Designer DO NOT open other widgets.
In example there is only one widget.which is analogclock and that i want to open. In example there is no any w.show();command
-
@mrjj said in how the functions of QanalogClockPlugin has been called in qwidgetplugins.:
But normally, a plugin for Designer DO NOT open other widgets.
In example there is only one widget.which is analogclock and that i want to open. In example there is no any w.show();command
-
When run Example of http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html
it generate
It means that This project is not created in the normal 'Qt-executable' kind format.Maybe because there is no main.cpp file.
what should i add or how to create project so that is get output as a analogClock . -
When run Example of http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html
it generate
It means that This project is not created in the normal 'Qt-executable' kind format.Maybe because there is no main.cpp file.
what should i add or how to create project so that is get output as a analogClock .@hjohn The main.cpp is part of QtDesigner.
So, it is a normal Qt application which loads plug-ins.
Again: a plug-in does NOT have a main.cpp, because it is a plug-in which is loaded by an application.
A plug-in is a library and a library does not have main.cpp. -
Hi
To see the clock there is 2 options.
1:
Compile it as plugin and COPY the DLL to the Designer plugin folder in your Qt installation folder
( or do make install )
Start Creator and then make project as normally with ui and
drag the analog clock to the new form.2:
Dont use as plugin at all.
use the files analogclock.cpp/.h directly in a project
and simply NEW a analog clock and show it.If you just started with Qt/programming. Designer plugins are maybe a bit
hard topic to start with :) -
@hjohn The main.cpp is part of QtDesigner.
So, it is a normal Qt application which loads plug-ins.
Again: a plug-in does NOT have a main.cpp, because it is a plug-in which is loaded by an application.
A plug-in is a library and a library does not have main.cpp. -
@jsulm so how am I supposed to load this plugin?
http://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html -
Hi
To see the clock there is 2 options.
1:
Compile it as plugin and COPY the DLL to the Designer plugin folder in your Qt installation folder
( or do make install )
Start Creator and then make project as normally with ui and
drag the analog clock to the new form.2:
Dont use as plugin at all.
use the files analogclock.cpp/.h directly in a project
and simply NEW a analog clock and show it.If you just started with Qt/programming. Designer plugins are maybe a bit
hard topic to start with :) -
Hi
To see the clock there is 2 options.
1:
Compile it as plugin and COPY the DLL to the Designer plugin folder in your Qt installation folder
( or do make install )
Start Creator and then make project as normally with ui and
drag the analog clock to the new form.2:
Dont use as plugin at all.
use the files analogclock.cpp/.h directly in a project
and simply NEW a analog clock and show it.If you just started with Qt/programming. Designer plugins are maybe a bit
hard topic to start with :)@mrjj said in how the functions of QanalogClockPlugin has been called in qwidgetplugins.:
Start Creator and then make project as normally with ui and
drag the analog clock to the new form.hey thanks.Can u elaborate this , It would be great help.
-
@mrjj said in how the functions of QanalogClockPlugin has been called in qwidgetplugins.:
Start Creator and then make project as normally with ui and
drag the analog clock to the new form.hey thanks.Can u elaborate this , It would be great help.
@hjohn
Well if on windows.
Check what your creator was compiled with.
You need to use same compiler and ca. same Qt version.
Install visual studio 2015 or 2017 with 32 bit !
This is a download from Microsoft site. Not Qt. ( not allowed)
( you cannot use mingw)
Install the Qt for visual studio.
(mingw version cannot be used)
THE ABOVE IS MUST DO! else it wont work.
Then compile the plugin in RELEASE mode and 32 Bit. ( not 64)
Go to its build folder and copy the DLL to
C:\Qt\Tools\QtCreator\bin\plugins\designer
Start Creator and go to design mode
It will be in list to the left.
Scroll down to find it.Note: this is considered intermediate level. :)
-
@hjohn
Well if on windows.
Check what your creator was compiled with.
You need to use same compiler and ca. same Qt version.
Install visual studio 2015 or 2017 with 32 bit !
This is a download from Microsoft site. Not Qt. ( not allowed)
( you cannot use mingw)
Install the Qt for visual studio.
(mingw version cannot be used)
THE ABOVE IS MUST DO! else it wont work.
Then compile the plugin in RELEASE mode and 32 Bit. ( not 64)
Go to its build folder and copy the DLL to
C:\Qt\Tools\QtCreator\bin\plugins\designer
Start Creator and go to design mode
It will be in list to the left.
Scroll down to find it.Note: this is considered intermediate level. :)