Results 1 to 3 of 3

Thread: Dialogs in plugin files

  1. #1
    Join Date
    Aug 2006
    Posts
    25
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Dialogs in plugin files

    Okay this problem is some what complex but anyhow;

    I have a plugin which have the following definition:
    (each class has its own file)
    Qt Code:
    1. class UIDialog : public QDialog, private Ui::Dialog
    2. {
    3. public:
    4. UIDialog() {
    5. setupUi(this);
    6. connect(pushButton, SIGNAL(clicked), this, SLOT(someFunction()));
    7. };
    8. public slots:
    9. void someFunction() {
    10. accept();
    11. };
    12. }
    13.  
    14. class Interface
    15. {
    16. public:
    17. ~Interface() {};
    18. void function1()=0;
    19. };
    20. Q_DECLARE_INTERFACE(Interface,"dk.bhsribe.test/1.0")
    21.  
    22. class InterfaceImpl : public QObject, public Interface
    23. {
    24. Q_OBJECT
    25. Q_INTERFACES(Interface)
    26. public:
    27. void function1() {
    28. UIDialog *win = new UIDialog()
    29. win->exec();
    30. delete win;
    31. };
    32. };
    33. Q_EXPORT_PLUGIN2(inter_imlp,InterfaceImpl)
    To copy to clipboard, switch view to plain text mode 

    and from the main binary the plugin is loaded and a pointer to an instance of Interface
    is returned like this:
    Qt Code:
    1. void Dlg::loadPlugin(int i) {
    2. QPluginLoader loader(FNamePlug[i]); // FNamePlug is a QVector<QString>which holds
    3. // all valid plugin filenames
    4. curInter = qobject_cast<Interface *>(loader.instance());
    5. }
    6.  
    7. void Dlg::runPlugin() {
    8. curInter->function1();
    9. }
    To copy to clipboard, switch view to plain text mode 

    the designed dialog is dislpayed as designed however when I do display the dialog the
    debug tells me:
    warning: Object::connect: No such slot QDialog::someFunction()

    and the intended action for the pushButton can not be called when I click the button.

    Why does Qt think that it is QDialog::someFunction() insted of UIDialog::someFunction()
    I wish to connect the pushbuttons clicked signal to?
    Last edited by bhs-ittech; 25th January 2007 at 12:35.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Dialogs in plugin files

    Quote Originally Posted by bhs-ittech View Post
    warning: Object::connect: No such slot QDialog::someFunction()
    The declaration of UIDialog seems to be missing Q_OBJECT macro.
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    bhs-ittech (25th January 2007)

  4. #3
    Join Date
    Aug 2006
    Posts
    25
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Re: Dialogs in plugin files

    Ups... so it does

    something so simple and I just missed it.

    Many thanks jpn

Similar Threads

  1. plugin loading problem
    By naresh in forum Qt Programming
    Replies: 6
    Last Post: 9th June 2007, 19:05
  2. Replies: 5
    Last Post: 22nd September 2006, 08:04
  3. Plugin woes
    By stevey in forum Qt Programming
    Replies: 8
    Last Post: 24th July 2006, 01:30
  4. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 10:28
  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
  •  
Qt is a trademark of The Qt Company.