-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.9.0
-
None
In : https://doc.qt.io/qt-5/qtpurchasing-gettingstarted-cpp.html
The example code for the following function :
void MyApplication::handleTransaction(QInAppTransaction *transaction)
contains if statement with parentheses that are not closed :
if (!hasAlreadyStoredTransaction(transaction->orderId()) {
and also here :
if (!addHealthPotionToPersistentStorage(transaction->orderId())
there is also a semicolon missing:
popupErrorDialog(tr("Unable to write to persistent storage. Please make sure there is sufficient space and restart."))
here is the full example :
void MyApplication::handleTransaction(QInAppTransaction *transaction)
{
if (transaction->status() == QInAppTransaction::PurchaseApproved
&& transaction->product()->identifier() == QStringLiteral("healthPotion")) {
if (!hasAlreadyStoredTransaction(transaction->orderId()) {
++m_healthPotions;
if (!addHealthPotionToPersistentStorage(transaction->orderId())
popupErrorDialog(tr("Unable to write to persistent storage. Please make sure there is sufficient space and restart."))
else
transaction->finalize();
}
} else if (transaction->status() == QInAppTransaction::PurchaseFailed) {
popupErrorDialog(tr("Purchase not completed."));
transaction->finalize();
}
}
| For Gerrit Dashboard: QTBUG-61834 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 235004,2 | Doc: Fix broken code snippets in Getting Started/C++ document | 5.11 | qt/qtpurchasing | Status: MERGED | +2 | 0 |