Results 1 to 5 of 5

Thread: plugins with separate windows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2012
    Posts
    90
    Thanks
    5
    Thanked 20 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: plugins with separate windows

    a. when having selected a certain decoder, I want to be able to interact with a set of buttons and sliders on a screen, however, without
    the main program having any knowledge of it (plugins, i.e. it should be possible to add decoders, without the main program having to
    know on beforehand that such a decoder even exists)
    See the second part of my previous post. Here I elaborate a little.
    Qt Code:
    1. class MainWindow {
    2.  
    3. public:
    4.  
    5. void loadPlugin () {
    6. // here you load plugin
    7. PluginInterface *loadedPlugin = doLoad ();
    8. // Now call defined in the interface method to create widget that contains
    9. // buttons and sliders specific for that plugin
    10. QWidget pluginWindow = loadedPlugin->createPluginWindow ();
    11. // And add this widget to our mainwindow
    12. // Of course you can add specific widget(say QFrame) to be the exact container for child
    13. // widget (with plugin controls)
    14. pluginWindow->setParent(this);
    15. this->ui->centralLayout->addWidget (pluginWindow);
    16. // After that you'll have plugin-specific set of controls ins widget of choice
    17. // Let's just save pointer for subsequent deletion
    18. this->plugWindow= pluginWindow;
    19. };
    20.  
    21. };
    22.  
    23.  
    24. class PluginInterface {
    25.  
    26. public:
    27. QWidget * createPluginWindow () {
    28. // here you can return QWidget window created in designer beforehand
    29. // It's irrelevant if you want stand-alone window or a widget being a part of the ui
    30. // the return type is the same
    31. // This widget will encapsulate all controls specific for the concrete plugin
    32. return new MyPluginWindow;
    33. };
    34. };
    To copy to clipboard, switch view to plain text mode 

    b. When deallocating a decoder and creating a new decoder I want to have a fresh screen with the visuals of the new decoder. Is it possible to design
    a screen for such a plugin (to be embedded on a fixed location in the main screen) using the designer
    As I already said, you can place QFrame or QWidget in place where you want your plugin and the add plugin widget as a child widget to it.
    Deletion is quite straightforward:
    Qt Code:
    1. class MainWindow {
    2. public:
    3. void cleanUp (){
    4. // here we clean up
    5. this->plugWindow->deleteLater ();
    6. // and can load another plugin
    7. this->loadPlugin ();
    8. // After that the widget gets deleted and a new one will be added
    9. };
    10. };
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to lanz for this useful post:

    janK (20th May 2013)

Similar Threads

  1. Separate Classes for Windows
    By Atomic_Sheep in forum General Programming
    Replies: 2
    Last Post: 14th January 2013, 12:21
  2. Replies: 1
    Last Post: 6th June 2012, 01:41
  3. Qt Designer Must designer plugins be separate libraries?
    By Mookie in forum Qt Tools
    Replies: 0
    Last Post: 30th November 2011, 00:39
  4. Load Plugins on Windows
    By ruben.rodrigues in forum Qt Programming
    Replies: 8
    Last Post: 13th May 2011, 07:39
  5. Application Plugins in Windows [XP]
    By dcurtis in forum Installation and Deployment
    Replies: 10
    Last Post: 9th February 2007, 03:01

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.