I'm using the ButtonQMLPlugin from the one click buy example.
In my QML file I want to know when the purchase was successful.
I want to know when purchased() gets emitted but I'm not having any luck!
I get this error code when running my app:
[Qt Message] Button/RestoreButton.qml:29 ButtonQmlUi is not a type
Here is my QML code:
Code:import QtQuick 1.0 import ButtonQmlPlugin 1.0 Rectangle { id: screen width: 220 height: 146 signal click onClick: { oneClickBuyButton.onPressed(); } property alias cbLabelTextMainName: oneClickBuyButton.cbLabelTextMainName property alias cbLabelTextMainDescription: oneClickBuyButton.cbLabelTextMainDescription property alias cbLabelTextMainPrice: oneClickBuyButton.cbLabelTextMainPrice property alias cbLabelTextOperation: oneClickBuyButton.cbLabelTextOperation property alias cbGifVisibility: animationGif.visible ButtonQmlUi { id:iap_manager onPurchased: { console.log("onPurchaseCompleted") if( status==="OK") { if( productID === "111111" ) { //do stuff here } } } }
I thought that is the right way to receive a signal?
Out of interest here is the ButtonQMLUi.h file which processes the payment fine if I take out my attempt to receive that signal
I am trying to receive the purchased signal from the ButtonQMLplugin in a QML file and I can't get it to workCode:#ifndef EXAMPLEITEM_H #define EXAMPLEITEM_H #include <QDeclarativeItem> #include <QMap> #include <QVariant> #include <QRectF> #include <QTime> #include <iapclient.h> class QDeclarativeEngine; class QDeclarativeView; class QTranslator; class QLabel; class ButtonQmlUi : public QDeclarativeItem { Q_OBJECT // status and tools needed by PageStack Q_PROPERTY(QString resourceId READ getResourceId WRITE setResourceId NOTIFY resourceIdChanged) Q_PROPERTY(QString cbLabelTextMainName READ getcbLabelTextMainName WRITE setcbLabelTextMainName NOTIFY cbLabelTextMainNameChanged) Q_PROPERTY(QString cbLabelTextMainDescription READ getcbLabelTextMainDescription WRITE setcbLabelTextMainDescription NOTIFY cbLabelTextMainDescriptionChanged) Q_PROPERTY(QString cbLabelTextMainPrice READ getcbLabelTextMainPrice WRITE setcbLabelTextMainPrice NOTIFY cbLabelTextMainPriceChanged) Q_PROPERTY(QString cbLabelTextOperation READ getcbLabelTextOperation WRITE setcbLabelTextOperation NOTIFY cbLabelTextOperationChanged) Q_PROPERTY(bool cbLoading READ getcbLoading WRITE setcbLoading NOTIFY cbLoadingChanged) public: void _setResourceId( const QString &theResourceId ); public slots: void onPressed(); void onPurchaseCompleted( int requestId, QString status, QString purchaseTicket ); void onRestorationCompleted( int requestId, QString status, QString purchaseTicket ); void onRestorableProductsReceived( int requestId, QString status, IAPClient::ProductDataList items ); void onProductDataReceived( int requestId, QString status, IAPClient::ProductDataHash productData ); void showLoading(); void hideLoading(); signals: void purchased(); void error(); void resourceIdChanged(); void cbLabelTextMainNameChanged(); void cbLabelTextMainDescriptionChanged(); void cbLabelTextMainPriceChanged(); void cbLabelTextOperationChanged(); void cbLoadingChanged(); public: const QString getResourceId(); void setResourceId(const QString); const QString getcbLabelTextMainName(); void setcbLabelTextMainName(const QString); const QString getcbLabelTextMainDescription(); void setcbLabelTextMainDescription(const QString); const QString getcbLabelTextMainPrice(); void setcbLabelTextMainPrice(const QString); const QString getcbLabelTextOperation(); void setcbLabelTextOperation(const QString); const bool getcbLoading(); void setcbLoading(const bool); public: ButtonQmlUi(QDeclarativeItem *parent = 0); virtual ~ButtonQmlUi(); void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); private: // void verifyTicket( const QString &thePurchaseTicket ); // QNetworkAccessManager *mNAM; // QNetworkReply *mNReply; IAPClient *mIapClient; QString m_resourceId; QString m_cbLabelTextMainName; QString m_cbLabelTextMainDescription; QString m_cbLabelTextMainPrice; QString m_cbLabelTextOperation; bool m_cbLoading; bool mIsRestorable; IAPClient::DrmType mIsRestorableDRM; int mRestorableReqId; int mRestoreReqId; int mPurchaseReqId; QLabel *mProcessLabel; QLabel *mProcessLabelText; QLabel *mProcessLabelTextOperation; QLabel *mProcessLabelTextMain; }; #endif // EXAMPLEITEM_H
Thanks for your help

Reply With Quote

