title: How to force a bluetooth pairing pin with QT?
body: <p>i am writing an apllication in qt on my laptop (Debian 8). This applicatio should connect to other devices like my android smartphones (4.4.2, 5.0.2, 6.0.0). This work great, i can pair and connect, but i want the smartphone and the application to show a pin for pairing. I looked in the documentation and it says</p>
  
  <blockquote>
    <p>This signal is only emitted for pairing requests issues by calling
    requestPairing().</p>
  </blockquote>
  
  <p>(<a href="http://doc.qt.io/qt-5/qbluetoothlocaldevice.html#pairingDisplayConfirmation" rel="nofollow">http://doc.qt.io/qt-5/qbluetoothlocaldevice.html#pairingDisplayConfirmation</a>).</p>
  
  <p>So means this, QT tries first to connect without pin and will use the pin just if something goes wrong? How can i force it to show always a pin? (There is no need for a custom pin.) Some parts of my code:</p>
  
  <pre><code>localDevice = new QBluetoothLocalDevice();
  
  connect(localDevice, SIGNAL(pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)), this, SLOT(pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing)));
  
  connect(localDevice, SIGNAL(pairingDisplayConfirmation(const QBluetoothAddress&amp;, QString)), this, SLOT(pairingMyDisplayConfirmation(const QBluetoothAddress&amp;, QString)));
  
  connect(localDevice, SIGNAL(pairingDisplayPinCode(QBluetoothAddress,QString)), this, SLOT(displayPin(QBluetoothAddress,QString)));
  </code></pre>
  
  <p>...</p>
  
  <pre><code>void MainWindow::doPairingAction()
  {
      if (ui-&gt;list-&gt;count() == 0){
          return;
      }
  
      if (ui-&gt;selectedMac-&gt;text().length() == 0 || ui-&gt;selectedName-&gt;text().length() == 0){
          return;
      }
  
      QBluetoothAddress address (ui-&gt;selectedMac-&gt;text());
      if (ui-&gt;pair-&gt;text() == "Pair") {
          qDebug() &lt;&lt; "pair " &lt;&lt; address;
  
  
  
          localDevice-&gt;requestPairing(address, QBluetoothLocalDevice::Paired);
      } else if (ui-&gt;pair-&gt;text() == "Unpair") {
          localDevice-&gt;requestPairing(address, QBluetoothLocalDevice::Unpaired);
      }
  }
  
  void MainWindow::pairingMyDisplayConfirmation(const QBluetoothAddress &amp;address, QString pin){
      qDebug() &lt;&lt; "#PAIRING_DISPLAY_CONFIRMATION_PIN: " &lt;&lt; pin &lt;&lt; "for" &lt;&lt; address;
  }
  
  
  void MainWindow::pairingDone(const QBluetoothAddress &amp;address, QBluetoothLocalDevice::Pairing pairing)
  {
      QList&lt;QListWidgetItem *&gt; items = ui-&gt;list-&gt;findItems(address.toString(), Qt::MatchContains);
  
      if (pairing == QBluetoothLocalDevice::Paired || pairing == QBluetoothLocalDevice::AuthorizedPaired ) {
          for (int var = 0; var &lt; items.count(); ++var) {
              QListWidgetItem *item = items.at(var);
              item-&gt;setTextColor(QColor(Qt::green));
              setPairStatus(true);
              qDebug() &lt;&lt; "pair " &lt;&lt; address &lt;&lt; "success";
          }
      } else {
          for (int var = 0; var &lt; items.count(); ++var) {
              QListWidgetItem *item = items.at(var);
              item-&gt;setTextColor(QColor(Qt::red));
              setPairStatus(false);
              qDebug() &lt;&lt; "pair " &lt;&lt; address &lt;&lt; "failed";
          }
      }
  }
  
  
  void MainWindow::displayPin(const QBluetoothAddress &amp;address, QString pin)
  {
      qDebug() &lt;&lt; "#DISPLAY_PIN: " &lt;&lt; pin &lt;&lt; "for" &lt;&lt; address;
  }
  </code></pre>
  
  <p>I know there is no dialog, but if i could debug the message for pin request or confirmation would be great.</p>
  
  <p>Thank You.</p>