title: How to write Q_INVOKABLE function with optional parameter?
body: <p>Here is my C++ function</p>
  
  <p>header file:</p>
  
  <pre><code>Q_INVOKABLE void setSelection(qint64 start, qint64 end, qint64 init);
  </code></pre>
  
  <p>body file:</p>
  
  <pre><code>void SelectionModel::setSelection(qint64 start, qint64 end, qint64 init) { 
      ...
  }
  </code></pre>
  
  <p>How can I modify the <code>init</code> parameter into an optional parameter so that </p>
  
  <p>A)</p>
  
  <p>I can call the function from JavaScript as either of:</p>
  
  <pre><code>setSelection(0, 10, 4)
  setSelection(0, 10)
  </code></pre>
  
  <p>B)</p>
  
  <p>I can find out in the C++ code whether the <code>init</code> parameter has been passed or not.</p>