Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Developer
Posts: 1
Registered: ‎08-06-2014
My Device: Z10
My Carrier: Developer

How creating the attachedObjects property in a class in C++

[ Edited ]

Sorry, but my english is bad but let's going.

I'm trying to creating a class in C++ for communication with a web page.
I created a class but I don't understand how create this property attachedObjects in c++.

I need this property because I intend attach other class's post

 

Here's my code

 

/*
 * Http.h
 *
 *  Created on: 05/08/2014
 *      Author: Jhonny
 */

#ifndef HTTP_H_
#define HTTP_H_

#include <QtCore/QObject>
#include <Header/Post.hpp>
namespace WebService
{
    class Http: public QObject
    {
        Q_OBJECT
        Q_PROPERTY( QString url READ url WRITE setUrl NOTIFY urlChanged )
        Q_PROPERTY( QString user READ user WRITE setUser NOTIFY userChanged )
        Q_PROPERTY( QString pass READ pass WRITE setPass NOTIFY passChanged )
        Q_PROPERTY( bool succeeded READ succeeded NOTIFY succeededChanged )
        Q_PROPERTY( QString description READ description WRITE setDescription)
        Q_PROPERTY( Post *post READ post )

    public:
        Http(QObject* parent = 0);

        void setUrl(const QString& value);
        QString url() const;

        void setUser(const QString& value);
        QString user() const;

        void setPass(const QString& value);
        QString pass() const;

        bool succeeded() const;

        void setDescription(const QString& value);
        QString description() const;

        Post* post();

Q_SIGNALS:
        void urlChanged();
        void userChanged();
        void passChanged();
        void succeededChanged();
        void Created();

    private:
        QString m_url;
        QString m_user;
        QString m_pass;
        bool m_succeded;
        QString m_description;
        Post m_post;
    };
}
#endif /* HTTP_H_ */

 

 

 

 

 * Http.cpp
 *
 *  Created on: 05/08/2014
 *      Author: Jhonny
 */

#include <Header/Http.hpp>
namespace WebService
{
    Http::Http(QObject* parent) :
            QObject(parent),m_post(parent), m_succeded(false)
    {
        Q_ASSERT(true);
        Q_UNUSED(true);
        emit Created();
    }

    void Http::setUrl(const QString& value)
    {
        m_url = value;
    }

    QString Http::url() const
    {
        return m_url;
    }

    void Http::setUser(const QString& value)
    {
        m_user = value;
    }

    QString Http::user() const
    {
        return m_user;
    }

    void Http::setPass(const QString& value)
    {
        m_pass = value;
    }

    QString Http::pass() const
    {
        return m_pass;
    }

    bool Http::succeeded() const
    {
        return m_succeded;
    }

    void Http::setDescription(const QString& value)
    {
        m_description = value;
    }

    QString Http::description() const
    {
        return m_description;
    }

    Post* Http::post()
    {
        return &m_post;
    }
}