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. webengine function does not take 0 arguments
QtWS25 Last Chance

webengine function does not take 0 arguments

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 697 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.
  • elicatE Offline
    elicatE Offline
    elicat
    wrote on last edited by
    #1

    hello,
    I have in file .h :

    Q_PROPERTY(QJsonArray answerToLife READ answerToLife NOTIFY answerToLifeChanged)
    . . . . . 
    public:
    	QJsonArray answerToLife(QJsonArray array_parameter);
    

    In file .cpp i have:

    void EngineIndexHtml::changeAnswerToLife()
    {
    	emit answerToLifeChanged(array_parameter);
    }
    

    When i Build the program i have this error:

    answerToLife': function does not take 0 arguments
    Where I wrong? 
    Thanks for your help

    Saluti, Gianfranco Elicat

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      A read function should not take any parameters. In other words, your declaration should be:

      public:
      	QJsonArray answerToLife() const;
      
      // Or at the very least:
      	QJsonArray answerToLife(QJsonArray array_parameter = QJsonArray()) const;
      

      That's because meta object's property() method needs to be able to call your property getter, and it has no way of knowing what argument to pass.

      (Z(:^

      elicatE 1 Reply Last reply
      2
      • sierdzioS sierdzio

        A read function should not take any parameters. In other words, your declaration should be:

        public:
        	QJsonArray answerToLife() const;
        
        // Or at the very least:
        	QJsonArray answerToLife(QJsonArray array_parameter = QJsonArray()) const;
        

        That's because meta object's property() method needs to be able to call your property getter, and it has no way of knowing what argument to pass.

        elicatE Offline
        elicatE Offline
        elicat
        wrote on last edited by
        #3

        @sierdzio thanks

        Saluti, Gianfranco Elicat

        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