Signals in visual is not showing up



  • Hi,
    I work with Qt5.2.1 on VS. I have two classes.
    classa.h:
    @
    class classA: public QObject
    {
    Q_Object

    public:
    explicit classA();
    signals:
    void doWorkRequest();
    }
    @

    classb.h

    @
    #include "classa.h"

    class classB: public QObject
    {
    Q_Object

    public:
    explicit classB();
    private slots:
    void doWork();
    private:
    classA* pointA;
    }
    @

    classb.cpp

    @
    #include "classb.h"

    classB::classB()
    {
    pointA = new classA();
    //here I want to add signal-slot connection,
    //but I can't because Visual is not finding
    //signal doWorkRequest();

    // connect(pointA, SIGNAL(doWorkRequest()),
    // this, SLOT(doWork()));
    }
    @

    I have tried to write it on my own, but slot doWork() is not working.
    If anyone have an idea where problem is?


  • Lifetime Qt Champion

    Hi,

    It's not because your IDE doesn't find something that it's not there.

    Once connected (also look at the console output to see if you have an error message related to that), do you ever emit doWorkRequest ?



  • Yes, I emit that signal from other function from classA, here I only omitted it.
    No, I don''t have any error messages related to it.


  • Lifetime Qt Champion

    So, how do you know it's not working ?



  • Ok, I don't know why, but now it works (I have just close visual and open it again). After that connect() works, but I should write it on my own (program doesn't suggest any existing signal from beyond the classB).

    EDIT: I put the breakpoint in slot that should be invoked, and earlier it was not invoked.



  • Maybe you should make it a public slot instead of a private slot.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.