Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]not found slots but the slots thera are!!

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

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 5.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vetryaspa
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

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

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        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 :-(

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • V Offline
              V Offline
              Vetryaspa
              wrote on last edited by
              #6

              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!!! :)

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved