Qt plugins in Visual Studio 2003
Hello :)
First of all I have to say that I'm a newbie in Qt, so please forgive me lack of knowledge.:o
What I'm trying to do is to make Qt4 plugins in Visual Studio. I have no problems with typical applications, when I use vcapp template. But how (step by step) to create a plugin for my application? Even the easiest one (for i.e. Dialog window with a message)? Do I need to create another project with vclib template? Or can I use existing vcapp template with my application.
This plugin should be in a *.dll file. In my application I invoke plugin by pressing a button or menu item.
I really need help on this one :/ It's very important for me, any type of support is welcome.
Re: Qt plugins in Visual Studio 2003
Quote:
Originally Posted by
micson
Do I need to create another project with vclib template? Or can I use existing vcapp template with my application.
If you want to create a librrary, then IMO you should rather use vclib template.
Re: Qt plugins in Visual Studio 2003
First off, what sort of plugins are you creating?
To make a plugin for Qt Designer, you ultimately must create a plugin project using a .pro file with:
[code]
CONFIG += designer plugin debug_and_release
TEMPLATE = lib
[\code]
You can still build the custom designer widget in Visual C++ because it's just a dll in the end.
The actual designer plugin is separate from the component you're creating.
So, in Visual Studio implement a Qt library project.
You can test it within an 'application' project type to make sure it works as you expect.
Once all is cool, write your plugin code in a separate project (as per the QtAssistant topic of creating designer plugins), then write a .pro with the entries shown above and you're done.
Other Qt plugins tend to follow a similar pattern.
I hope this helps to clear the fog :)
Steve York
Re: Qt plugins in Visual Studio 2003
Stevey - I don't use QtDesigner at all.
Hmm to try if your solution works I used the "Plug and Paint" example.
As far as I understand I need to create a vcapp template with a base application sources and the vclib with plugin code? Where should I put the dll files? In my application project folder?
I'll try to do it with some examples.
PS. Jacek - do czego to doszło zeby Polacy rozmawiali ze sobą w obcym języku :)
Re: Qt plugins in Visual Studio 2003
If you're using commercial Qt with the VS addin, then when you create a project / solution it will automatically create a folder for debug and release where all the output from the projects will go.
if you're using .pro then generating a visual studio project with qmake then you only stick vcapp in the .pro if you're creating an 'application'. Given that a plugin is not an application then you must make it a vclib (as jacek stated).
I wrote a tiffio plugin which followed the same principles as for all qt plugins.
I made a 'lib' 'plugin' project and had 2 main classes.
It comprised a main class for actually doing the tiff reading and writing, then there was another class which implemented the plugin interface and returned the tiffio class.
Steve York
Re: Qt plugins in Visual Studio 2003
Quote:
Originally Posted by
micson
Where did I make a mistake?
It looks like you are missing "LIBS += -L...-lpnp_basictools". Take a look at main.cpp --- it contains "Q_IMPORT_PLUGIN(pnp_basictools)" line, which means that basictools plugin was meant as an example of a static plugin (i.e. plugin that is linked into the executable).
Quote:
Originally Posted by
micson
Jacek - do czego to doszło zeby Polacy rozmawiali ze sobą w obcym języku :)
IV RP ;)
Re: Qt plugins in Visual Studio 2003
Quote:
Originally Posted by
jacek
Quote:
Jacek - do czego to doszło zeby Polacy rozmawiali ze sobą w obcym języku
IV RP ;)
I'd rather say it's because QtCentre is an international site :] Alternatively you might call it globalisation.
A w ogóle to nadal mamy III RP niezależnie od tego cokolwiek ktokolwiek innego by chciał.
Re: Qt plugins in Visual Studio 2003
Quote:
Originally Posted by
wysota
niezależnie od tego cokolwiek ktokolwiek innego by chciał.
Ten ktokolwiek to pewnie też lewak :P
Re: Qt plugins in Visual Studio 2003
OK looks like I finally understood hot to use static and dynamic libraries :)
Thanks for your help :)
PS. Ja juz czekam na V RP bo ta IV cos kaczkom nie wyszła :crying:
Re: Qt plugins in Visual Studio 2003
Another issue :o
I'm still testing Plug & Paint example.
I build static and dynamic plugins with no problems. The dll pnp_extrafilters.dll is created and moved to plugandpaint/plugins directory. But inside thr applications only static plugin is visible. loader for dynamic plugins returns null.
Here is what I have:
http://img159.imageshack.us/img159/5...0706hg5.th.jpg
And this is what I should have:
http://img114.imageshack.us/img114/9...9852cu7.th.jpg
When I force application to load the plugin (from Project settings in VS) it says that dll is invalid. But why? I didn't modify *.pro files (only change : vclib template instead od lib)