Unable connect 2 classes of signals and Slots

I am transferring from one category to the other channels.

Their memories are:

.hpp files------------
class A::public QObject{
Q_OBJECT

signals:
void emitMsg(QString* msg);
}

class B::public QObject{
signals:
void emitA(QString* msgA);
public slots:
void logMsg(QString* msg);
}

---------.cpp files

classB::classB(){
bool temp= connect(objB,SIGNAL(emitA(QString*)),this,SLOT(logMsg(QString*)));

qDebug()<<"value="<

But even running in the device debug mode Dev Alpha, the application displays a value in the log messages, or moves out of the screen dark splash.

Please adivse, what is missing from the other code?

Is there a way by which the slots and signals of different classes could be connected to data transfer?

Create a Downloader object?

(BTW, I always initialize pointers to 0 in the initializer list.)  Who does this kind of obvious thing, and it has the same thing for debug and release)

Stuart

Tags: BlackBerry Developers

Similar Questions

  • Signals and Slots

    Try to test something after that someone wanted to help with the signals and Slots sorta. I know there is an alternative to this, but I'm trying to understand why this does not work when doing it this way.  It relies, it works but it does not fly... I mean this isn't the trigger of the SLOT feature... Not even sure if she sends a SIGNAL...

    Thanks in advance.

    file:

    // Default empty project template
    #ifndef Testme_HPP_
    #define Testme_HPP_
    
    #include 
    
    namespace bb { namespace cascades { class Application; }}
    namespace bb { namespace cascades { class TouchEvent; }}
    namespace bb { namespace cascades { class Container; }}
    namespace bb { namespace cascades { class ImageView; }}
    
    /*!
     * @brief Application pane object
     *
     *Use this object to create and init app UI, to create context objects, to register the new meta types etc.
     */
    class Testme : public QObject
    {
        Q_OBJECT
    public:
        Testme(bb::cascades::Application *app);
        virtual ~Testme() {}
    public slots:
        void handleTouch(bb::cascades::TouchEvent* tEvent);
    private:
        bb::cascades::Container* rootContainer;
        bb::cascades::ImageView* imgView;
    };
    
    #endif /* Testme_HPP_ */
    

    .cpp file:

    // Default empty project template
    #include "Testme.hpp"
    
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    
    using namespace bb::cascades;
    
    Testme::Testme(bb::cascades::Application *app)
    : QObject(app)
    {
        // create scene document from main.qml asset
        // set parent to created document to ensure it exists for the whole application lifetime
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
        QmlDocument *qml2 = QmlDocument::create("asset:///Testingme.qml").parent(this);
    
        // create root object for the UI
        AbstractPane *root = qml->createRootObject();
        // set created root object as a scene
        app->setScene(root);
    
        if (!qml2->hasErrors()) {
            rootContainer = qml2->createRootObject();
    
            if (rootContainer) {
                imgView = rootContainer->findChild("imgView");
    
                if (imgView) {
                    bool res = QObject::connect(imgView,                                        SIGNAL(touch(bb::cascades::TouchEvent*)),
                            this, SLOT(handleTouch(bb::cascades::TouchEvent*)));
                    Q_ASSERT(res);
                    Q_UNUSED(res);
                    fprintf(stderr, "Height: %f and width: %f\n",
                            imgView->preferredHeight(),                                        imgView->preferredWidth());
                } else {
                    fprintf(stderr, "No ImageView\n");
                }
            } else {
                fprintf(stderr, "No root container\n");
            }
        } else {
            fprintf(stderr, "QML2 has errors\n");
        }
    }
    
    void Testme::handleTouch(TouchEvent *tEvent)
    {
        fprintf(stderr, "Touch Touch Touch\n");
    }
    

    hand file. QML:

    // Default empty project template
    import bb.cascades 1.0
    
    // creates one page with a label
    Page {
        Container {
            layout: StackLayout {}
            Label {
                text: qsTr("Hello World")
            }
    
            Testingme {
                id: testingMe
            }
        }
    }
    

    File Testingme.QML:

    import bb.cascades 1.0
    
    Container {
        objectName: "rootContainer"
        horizontalAlignment: HorizontalAlignment.Center
        verticalAlignment: VerticalAlignment.Center
        background: Color.create ("#262626")
    
        ImageView {
            objectName: "imgView"
            imageSource: "asset:///belligerent.png"
            preferredHeight: 200
            preferredWidth: 200
        }
    }
    

    The main file is the one you get when you create a new project of Cascades Standard default. So, what's wrong with this picture? Or of images, other than the fact that I use the png of bellicose blocks file...

    -Edit (this and some formatting).

    I'm using the Simulator, so don't know if it would make a difference. BTW, I even tried to use a checkbox, and which does not trigger anything.

    Well, it works eventually got. I'm still not sure where to check signals during debugging, however.

    Although there are two files QML, the first main QML object is one that should be used. I used the 2nd QML file object that was wrong, even if the image is in the 2nd...

  • Problem, the signals and Slots

    Hi, as I posted in one of my other posts I have following problem with signals and messages and would be nice if someone could clarify anything that I don't seem to be able to find what the problem of the outputs.

    I have the code:

    void MYNetworkClass::requestFinished(QNetworkReply* reply)
    {
    
          // Check the network reply for errors
          if (reply->error() == QNetworkReply::NoError)
          {
             // read response
             const QByteArray response(reply->readAll());
             qDebug() <<"Response: "<< response;
    
             JsonDataAccess jda;
             QVariantMap results = jda.loadFromBuffer(response).toMap();
    
             QVariantMap data = results.value("SomeData").toMap();
    
             emit signalSuccess(data); // I reach here .... 
    
    // however actually when I click "Step Over" in debug mode, and try to exit the function// afterwards I get such "error" saying: No source available for "QMetaObject::activate() at  0xb9668da7" - highlighted in red.
    
         }
         else
         {
             qDebug() << "\n Problem with the network";
             qDebug() << "\n" << reply->errorString();
         }
    

    In MyNetwork class I also added the definition of signal in the header file:

    signals:
    
        void signalSuccess(QVariantMap result);
    

    Now also when someone calls an object MyNetworkClass method which calls requestFinished,.

    I want to catch the signal which is emitted by the requestFinished - as shown above.

         MyNetworkClass *network = new MyNetworkClass();
    
        QMap params;
        params.insert("username", userEmail);
    
        bool res = QObject::connect(network, SIGNAL(signalSuccess(QVariantMap)), this, SLOT(SomeSlotForSignal(QVariantMap)));
    
            Q_ASSERT(res);
        Q_UNUSED(res);
            network->makePostRequest("Login");
    

    My problem is that the SomeSlotForSignal slot never is called... (even if the signal is issued constitute requestFinished method and as I stated SomeSlotForSignal as a crack in the header file...) What can be problem? Any help? Thank you.

    I guess I solved the problem.

    The code I presented previously registered function

    F of a class B:

     void B::f()
    {
    MyNetworkClass *network = new MyNetworkClass();
    
        QMap params;
        params.insert("username", userEmail);
    
        bool res = QObject::connect(network, SIGNAL(signalSuccess(QVariantMap)), this, SLOT(SomeSlotForSignal(QVariantMap)));
    
            Q_ASSERT(res);
        Q_UNUSED(res);
    
    network->makePostRequest("Login");
    }
    

    Then the function f is called to:

        B object;
        object.f();
    
    The problem was I think that when the server responded "object" was destroyed from the stack. When I replaced the above code, with 
    
         B* object = new B();
        object->f();
    
    I think it works now......
    
  • Why connecttng signals and slots of an element of action gets segfault

    I add an action item to a page. For some reasong I had to disconnect the item, delete and re-create, and then reconnect it. But I am getting exception when I try to pull the plug. If I omit the disconnection then I get exception when connecting. My code is below

      if(addAllRules)
        {
            disconnect(addAllRules,SIGNAL(triggered()),this,SLOT(onTriggeredAddRuleActionAllRules()));
            delete(addAllRules);
        }
        addAllRules =  ActionItem::create().title("Add Rule").enabled(true);
        allRulesPage->addAction(addAllRules, ActionBarPlacement::OnBar);
        connect(addAllRules,SIGNAL(triggered()),this,SLOT(onTriggeredAddRuleActionAllRules()));
    

    Have you tried cleaning and reconstruction project?

    You will need to find the exact location of the crash using a debugger or newspapers, or analyze a dump core after accident.

    This can also occur due to memory corruption. If the memory is damaged from somewhere, the accident can happen in completely independent place. In this case, try commenting on most of the features of the application until the QTimer started working restaurant then step by step.

  • Error while establishing an Http connection. Once finished signal request is displayed, no call slot

    I'm instantiated MyNetwork class on click of a button in my app class.

    Therefore it is called class constructor MyNetwork in which I'm checking the availability of the network.

    Once found an available network, a sendRequest() method is called that a get request is initialized.

    And the QNetworkAccessManager object emits a finished(QNetworkReply *) signal is connected to a slot (requestFinished(QNetworkReply *reply)) of this class of MyNetwork .

    When the user clicks on the button in the file app.cpp, create an object of class MyNetwork and checking the availability of the network works within its constructor.

    also the connect() method returns true , but sinking ever crack (requestFinished(QNetworkReply *reply)) method where I am Manager of my answer.

    MyNetwork. HPP

     

     

    #ifndef MYNETWORK_HPP_
    #define MYNETWORK_HPP_
    
    #include
    #include 
    #include
    #include
    #include
    #include 
    #include 
    #include
    
    /*!
     * @brief Network Connection Implementation
     */
    class MyNetwork:public QObject
    {
        Q_OBJECT;
    
        public :
            MyNetwork();
    
            /*!
             * @brief Method to create and send request
             */
            void sendRequest();
            /*!
             * @brief Method to check if network is available
             */
            bool isNetworkAvailable();
    
        private slots:
                void requestFinished(QNetworkReply *reply);
    
    };
    
    #endif /* MYNETWORK_HPP_ */
    

    MyNetwork.cpp

     

     


    #include
    #include
    #include
    #include
    
    QNetworkAccessManager *mNetworkMgr;
    
    MyNetwork::MyNetwork() {
    
        if (isNetworkAvailable()) {
            sendRequest();
        } 
    
    }
    
    void MyNetwork::sendRequest() {
    
        mNetworkMgr = new QNetworkAccessManager(this);
        QNetworkReply *reply =
                mNetworkMgr->get(
                        QNetworkRequest(
                                QUrl(
                                        "http://developer.blackberry.com/cascades/files/documentation/device_platform/networking/model.xml")));
        if (reply) {
            qDebug() << "Reply from server is " << reply;
        }
        bool resFromServer = connect(mNetworkMgr, SIGNAL(finished(QNetworkReply*)),
                this, SLOT(requestFinished(QNetworkReply*)));
        qDebug() << "Connection is success : ? : " << resFromServer;
        Q_ASSERT(resFromServer);
        Q_UNUSED(resFromServer);
    }
    
    void MyNetwork::requestFinished(QNetworkReply *reply) {    if (reply) {
            if (reply->error() == QNetworkReply::NoError) {
                qDebug() << "No Error";
            } else {
                int httpStatus = reply->attribute(
                        QNetworkRequest::HttpStatusCodeAttribute).toInt();
                qDebug() << "Error and the code is " << httpStatus;
            }
            reply->deleteLater();
        } else {
            qDebug() << "Reply comes out to be null";
        }
    }
    
    bool MyNetwork::isNetworkAvailable() {
        QNetworkConfigurationManager netMgr;
        QList mNetList = netMgr.allConfigurations(
                QNetworkConfiguration::Active);
        if (mNetList.count() > 0) {
            if (netMgr.isOnline()) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
    

    Hmm. I just did a quick test for the for you network code.

    I movedbool resFromServer = connect(mNetworkMgr, SIGNAL(finished(QNetworkReply*)),
    this, SLOT(requestFinished(QNetworkReply*)));
    
    to  be before
    
    QNetworkReply *reply =
    mNetworkMgr->get(
    QNetworkRequest(
    QUrl(
    "http://developer.blackberry.com/cascades/files/documentation/device_platform/networking/model.xml")));
    
    in my test.
    

    As I mentioned to signal before start us sending application network.

    I got "Error no." in the newspaper which seemed to have indicated that the signal/slot was triggerred properly in my case.

    Question for you:

    How did you create your object "MyNetwork"?

    is the object still alive when the network request signal is triggerred?

    Maybe the code for create/destorying your object "MyNetwork" segment will be useful

  • BlackBerry BB Z30 Z30 connects to non-existent WiFi signal and does not accept the real

    I just changed wifi of our House 'Superfast' (100 Mb/s) because of problems with access around the House. I changed to 2G and the names of the signals of 5G from those used previously, xxx - 2 G and 5 G - xxx to xxx2 - 2 and xxx2 - 5G.

    However Z30, by listing the networks begins with

    Connected to xxx - 2 G, showing three bars and saying "Login to connect to the Internet." but I can not because it does not accept the password.

    Z30 then begins the list of available networks

    XXX2 - 5G, showing the four bars

    XXX2 - 2G, also four bars, saying "saved".

    at the bottom of the list is

    XXX - 2 G, three bars and saying: "selected."

    How do I remove a network as xxx - 2 G which doesn't exist or doesn't want to, because it blocks the ability to connect to one that exists and IS being sought?

    I can connect to xxx2 - 2G (new 'Saved' network), but after a while (maybe 10 minutes) the phone slides into the ghost...

    I would of course prefer actually to connect to xxx2 - 5 G - but this is not spared: whenever I have it try, ater entered the password (and getting a tick) I said - ' unable to add profile: another profile uses this SSID.» (WPS does not anyway I tried). Later: after having tried this ten or more times, sometimes xxx2 - 5G lists as saved (but usually does not), but is still inaccessible.

    How can I get Z30 to save a network / signal / profile - and use - it says is available and is looking?

    I'm an old man without a lot of hair left - and I'm pulling that very quickly...

    Cheers - Eric

    Eric, open your settings > Wifi.
    At the bottom of this screen type saved.
    Search for unwanted sources wifi saved old and press on & hold on this name to remove the pop up right.

  • Im having truoble internet connection, even if I have a signal and everything is connected

    Im having truoble internet connection, even if I have a signal and everything is connected.  I ran the repairs and doing what he had asked, however I am still unable to connect to the internet?

    I have a WiFi router, and even if my desktop pc lacks a coneection wirless, I bought a wireless adapter for it, so I can connect to the internet, but there is a problem with the connection.  everything worked fine and then it just stopped and refuses to connect. I run the diagnostic report and followed the instructions but it does not connect truncated.  What can I gdo now?

    Hello

    1. you get any error message?

    2. don't you make changes to the computer before the show?

    Please follow the steps below.

    Method 1:

    Follow the steps mentioned in the links below

    Windows wireless and wired network connection problems

    http://Windows.Microsoft.com/en-us/Windows/help/wired-and-wireless-network-connection-problems-in-Windows

    Solve problems, find wireless networks

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-finding-wireless-networks (Also applies to Windows 7)

    Method 2:

    Follow the steps mentioned in the link below.

    http://Windows.Microsoft.com/en-us/Windows7/how-do-I-fix-network-adapter-problems

  • How to get the callUpdated signal and respond to the function of oncallUpdated slot?

    Hello world:

    I want to get the 'phone. callUpdated (const bb::system:: call & appeal) "signal and do something in the slot to onCallUpdated function, but the problem is crack onCallUpdated() function does NOT respond!

    Here is my code:

    . CPP

    #include 
    

    MyApp (bb::cascades:Application * app) in myApp.cpp

        bb::system::phone::Phone phone;
    
        bool success = QObject::connect(&phone,SIGNAL(callUpdated(const bb::system::phone::Call&)),this,SLOT(onCallUpdated(const bb::system::phone::Call&)));
    
        qDebug()<<"bb::system::phone::Phone phone:  "<
    

    When the application runs, the success of back connect is true!

    void Quicker::onCallUpdated(const bb::system::phone::Call &call)
    {
    
        //CallState::Type state = call.callState();
    
        qDebug()<<"onCallUpdated is called";
    }
    

    In myApp.hpp

    #include 
    
         void onCallUpdated(const bb::system::phone::Call &call);
    

    In the bar - descriptor.xml

        run_when_backgrounded
        access_phone
    

    I found the problem:

    bb::system::phone::Phone phone;
    

    the code must be in the *.hpp.

    Thank you all.

  • I just bought the last Apple TV - I can't seem to connect with the App Store and Siri is completely useless. This is an example of how Apple is unable to produce a useful product?

    I just bought the last Apple TV - I can't seem to connect with the App Store and Siri is completely useless. This is an example of how Apple is unable to produce a useful product?

    Hello

    Be sure to follow the instructions in this article to support > set up your Apple TV (4th generation) - Apple supported

  • I recently took a class of Microsoft and received the "Welcome" e-mail, but could not connect with the supplied credentials.

    I recently took a class of Microsoft and received the "Welcome" e-mail, but could not connect with the supplied credentials (example below):

    Your MC ID: xxxxxxx

    Your temporary access code: 18995EBE-BDAF-4883-8F95-64D18D261848

    I created a new account with the e-mail MC ID has been sent and it was not recognized.  I would like to merge (link) the news and be able to get a fresh copy of my cert.  Thank you.

    Hello

    I suggest you contact Microsoft Learning support team to improve assistance:

    http://www.Microsoft.com/learning/en/us/help/assisted-support.aspx

  • On Windows 7 and I am unable to set up tv signals.

    Original title: Windows 7 media center tv signal and

    I just upgraded from Vista to Windows 7 and am unable to put in place across the television signals. He asks me a postal code analysis, and search tv signal set up which shows should take a few minutes. An hour later it still does not work, so I closed it. Tried 3 times.

    Hello

    See the following article:

    Set up a TV signal in Windows Media Center:

    http://Windows.Microsoft.com/en-in/Windows7/set-up-a-TV-signal-in-Windows-Media-Center

  • Why my version of Skype 6.20 in iPhone6 unable connect and always in offline mode when trying to connect

    Hi have a wifi connection in my iphone 6 and I just updated my Skype. When I try to log in, I can't sign-in. I also tried to reinstall, but no luck. There are times that I can connect and status online, but minutes later it will go offline. During the online state, I also received end messages from my contacts. What happens to my Skype, any idea? I have updated to iOS. Someone has a similar problem? How did you solve this problem?

    Please advice. Thanks in advance.

    AAH... I found the solution. I just updated my iOS and he had it solved. So it was just a conflict with an older version of iOS. Problem solved.

  • HP Pavilion P2-1140 does not have a way to connect to a Firewire port and USB transfer is not supported by Windows 7 to connect the Sony HC20 Handycam.

    Original title: Sony Hanycam HC20

    I just bought a HP Pavilion P2 - 1140 W7 64 bit and may not know how to download video from my Sony Handycam HC-20 who

    using a Firewire connection. P2-1140 does not have a way to connect to a Firewire port and USB transfer is not supported by Windows 7.

    I looked in the spec of my card mother HP and there is no additional slots to add adapters, no PCI, PCI-e or anything that looks like

    as if you can add anything. I know that the Firewire to USB converters cable do NOT work, any suggestions please

    There are USB firewire converters, but I think it will be a situation of hit or miss--they are unable to work or perform very well.

    The only option I can think of that would work would be to use AV out on the camera and a USB capture card that records on the computer.
    You can also consider going back to the computer and get a different model that is built in firewire support or at least an extension connector in order to get an expansion card.
  • IPhone 5 s losing signal and MIC is muffled

    Hello guys,.

    My Rich Dad a 5s iPhone and it loses signal and muffled the sound when he talks about phone! Any solution before going to the apple service?

    Hello

    Try following the steps here in terms of sound not clear:

    Get help with microphones on your iPhone, iPad and iPod touch - Apple Support

    Follow the instructions in respect of the loss of cellular signal:

    If you cannot connect to a cellular network or cellular data - Apple Support

  • Im trying to fill the network so my ps2 connections can use the signal wireless to my laptop running vista Basic. When I click to bridge, I get a message saying that I need at least 2 internet connections. is this in any way about this?

    Im trying to fill the network so my ps2 connections can use the signal wireless to my laptop running vista Basic. When I click to bridge, I get a message saying that I need at least 2 internet connections. is this in any way about this?

    Hi Jer9009,

    Welcome to the Microsoft answers site.

    ·         Could you give the exact error code or error number you get?

    To connect multiple computers, install a network adapter in each and run a network CAT5 cabling to connect each one to a hub (and thus the other.) The computer that will serve as a transition will have a standard network card for wired and a wireless network adapter that will connect to the wireless (WAP) access point or gateway on the second network.

    A network bridge is software or hardware that connects two networks or more so that they can communicate. You can create only a single bridge network on a computer, but a bridge can handle any number of network connections.

    For more information, see the link: create a network bridge:http://windows.microsoft.com/en-US/windows-vista/Create-a-network-bridge

    Add a connection to a network bridge: http://windows.microsoft.com/en-us/windows-vista/Add-a-connection-to-a-network-bridge

    Swathi B - Microsoft technical support.
    Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for

  • Junk e-mail

    Hello world While on other systems junk once using mail is moved through the system, the junk e-mail folder, it is marked as spam and therefore you can not open it. I think that it is so that you do not confirm your email address. I love the Apple ma

  • Toshiba 1 TB external HARD drive

    I purchesed one of these comments amonth ago, to the day where I plugged the machine a turned on nothing happened. I left for about an hour and tried again, again, nothing happens, what could be the problem and how would approach I solve this. Congra

  • Satellite 1800-100: need manual disassembly instructions, service or similar

    This thing is long out of warranty, and it is I have a few things, I would like to try with it.I have a few spare CPU, among which are both 100 and 133 Mhz fsb coppermines. I was not able to determine if they are compatible beyond the fsb to 100 Mhz,

  • Re: I need a battery for Satellite A200-1FL. Where can I get one?

    I tried a battery compatilbe with my laptop but I can't... I need a new battery because my battery lasts 6 minutes: @. Could someone help me?

  • LifeCam cinema problems and suggestions...

    HelloI just bought the new Lifecam cinema and it's an amazing webcam.However, there are 2 questions:(1) the cam uses a lot of CPU... I have an E8400 DC 3.0 as recommended and it's almost to the limit, using 1280 X 720, 30 FPS with Skype... The logite