Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    General and Desktop
    4
    6
    5384
    Loading More Posts
    • 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
      Vetryaspa last edited by

      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 Reply Quote 0
      • M
        mlong last edited by

        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 Reply Quote 0
        • K
          koahnig last edited by

          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 Reply Quote 0
          • ?
            Guest last edited by

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

            1 Reply Last reply Reply Quote 0
            • A
              andre last edited by

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

              1 Reply Last reply Reply Quote 0
              • V
                Vetryaspa last edited by

                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 Reply Quote 0
                • First post
                  Last post