[SOLVED]not found slots but the slots thera are!!



  • Hi all,
    I have a problem because I use the Location api for found latitude and longitude, this is my constructor:

    @
    GeoLocalizzazione::GeoLocalizzazione()
    {
    _updateArrived = false;
    _locationInfo = QGeoPositionInfoSource::createDefaultSource(this);
    qDebug() << "Metodi supportati: " << (int)(_locationInfo->supportedPositioningMethods());
    _locationInfo->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods);
    QObject::connect(_locationInfo, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
    QObject::connect(_locationInfo, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
    //_locationInfo->setUpdateInterval(1000);
    _locationInfo->requestUpdate(5000);
    _locationInfo->startUpdates();
    qDebug() << "requestUpdates";
    QTimer::singleShot(30000, this, SLOT(timerExpired()));
    }@

    the log of debug are this:

    @Object::connect: No such slot QWidget::positionUpdated(QGeoPositionInfo) in ..\GamberoRosso\GeoLocalizzazione\geolocalizzazione.cpp:12
    Object::connect: No such slot QWidget::updateTimeout() in ..\GamberoRosso\GeoLocalizzazione\geolocalizzazione.cpp:13
    requestUpdates
    Object::connect: No such slot QWidget::timerExpired() in ..\GamberoRosso\GeoLocalizzazione\geolocalizzazione.cpp:18@

    but this is my h file:

    @
    QTM_USE_NAMESPACE;

    namespace Ui {
    class GeoLocalizzazione;
    }

    class GeoLocalizzazione : public QWidget
    {

    public:
    GeoLocalizzazione();

    private:

    //DICHIARAZIONE VARIABILI
    QString globalNavigation;
    QGeoPositionInfoSource* _locationInfo;
    bool _updateArrived;
    

    protected slots:

    void timerExpired();
    void updateTimeout();
    void positionUpdated(QGeoPositionInfo geoPositionInfo);
    

    };
    @

    why not get the slots?


  • Moderators

    Add the Q_OBJECT macro to your GeoLocalizzazione class definition. Moc needs that to process signals and slots correctly.


  • Moderators

    You may want to add the Q_OBJECT macro in your class definition.
    @
    class GeoLocalizzazione : public QWidget
    {
    Q_OBJECT

    public:
    GeoLocalizzazione();

    private:

    //DICHIARAZIONE VARIABILI
    QString globalNavigation;
    QGeoPositionInfoSource* _locationInfo;
    bool _updateArrived;
    

    protected slots:

    void timerExpired();
    void updateTimeout();
    void positionUpdated(QGeoPositionInfo geoPositionInfo);
    

    };
    @
    [edit] a couple of seconds late :-(



  • Or select a Qt baseclass for your class from the new class dialog and have Creator do it for you :)



  • Note that you probably want to re-run qmake as well, after adding the Q_OBJECT macro.



  • Tnx all, i have put Q_Object macro befor send this post but I not have try to run qmake... now it run!!!

    Tnx All!!! :)


Log in to reply
 

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