title: How to pass Qt::ConnectionType to QObject::connect when connecting a lambda?
body: <p>I am connecting lambdas to <code>QObject</code>'s signals:</p>
  
  <pre><code>    QObject::connect(handle, &amp;BatchHandle::progressMax, [this](const ProcessHandle* const self, const int value) {
          this-&gt;maxProgress(value);
      });
  </code></pre>
  
  <p>The code above compiles with no problems.</p>
  
  <p>However it's absolutely necessary that the <code>Qt::QueuedConnection</code> because the <code>handle</code> object will eventually move to another thread.</p>
  
  <p>I added this to my code:</p>
  
  <pre><code>    QObject::connect(handle, &amp;BatchHandle::finished, [this](const ProcessHandle* const self) {
          this-&gt;processIsRunning(false);
      }, (Qt::ConnectionType)Qt::QueuedConnection);
  </code></pre>
  
  <p>Notice how I added explicit cast to make sure it identifies the value type correctly. Result:</p>
  
  <pre><code>1&gt;src\TechAdminServices\database\techCore\processes\import\ImportManagerDialog.cpp(191): error C2664: 'QMetaObject::Connection QObject::connect&lt;void(__cdecl taservices::ProcessHandle::* )(const taservices::ProcessHandle *),Qt::ConnectionType&gt;(const taservices::ProcessHandle *,Func1,const QObject *,Func2,Qt::ConnectionType)' : cannot convert parameter 3 from 'taservices::`anonymous-namespace'::&lt;lambda58&gt;' to 'const QObject *'
  1&gt;          with
  1&gt;          [
  1&gt;              Func1=void (__cdecl taservices::ProcessHandle::* )(const taservices::ProcessHandle *),
  1&gt;              Func2=Qt::ConnectionType
  1&gt;          ]
  1&gt;          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
  </code></pre>
  
  <p>How to get a queued connection when connecting a lambda?</p>