Results 1 to 18 of 18

Thread: Using default implementation, intefaces and Qt plugins (not designer plugins)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Using default implementation, intefaces and Qt plugins (not designer plugins)

    Thanks.
    With default plugin, do you mean the interface?
    No I really mean an implementation of default behavior.
    My problem is not the fact that I have to link to the interface - that is clear - rather, that I wanted each plugin to extend the default behavior of the "default" plugin.

    But my problem was in part based on my "thinking mode".
    I have thought a bit further, and came up with the following solution:
    I will embed the "default" behavior in the application, and have the plugin interface not derive from that class, but only supply the extended/different functionality.
    Then, in my application I can check for plugins, and if found create an instance and asign it to a member, on which I can then call the extended functionality.

    Something like this:
    Qt Code:
    1. //Main app
    2. void MyDefaultClass::work()
    3. {
    4. //... common work for all plugins (therefore no need to be in the plugin)
    5.  
    6. if(m_pPlugin)//initialized at app startup
    7. {
    8. m_pPlugin->particularWork();
    9. }
    10. else this->paricularWork();
    11.  
    12. //... more common work
    13. }
    To copy to clipboard, switch view to plain text mode 

    This may seem trivial now, but at first I thought to have all the work done in each plugin - in other words - I was thinking about a fully functional units before - and none in the application which would just call the plugins, instead of just putting the differences in the plugins, and the common work in the application.
    This allows each pluin to be free of extenal dependencies, and at the same time, deliver the specific behavior.

    I still need to see if on implementation detail level, this is doable, or do my plugins need stuff from the "default" class, and if so, how can I solve it...
    Last edited by high_flyer; 29th December 2010 at 22:11.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Mac OS, plugins that user designer plugins
    By Royceybaby in forum Qt Programming
    Replies: 0
    Last Post: 9th May 2010, 01:40
  2. Designer plugins in Qt Creator
    By stefan in forum Qt Tools
    Replies: 9
    Last Post: 8th March 2010, 05:51
  3. Trying to use QWT plugins in Designer
    By AwareWolf in forum Qwt
    Replies: 4
    Last Post: 13th January 2010, 14:42
  4. Threads in Designer plugins
    By hvengel in forum Qt Tools
    Replies: 2
    Last Post: 3rd January 2009, 19:19
  5. Arthur Plugins demos and designer
    By antonio.r.tome in forum Installation and Deployment
    Replies: 4
    Last Post: 21st March 2006, 14:01

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.