title: C++ class exposed to QML error in fashion TypeError: Property '...' of object is not a function
body: <p>I've successfully exposed a C++ class to QML. It is registered and found in Qt Creator. It's purpose is to connect to a database, as shown in following code:</p>
  
  <pre><code>#ifndef UESQLDATABASE_H
  #define UESQLDATABASE_H
  
  #include &lt;QObject&gt;
  #include &lt;QtSql/QSqlDatabase&gt;
  
  class UeSqlDatabase : public QObject
  {
      Q_OBJECT
  
      Q_PROPERTY(bool m_ueConnected READ isConnected WRITE setConnected NOTIFY ueConnectedChanged)
  
  private:
      bool m_ueConneted;
  
      inline void setConnected(const bool&amp; ueConnected)
          { this-&gt;m_ueConneted=ueConnected; }
  
  public:
      explicit UeSqlDatabase(QObject *parent = 0);
  
      Q_INVOKABLE inline const bool&amp; isConnected() const
          { return this-&gt;m_ueConneted; }
  
      ~UeSqlDatabase();
  
  signals:
      void ueConnectedChanged();
  
  public slots:
      void ueConnectToDatabase (const QString&amp; ueStrHost, const QString&amp; ueStrDatabase,
                                const QString&amp; ueStrUsername, const QString&amp; ueStrPassword);
  };
  
  #endif // UESQLDATABASE_H
  </code></pre>
  
  <p>However, when I try to call method <code>isConnected()</code> from the following QML code</p>
  
  <pre><code>import QtQuick 2.0
  
  Rectangle
  {
      id: ueMenuButton
  
      property string ueText;
  
      width: 192
      height: 64
      radius: 8
  
      states: [
          State
          {
              name: "ueStateSelected"
  
              PropertyChanges
              {
                  target: gradientStop1
                  color: "#000000"
              }
  
              PropertyChanges
              {
                  target: gradientStop2
                  color: "#3fe400"
              }
          }
      ]
  
      gradient: Gradient
      {
          GradientStop
          {
              id: gradientStop1
              position: 0
              color: "#000000"
          }
  
          GradientStop
          {
              position: 0.741
              color: "#363636"
          }
  
          GradientStop
          {
              id: gradientStop2
              position: 1
              color: "#868686"
          }
  
      }
  
      border.color: "#ffffff"
      border.width: 2
      antialiasing: true
  
      Text
      {
          id: ueButtonText
          color: "#ffffff"
          text: qsTr(ueText)
          clip: false
          z: 0
          scale: 1
          rotation: 0
          font.strikeout: false
          anchors.fill: parent
          font.bold: true
          style: Text.Outline
          textFormat: Text.RichText
          verticalAlignment: Text.AlignVCenter
          horizontalAlignment: Text.AlignHCenter
          font.pixelSize: 16
  }
  
      MouseArea
      {
          id: ueClickArea
  
          antialiasing: true
          anchors.fill: parent
  
          onClicked:
          {
              uePosDatabase.ueConnectToDatabase("127.0.0.1",
                                                "testDb",
                                                "testUser",
                                                "testPassword");
              if(uePosDatabase.isConnected()==true)
              {
                  ueMenuButton.state="ueStateSelected";
              }
              else
              {
                  ueMenuButton.state="base state"
              }
          }
      }
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>qrc:/UeMenuButton.qml:92: TypeError: Property 'isConnected' of object UeSqlDatabase(0x1772060) is not a function</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>