Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Public slots not visibl in Squish



  • Hi everyone,
    I have a small applicatio, written in Qt, in which the MainWindow class is having 2 public slots namely:

    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    .
    .
    .
    .
    public slots:
        quint8 GetColorCode();
        QString GetRGBColorCode();
    .
    .
    .
    };
    

    As per the Squish documents, public slots, signals and properties with Q_PROPERTY macro can be accessed directly from Squish environment. Slots and Signals appear under the Squish IDEs method list window.
    But unfortunately I am not able to see the above methods in the Squish IDE method list.
    Is there any specific way to make the public slots available to Squish?

    Regards,
    Bikash



  • Hello @supot.

    Squish for Qt only exposes "public" APIs. You must declare the desired slots public.

    As a test I added...

    public slots:
        int GetColorCode();
        QString GetRGBColorCode();
    

    ...to squish_dir/examples/qt/addressbook/mainwindow.h, and...

    int MainWindow::GetColorCode()
    {
        return 3;
    }
    
    
    QString MainWindow::GetRGBColorCode()
    {
        return QString("3");
    }
    

    ...to squish_dir/examples/qt/addressbook/mainwindow.cpp, compiled the example and loaded it in Squish.

    Afterwards the "Methods" view showed these two methods when selecting the MainWindow object in the "Application Objects" view.

    Regards

    Clemens


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Something to check but your slots looks rather like accessors and not slots.



  • @supot said in Public slots not visibl in Squish:

    But unfortunately I am not able to see the above methods in the Squish IDE method list.

    Have you built your app already after you've added your slots? Try a "clean & rebuild".
    Maybe Squish will recognize them then.



  • @SGaist said in Public slots not visibl in Squish:

    Hi and welcome to devnet,

    Something to check but your slots looks rather like accessors and not slots.

    Thanks @SGaist for the reply. Can this naming convention be an issue here? My intention is to make 2 methods available to Squish by declaring them as public slots.



  • @Pl45m4 said in Public slots not visibl in Squish:

    @supot said in Public slots not visibl in Squish:

    But unfortunately I am not able to see the above methods in the Squish IDE method list.

    Have you built your app already after you've added your slots? Try a "clean & rebuild".
    Maybe Squish will recognize them then.

    Thanks @Pl45m4 for the reply. I am creating a package for test automation team using following steps:

    1. Compiling the code in Release mode (clean build everytime).
    2. Removing all obj/moc .h and .cpp files from release folder leaving only the .exe
    3. Using Windeployqt creating the package. same package is shared with test automation team.
      any issue in the above steps?

  • Lifetime Qt Champion

    As @SGaist already pointed out your slots have a return value for unknown reason. You should try with a slot returning void to make sure Squish will really recognize them as slots. Also you maybe should ask the Squish support - they for sure know what's wrong.



  • Hello @supot.

    Squish for Qt only exposes "public" APIs. You must declare the desired slots public.

    As a test I added...

    public slots:
        int GetColorCode();
        QString GetRGBColorCode();
    

    ...to squish_dir/examples/qt/addressbook/mainwindow.h, and...

    int MainWindow::GetColorCode()
    {
        return 3;
    }
    
    
    QString MainWindow::GetRGBColorCode()
    {
        return QString("3");
    }
    

    ...to squish_dir/examples/qt/addressbook/mainwindow.cpp, compiled the example and loaded it in Squish.

    Afterwards the "Methods" view showed these two methods when selecting the MainWindow object in the "Application Objects" view.

    Regards

    Clemens


Log in to reply