title: How to convert QVariant to QJsonValue?
body: <p>How to convert <code>QVariant</code> to <code>QJsonValue</code>?
  I know <code>QVariant</code> provide the <code>toJsonValue</code> function, but it did not perform as expected.</p>
  
  <p>For example:</p>
  
  <pre><code>qDebug()&lt;&lt;QVariant(1.0).toJsonValue();
  qDebug()&lt;&lt;QVariant("test").toJsonValue();
  </code></pre>
  
  <p>Both return:</p>
  
  <pre><code>QJsonValue(null)
  QJsonValue(null)
  </code></pre>
  
  <p>Expect output:</p>
  
  <pre><code>QJsonValue(double, 1)
  QJsonValue(string, "test")
  </code></pre>