Results 1 to 10 of 10

Thread: Qt plugins in Visual Studio 2003

  1. #1
    Join Date
    Mar 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default 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.

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt plugins in Visual Studio 2003

    Quote Originally Posted by micson View Post
    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.

  3. #3
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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

  4. #4
    Join Date
    Mar 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default 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
    Last edited by micson; 14th March 2007 at 19:40.

  5. #5
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt plugins in Visual Studio 2003

    Quote Originally Posted by micson View Post
    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 View Post
    Jacek - do czego to doszło zeby Polacy rozmawiali ze sobą w obcym języku
    IV RP

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt plugins in Visual Studio 2003

    Quote Originally Posted by jacek View Post
    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ł.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt plugins in Visual Studio 2003

    Quote Originally Posted by wysota View Post
    niezależnie od tego cokolwiek ktokolwiek innego by chciał.
    Ten ktokolwiek to pewnie też lewak :P

  9. #9
    Join Date
    Mar 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

  10. #10
    Join Date
    Mar 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt plugins in Visual Studio 2003

    Another issue
    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:

    And this is what I should have:


    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)

Similar Threads

  1. Visual Studio App Wizard for Qt
    By joshlareau in forum Qt-based Software
    Replies: 4
    Last Post: 9th February 2007, 20:36
  2. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  3. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41
  4. Qt Designer & Visual Studio 2005
    By pSiCho in forum Qt Tools
    Replies: 6
    Last Post: 9th February 2006, 13:40
  5. Visual Studio 2003 and .vcproj files
    By mbjerkne in forum General Discussion
    Replies: 2
    Last Post: 1st February 2006, 00:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.