Disconnect a SIGNAL?

Yes, there are simply to create the connection of signals:

Object.signal.Connect (Function)

But how to disconnect this function signal?

Object.signal.Disconnect (Function)?

Tags: BlackBerry Developers

Similar Questions

  • Stop a signal to connect to the slot machine

    Hello

    Is it possible to stop broadcasting a SIGNAL?

    I had defined a SIGNAL to connect to a SLOT machine at some point earlier.

    But now I want to stop this SIGNAL to connect to the purpose of the LOCATION.

    I tried this thing

    definition of a signal to connect to the slot machine

    connectResult = connect (sensor, SIGNAL (readingChanged ()), this, SLOT (accelerationReadingChanged ()));

    I use to stop

    Connect (sensor, SIGNAL (readingChanged ()), this, SLOT());

    But he does not have to issue.

    use disconnect to disconnect the signal.
    signals and slots allow n connections n a new connection does not overwrite the old connect.

  • 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.

  • "out of range" error on I-110 fieldpoint

    We try to connect the pressure Omegadyne transducers (PX1004L1) that give a reading of mV to 10 v excitation. Before you connect the 4 cables (excitation, signal and two Commons) I-110, we get an error 'out of range '. Disconnect the signal + / leads and measure with a multimeter, we read the mV expected signal. If reconnect us the signal + / conduit and disconnect the excitement + / leads and then connect to a power source (external to the I-110), we read the expected of the I-110 mV signal. Any suggestions on what is happening here? We have already exchanged the head I-110 with a spare part that we know is operational.

    I have not heard of "Omegadyne", but I know Omega.  What is the device?  http://www.Omega.com/pressure/PDF/PX1004.PDF

    You're talking about 2 Commons.  But what I see, it's a bridge 4 circuit son strain gage.  I think you should use a SG-140 module to read this device.

  • How to stop compensation labview my data output by a fixed amount of 0.125 seconds of every second iteration 1?

    How to stop compensation labview my data output by a fixed amount of 0.125 seconds of every second iteration 1? (I have my DAQ Assistant contained in a while loop so that I can control the number of iterations and therefore the time of sampling).

    My apologies for such a badly phrased statement of problem. The question I faced which was the sign that I was getting a pair of accelerometers and through an amp. in my DAQ board felt an offset in voltage for a short period every second iteration 1. It turns out that the problem is that my laptop and the AGP were grounded. Once I disconnected the signal ground in the shift of the signal amp went.

    Thank you for your messages.

    Kevin

  • 6143 problem with Analog In

    Hello

    We have a cards 6143 PXI system. on 1 card in slot 8, we get allways-5V on several channels in MAX Testpanel.

    Is the fault of the card?

    Hello Jochen,

    Thanks for yor reply, I got the - 5V, if I had connected to the inputs together (short).

    I disconnected our signal Box - air conditioning - (its a Bedo - Box) and connected the 6143 with SCB68 connector housing.

    No problem, all worked fine, the 6143 wasn't damaged.

    Was the reason, we have also a 6733 D/A - card, it was a mistake between the connection cable, and the D/A - a/d card to the

    Signal - conditioning - box.

    Teradein

  • HP w2408h monitor problems

    I connected my old hp computer to my monitor to be updated and used the vga connection to do. When I tried the HDMI cable on my current machine he wouldn't get a HDMI signal. I plugged the current computer VGA connector and it worked fine, but if I disconnect the signal VGA screen becomes white. I went into the menu and it says that I don't have a HDMI signal. I connected the HDMI cable to my laptop and it works fine. I hope that I've explained this well enough. Basically, I don't get a HDMI signal even though it is set to HDMI on the menu and connected correctly. Thank you.

    Hello again auntnenee,

    Thanks for the quick response!

    Based on the information you provided in your post, I recommend performing a hard reset on your monitor. To do this, please follow the steps below:

    1. unplug all the connective cables to the monitor (VGA, HDMI, etc.).

    2. unplug the power cord from the screen and the wall outlet.

    3. press the button power for 30 seconds.

    4. plug the power cord into the wall and then into the monitor.

    5. plug the HDMI cable between your computer and your monitor.

    If the problem persists, you can also perform a factory reset on the screen itself. This is possible by accessing the menu. One of the options in the menu should allow you to make a 'Factory Reset'.

    Please re-post with the results of your troubleshooting, and I look forward to your response!

    Concerning

  • How I got notification of Wifi on / Off status?

    Hello

    My rquirement as below

    -J' I need notification when the user enable or disable wifi.

    I got the signal on bluetooth technology, but for wifi, I don't get any signal.

    I am waiting for your positive response please reply me as soon as possible.

    Take a look at this - it works for me. Everything I do is to delay the wifi control up/down status for a few seconds whenever I get a network change event to allow the interface change complete.

    #include "NetworkMonitor.hpp"
    
    NetworkMonitor* NetworkMonitor::_instance;
    
    NetworkMonitor::NetworkMonitor(QObject *parent)
        : QObject(parent)
        , _initialised(false)
        , _networkWasAvailable(true)
        , _wifiWasAvailable(true)
        , _timer(new QTimer(this))
    {
        QObject::connect(_timer, SIGNAL(timeout()),
                           this, SLOT(onTimeout()));
    }
    
    NetworkMonitor::~NetworkMonitor() {
        if (_timer->isActive())
            _timer->stop();
        QObject::disconnect(_timer, SIGNAL(timeout()),
                              this, SLOT(onTimeout()));
    }
    
    NetworkMonitor *NetworkMonitor::getInstance(QObject *parent)
    {
        if (_instance == 0) {
            _instance = new NetworkMonitor(parent);
        }
        return _instance;
    }
    
    void NetworkMonitor::start() {
        initialise();
        setNetworkInitialStatus();
        setWifiInitialStatus();
    }
    
    void NetworkMonitor::stop() {
        _timer->stop();
        terminate();
    }
    
    void NetworkMonitor::initialise() {
    
        qDebug() << "XXXX NetworkMonitor::initialise() starting..." << endl;
    
        bool initialised = true;
    
        if (bps_initialize() == BPS_FAILURE) {
            initialised = false;
            qDebug() << "XXXX Error: BPS failed to initialise" << strerror(errno) << endl;
        }
    
        if (netstatus_request_events(0) == BPS_FAILURE) {
            initialised = false;
            qDebug() << "XXXX Error: Failed to request Netstatus BPS events" << strerror(errno) << endl;
            bps_shutdown();
        } else {
            qDebug() << "XXXX Registered for Netstatus BPS events OK" << endl;
            subscribe(netstatus_get_domain());
        }
        _initialised = initialised;
    }
    
    void NetworkMonitor::terminate() {
        qDebug() << "XXXX NetworkMonitor::terminate entered ..." << endl;
        netstatus_stop_events(0);
        unsubscribe(netstatus_get_domain());
        bps_shutdown();
    }
    
    void NetworkMonitor::event(bps_event_t *event) {
        qDebug() << "XXXX NetworkMonitor::event() entered ..." << endl;
    
        int domain = bps_event_get_domain(event);
        if ((netstatus_get_domain() == domain) &&
            (bps_event_get_code(event) == NETSTATUS_INFO)) {
                handleNetStatusEvent(event);
        }
    }
    
    void NetworkMonitor::handleNetStatusEvent(bps_event_t *event)
    {
        Q_UNUSED(event)
    
        qDebug() << "XXXX NetworkMonitor::handleNetStatusEvent() entered ..." << endl;
    
        setNetworkStatus();
        if (!_timer->isActive()) {
            _timer->start(5000);
        }
    }
    
    void NetworkMonitor::onTimeout()
    {
        if (_timer->isActive())
            _timer->stop();
        setWifiStatus();
    }
    
    void NetworkMonitor::setNetworkInitialStatus()
    {
        if (networkAvailabile()) {
            qDebug() << "XXXX Network Initially Available" << endl;
            _networkWasAvailable = true;
            emit networkAvailable();
        } else {
            qDebug() << "XXXX Network Initially Not Available" << endl;
            _networkWasAvailable = false;
            emit networkNotAvailable();
        }
    }
    
    void NetworkMonitor::setWifiInitialStatus()
    {
        if (wifiAvailabile()) {
            qDebug() << "XXXX Wifi Initially Available" << endl;
            _wifiWasAvailable = true;
            emit wifiAvailable();
        } else {
            qDebug() << "XXXX Wifi Initially Not Available" << endl;
            _wifiWasAvailable = false;
            emit wifiNotAvailable();
        }
    }
    
    void NetworkMonitor::setNetworkStatus()
    {
        if (networkAvailabile()) {
            qDebug() << "XXXX Network Available" << endl;
            if (!_networkWasAvailable) {
                qDebug() << "XXXX Network changed to Available" << endl;
                _networkWasAvailable = true;
                emit networkAvailable();
            }
        } else {
            qDebug() << "XXXX Network Not Available" << endl;
            if (_networkWasAvailable) {
                qDebug() << "XXXX Network changed to Not Available" << endl;
                _networkWasAvailable = false;
                emit networkNotAvailable();
            }
        }
    }
    
    void NetworkMonitor::setWifiStatus()
    {
        if (wifiAvailabile()) {
            qDebug() << "XXXX Wifi Available" << endl;
            if (!_wifiWasAvailable) {
                qDebug() << "XXXX Wifi changed to Available" << endl;
                _wifiWasAvailable = true;
                emit wifiAvailable();
            }
        } else {
            qDebug() << "XXXX Wifi Not Available" << endl;
            if (_wifiWasAvailable) {
                qDebug() << "XXXX Wifi changed to Not Available" << endl;
                _wifiWasAvailable = false;
                emit wifiNotAvailable();
            }
        }
    }
    
    bool NetworkMonitor::networkAvailabile()
    {
        netstatus_info_t *info;
        bool available = false;
    
        if (netstatus_get_info(&info) == BPS_SUCCESS) {
            if (netstatus_info_get_availability(info)) {
                available = true;
            }
            netstatus_free_info(&info);
        }
        return available;
    }
    
    bool NetworkMonitor::wifiAvailabile()
    {
        qDebug() << "XXXX NetworkMonitor::wifiAvailabile()" << endl;
    
        bool available = false;
    
        netstatus_interface_list_t iflist;
        netstatus_get_interfaces(&iflist);
    
        qDebug() << "XXXX NetworkMonitor::wifiAvailabile() - num_interfaces=" << iflist.num_interfaces << endl;
    
        for(int i = 0; i < iflist.num_interfaces; i++) {
    
            netstatus_interface_details_t *details = 0;
            netstatus_get_interface_details(iflist.interfaces[i], &details);
    
            if(details) {
                qDebug() << "XXXX NetworkMonitor::wifiAvailabile() - i/f details Available" << endl;
                const char *name = netstatus_interface_get_name(details);
                netstatus_interface_type_t type = netstatus_interface_get_type(details);
    
                qDebug() << "XXXX NetworkMonitor::wifiAvailabile() - i/f name=" << name << endl;
                qDebug() << "XXXX NetworkMonitor::wifiAvailabile() - i/f type=" << type << endl;
                qDebug() << "XXXX NetworkMonitor::wifiAvailabile() - is_up=" << netstatus_interface_is_up(details) << endl;
    
                if (type == NETSTATUS_INTERFACE_TYPE_WIFI) {
                    if (netstatus_interface_is_up(details)) {
                        qDebug() << "XXXX NetworkMonitor::wifiAvailabile() - Found a WiFi i/f in UP State" << endl;
                        available = true;
                    } else {
                        qDebug() << "XXXX NetworkMonitor::wifiAvailabile() - Found a Wifi i/f in DOWN State" << endl;
                    }
                }
            } else {
                qDebug() << "XXXX NetworkMonitor::wifiAvailabile() - i/f details N/A" << endl;
            }
            netstatus_free_interface_details(&details);
        }
        netstatus_free_interfaces(&iflist);
        return available;
    }
    
  • start / stop NFC programmatically

    I am able to start / stop Bluetooth of cascades

    Is there a way to start and stop the NFC by programming?

    It has enabled for a business application in the perimeter of work where the NFC should automatically /disabled.

    THX

    Rodger,

    Thanks again. It works well - even in the scope of work

    Integrate this way:

    At STARTUP after UI is created from a QTimer delayed in QML, I call checkNfcState:

    void ApplicationUI::checkNfcState()
    {
        mPpsObject = new bb::PpsObject("/pps/services/unifiedradiomgr/status?wait,delta", this);
    
        bool res = connect(mPpsObject, SIGNAL(readyRead()), this, SLOT(onPpsReadyRead()));
        Q_ASSERT(res);
        Q_UNUSED(res);
        if (!mPpsObject->open(bb::PpsOpenMode::Subscribe)) {
            qWarning() << "E K K E  Could not connect to Radio object: " << mPpsObject->errorString();
        }
    }
    

    and here's the SLOT:

    void ApplicationUI::onPpsReadyRead()
    {
        bool readOk;
        QByteArray data = mPpsObject->read(&readOk);
        if (!readOk) {
            qDebug() << "N F C  !readOk";
            return;
        }
        bool decodeOk;
        const QVariantMap map = bb::PpsObject::decode(data, &decodeOk);
        if (!decodeOk) {
            qDebug() << "N F C  !decodeOk";
            return;
        }
        const QVariantMap ppsFile = map["@status"].toMap();
        if (ppsFile.isEmpty()) {
            qDebug() << "N F C  !ppsFile.isEmpty";
            return;
        }
    
        QString state;
        state = "nfc";
        if (ppsFile.contains(state)) {
            QString nfcValue = ppsFile[state].toMap()["state"].toString();
            qDebug() << "N F C   current   STATE: " << nfcValue;
            if(nfcValue == "OFF") {
                emit nfcOff();
            }
            disconnect(mPpsObject, SIGNAL(readyRead()), this, SLOT(onPpsReadyRead()));
            mPpsObject->deleteLater();
        }
        return;
    }
    

    As soon as I get a State NFC I disconnect subscription because there is already an NFC events bps events loop, where I'll be notified if NFC pass in review status:

    void ApplicationUI::handleNfcEvent(bps_event_t *event)
    {
        uint16_t code = bps_event_get_code(event);
        nfc_event_t *nfcEvent;
        nfc_target_t* target = NULL;
        nfc_result_t rc;
        uchar_t id[20];
        size_t idLength = 0;
    
        switch (code) {
            case NFC_TAG_READWRITE_EVENT:
                ....
                break;
            case NFC_SNEP_CONNECTION_EVENT: {
                ....
                break;
            case NFC_NDEF_PUSH_SUCCEED_EVENT: {
                ...
                break;
            case NFC_NDEF_PUSH_FAILURE_MSG_OVER_SIZE_EVENT: {
                ...
                break;
            case NFC_NDEF_PUSH_FAILURE_REJECTED_EVENT: {
                ...
                break;
            case NFC_NDEF_PUSH_FAILURE_IO_ERROR_EVENT: {
                ...
                break;
            case NFC_ON_EVENT:
                ...
                break;
            case NFC_OFF_EVENT:
                ...
                emit nfcOff();
                break;
            default:
                ...
                break;
        }
    
        // don't forget to delete the target
        if (target != NULL) {
            nfc_destroy_target(target);
        }
    }
    

    It works fine now.

    As yet I had no information if there is a way to start the NFC programmatically open settings NFC detection NFC OFF if:

    void ApplicationUI::nfcSystemSettings()
    {
        InvokeRequest cardRequest;
        cardRequest.setUri("settings://nfc");
        cardRequest.setMimeType("settings/view");
        cardRequest.setAction("bb.action.OPEN");
        cardRequest.setTarget("sys.settings.card");
        mInvokeManager->invoke(cardRequest);
    }
    
  • Strange behavior of ListView

    Hello
    I use following code:

     ListView {       id: listView listItemComponents: ListItemComponent {           Container {               id: listItemContainer               property string packageId: ListItemData.packageId               property variant packageDetailsPage               layout: AbsoluteLayout { }               WebImageView               {                   preferredHeight: 290                   preferredWidth: 751                   url: ListItemData.url;              }          }     }
    

    code for WebImageView:

    webimageview. HPP

    #ifndef WEBIMAGEVIEW_H_
    #define WEBIMAGEVIEW_H_
    
    #include 
    #include 
    #include 
    #include 
    using namespace bb::cascades;
    
    class WebImageView: public bb::cascades::ImageView {
        Q_OBJECT
        Q_PROPERTY (QUrl url READ url WRITE setUrl NOTIFY urlChanged)
        Q_PROPERTY (float loading READ loading NOTIFY loadingChanged)
    
    public:
        WebImageView();
        const QUrl& url() const;
        double loading() const;
    
        public Q_SLOTS:
        void setUrl(const QUrl& url);
        void clearCache();
    
        private Q_SLOTS:
        void imageLoaded();
        void dowloadProgressed(qint64,qint64);
    
        signals:
        void urlChanged();
        void loadingChanged();
    
    private:
        static QNetworkAccessManager * mNetManager;
        static QNetworkDiskCache * mNetworkDiskCache;
        QUrl mUrl;
        float mLoading;
    
        bool isARedirectedUrl(QNetworkReply *reply);
        void setURLToRedirectedUrl(QNetworkReply *reply);
    };
    
    #endif /* WEBIMAGEVIEW_H_ */
    

    webimageview.cpp

    #include "WebImageView.h"
    #include 
    #include 
    //#include 
    #include 
    
    using namespace bb::cascades;
    
    QNetworkAccessManager * WebImageView::mNetManager = new QNetworkAccessManager();
    //QNetworkDiskCache * WebImageView::mNetworkDiskCache = new QNetworkDiskCache();
    
    WebImageView::WebImageView() {
        // Initialize network cache
        //mNetworkDiskCache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation));
    
        // Set cache in manager
        //mNetManager->setCache(mNetworkDiskCache);
    
        // Set defaults
    
        mLoading = 0;
    }
    
    const QUrl& WebImageView::url() const {
        return mUrl;
    }
    
    void WebImageView::setUrl(const QUrl& url) {
        // Variables
    
            mUrl = url;
            mLoading = 0;
            qDebug()<<"url:: "<get(request);
    
            // Connect to signals
            QObject::connect(reply, SIGNAL(finished()), this, SLOT(imageLoaded()));
            QObject::connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(dowloadProgressed(qint64,qint64)));
    
            emit urlChanged();
    
    }
    
    double WebImageView::loading() const {
        return mLoading;
    }
    
    void WebImageView::imageLoaded() {
        // Get reply
        QNetworkReply * reply = qobject_cast(sender());
        QObject::disconnect(reply, SIGNAL(finished()), this, SLOT(imageLoaded()));
        QObject::disconnect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(dowloadProgressed(qint64,qint64)));
        if (reply->error() == QNetworkReply::NoError) {
            if (isARedirectedUrl(reply)) {
                setURLToRedirectedUrl(reply);
                return;
            } else {
                QByteArray imageData = reply->readAll();
                setImage(Image(imageData));
            }
        }
        // Memory management
        reply->deleteLater();
    }
    
    bool WebImageView::isARedirectedUrl(QNetworkReply *reply) {
        QUrl redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
        return !redirection.isEmpty();
    }
    
    void WebImageView::setURLToRedirectedUrl(QNetworkReply *reply) {
        QUrl redirectionUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
        QUrl baseUrl = reply->url();
        QUrl resolvedUrl = baseUrl.resolved(redirectionUrl);
    
        setUrl(resolvedUrl.toString());
    }
    
    void WebImageView::clearCache() {
        //mNetworkDiskCache->clear();
    }
    
    void WebImageView::dowloadProgressed(qint64 bytes, qint64 total) {
        mLoading = double(bytes) / double(total);
    
        emit loadingChanged();
    }
    

    I use ListDataModel. and code above works fine and the loading of the images. But when there are more than 100 items in a list it shows the bad images in some WebImageView. When you scroll through random images change. I checked the url property of webImageView to the point where bad image is loaded, but there the right url.

    in this connection, blackberry says that view list follows MVC architecture, and QObject belonged to ListView objects are deleted when scrolling out of the area visible to the element to which they belong, or when the ListView itself is deleted. What is the cause of my problem? If not, this what's wrong with this code? Help, please...

    nik005 wrote:

    @ekke Yes. If I scroll slowly, it works fine.

    THX.

    Then, it's the same reason.

    as soon as I have a small reproducible application to create a problem, I'll add this thread and let you know

  • Notification when changes in the keyboard language

    On two physical keyboard devices and devices to contact user can change the language or the keyboard (i.e. the input language). Is there a way to the running application to detect when such a change happens?

    Any help is greatly appreciated.

    I don't think that BPS has this info anywhere, here how get it instead of the PPS.

    Don't forget to add some LIBS +=-lbb to your pro file.

    You can reuse the class PpsWatch for any other purpose PPS incidentally, my app "File System" allows you to navigate to the folder MAP to discover the various objects available PPS, or you can also use your BlackBerry browser and copy - paste this url:

    file:///PPS/

    // applicationui.cpp
    
    #include "applicationui.hpp"
    
    #include 
    #include 
    #include 
    #include 
    
    #include 
    
    using namespace bb::cascades;
    
    ApplicationUI::ApplicationUI() :
            QObject()
    {
        // Don't forget to add LIBS += -lbb to your pro file
        m_ppsWatch = new PpsWatch("/pps/services/input/options", this);
        connect(m_ppsWatch, SIGNAL(logMessage(const QString&)), this, SLOT(onLogMessage(const QString&)));
        connect(m_ppsWatch, SIGNAL(ppsFileReady(const QVariantMap&)), this, SLOT(onPpsFileReady(const QVariantMap&)));
    
        // prepare the localization
        m_pTranslator = new QTranslator(this);
        m_pLocaleHandler = new LocaleHandler(this);
    
        bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
        // This is only available in Debug builds
        Q_ASSERT(res);
        // Since the variable is not used in the app, this is added to avoid a
        // compiler warning
        Q_UNUSED(res);
    
        // initial load
        onSystemLanguageChanged();
    
        // Create scene document from main.qml asset, the parent is set
        // to ensure the document gets destroyed properly at shut down.
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // Create root object for the UI
        AbstractPane *root = qml->createRootObject();
    
        // Set created root object as the application scene
        Application::instance()->setScene(root);
    }
    
    void ApplicationUI::onLogMessage(const QString& message) {
        qDebug() << message;
    }
    
    void ApplicationUI::onPpsFileReady(const QVariantMap& ppsMap) {
        if (ppsMap.contains("languages.active_lang_layouts")) {
            QVariantMap active_lang_layouts = ppsMap["languages.active_lang_layouts"].toMap();
            QStringList locales = active_lang_layouts["locales"].toStringList();
    
            qDebug() << "Language list used right now:" << locales;
        }
    }
    
    void ApplicationUI::onSystemLanguageChanged()
    {
        QCoreApplication::instance()->removeTranslator(m_pTranslator);
        // Initiate, load and install the application translation files.
        QString locale_string = QLocale().name();
        QString file_name = QString("KeyboardLanguage_%1").arg(locale_string);
        if (m_pTranslator->load(file_name, "app/native/qm")) {
            QCoreApplication::instance()->installTranslator(m_pTranslator);
        }
    }
    
    // applicationui.hpp
    
    #ifndef ApplicationUI_HPP_
    #define ApplicationUI_HPP_
    
    #include 
    
    #include 
    
    namespace bb
    {
        namespace cascades
        {
            class LocaleHandler;
        }
    }
    
    class QTranslator;
    
    /*!
     * @brief Application UI object
     *
     * Use this object to create and init app UI, to create context objects, to register the new meta types etc.
     */
    class ApplicationUI : public QObject
    {
        Q_OBJECT
    public:
        ApplicationUI();
        virtual ~ApplicationUI() {}
    
    private slots:
        void onLogMessage(const QString& message);
        void onPpsFileReady(const QVariantMap& ppsMap);
        void onSystemLanguageChanged();
    
    private:
        QTranslator* m_pTranslator;
        bb::cascades::LocaleHandler* m_pLocaleHandler;
    
        PpsWatch* m_ppsWatch;
    };
    
    #endif /* ApplicationUI_HPP_ */
    
    /*
     * PpsWatch.cpp
     *
     *  Created on: 2015-06-05
     *      Author: Roger
     */
    
    #include 
    #include 
    
    PpsWatch::PpsWatch(const QString& path, QObject *_parent) {
        emit logMessage("PpsWatch::PpsWatch()");
    
        if (_parent)
            this->setParent(_parent);
    
        m_path = path;
        m_mapTitle = "@" + path.split("/").last();
    
        m_ppsObject = new bb::PpsObject(path + "?wait,delta", this);
        connect(m_ppsObject, SIGNAL(readyRead()), this, SLOT(onPpsReadyRead()));
    
        if(!m_ppsObject->open(bb::PpsOpenMode::Subscribe)) {
            emit logMessage("Could not connect to " + path + " object: " + m_ppsObject->errorString());
        }
    }
    
    PpsWatch::~PpsWatch()
    {
        emit logMessage("PpsWatch::~PpsWatch()");
        delete m_ppsObject;
        m_ppsObject = NULL;
    }
    
    void PpsWatch::changePath(const QString& path) {
        emit logMessage("PpsWatch::changePath() " + path);
    
        if (m_path == path) {
            emit logMessage("Same path as before, return");
            return;
        }
    
        m_path = path;
        m_mapTitle = "@" + path.split("/").last();
    
        if(!m_ppsObject->close()) {
            emit logMessage("Could not disconnect from " + m_ppsObject->objectName() + " object: " + m_ppsObject->errorString());
        }
        else {
            disconnect(m_ppsObject, SIGNAL(readyRead()), this, SLOT(onPpsReadyRead()));
        }
    
        m_ppsObject = new bb::PpsObject(path + "?wait,delta", this);
        connect(m_ppsObject, SIGNAL(readyRead()), this, SLOT(onPpsReadyRead()));
    
        if(!m_ppsObject->open(bb::PpsOpenMode::Subscribe)) {
            emit logMessage("Could not connect to " + path + " object: " + m_ppsObject->errorString());
        }
    }
    
    void PpsWatch::onPpsReadyRead() {
        emit logMessage("PpsWatch::onPpsReadyRead()");
    
        bool readOk;
        QByteArray data = m_ppsObject->read(&readOk);
        if(!readOk) { return; }
    
        bool decodeOk;
        const QVariantMap map = bb::PpsObject::decode(data, &decodeOk);
        if(!decodeOk) { return; }
    
        const QVariantMap ppsFile = map[m_mapTitle].toMap();
        if (ppsFile.isEmpty()) { return; }
    
        emit ppsFileReady(ppsFile);
    }
    
    /*
     * PpsWatch.h
     *
     *  Created on: 2015-06-05
     *      Author: Roger
     */
    
    #ifndef PPSWATCH_H_
    #define PPSWATCH_H_
    
    #include 
    #include 
    
    class PpsWatch : public QObject
    {
        Q_OBJECT
    
    public:
        PpsWatch(const QString& path, QObject *_parent = 0);
        virtual ~PpsWatch();
    
        void changePath(const QString& path);
    
    private slots:
        void onPpsReadyRead();
    
    private:
        bb::PpsObject* m_ppsObject;
    
        QString m_path;
        QString m_mapTitle;
    
    signals:
        void logMessage(const QString&);
        void ppsFileReady(const QVariantMap&);
    };
    
    #endif /* PPSWATCH_H_ */
    
  • How to convert latitude and longitude bb10 postal code?

    Hi, I want to know how to get the zip code of North latitude and longitudein BB10. I had the latitude, longitude and now I need to convert it to a zip code.

    I tried under document bb10 code

    /Reverse GeoCoding
    QStringList serviceProviders =
            QGeoServiceProvider::availableServiceProviders();
    if (serviceProviders.size()) {
        QGeoServiceProvider *serviceProvider = new QGeoServiceProvider(            serviceProviders.at(0));
        QGeoSearchManager *searchManager = serviceProvider->searchManager();
        //searchManager->setProperty("boundary", "city");    reply = searchManager->reverseGeocode(QGeoCoordinate(lat,long));
    
        bool finished_connected = QObject::connect(reply, SIGNAL(finished()),
                this, SLOT(readReverseGeocode()));
    
        bool error_connected = QObject::connect(reply,            SIGNAL(error(QGeoSearchReply::Error, QString)), this,            SLOT(reverseGeocodeError(QGeoSearchReply::Error, QString)));
    
    //Reverse GeoLocation
    void LocationHandler::readReverseGeocode() {
    QList LocDetList = reply->places();
    QGeoPlace locDe = LocDetList.at(0);qDebug() << "adr --> " << locDe.address().state();qDebug()<<"code"<deleteLater();
    }
    
    `void LocationHandler::reverseGeocodeError(QGeoSearchReply::Error error,
        QString errorString) {qDebug() << "( Geo::reverseGeocodeError ) " << errorString;reply->deleteLater();
    }
    
    I am getting below output
    
    adr "" code "" 
    
    I am not getting the values for code .What is the problem
    

    This code works for me, you can set a lower accuracy in meters (better accuracy) to ensure that you get a good Postal Code. My guess is (precision< 100)="" should="" be="">

    void Magic::positionUpdated(const QGeoPositionInfo & pos)
    {
        qDebug() << "positionUpdated()";
    
        // Get a GPS fix with an accuracy of less than 2000 meters and save the coordinates for further use
        qDebug() << pos.coordinate().latitude() << pos.coordinate().longitude();
        double accuracy = pos.attribute(QGeoPositionInfo::HorizontalAccuracy);
        qDebug() << accuracy;
        if (accuracy < 2000) {
            double lat = pos.coordinate().latitude();
            double lon = pos.coordinate().longitude();
            source->stopUpdates();
            if (!saved) {
    // This saved bool is needed because this slot gets called multiple time even after source->stopUpdates() is called. Initialize it to false in your constructor
                saved = true;
    
                // Initialize QGeoSearchManager
                QGeoSearchManager* searchManager;
                QGeoServiceProvider* serviceProvider;
                QStringList serviceProviders = QtMobilitySubset::QGeoServiceProvider::availableServiceProviders();
                if ( serviceProviders.size() ) {
                    serviceProvider = new QtMobilitySubset::QGeoServiceProvider(serviceProviders.at(0));
                    searchManager = serviceProvider->searchManager();
                }
    
                // create GeoCoordinate from latitude and longitude
                QtMobilitySubset::QGeoCoordinate myCoord =  QtMobilitySubset::QGeoCoordinate(lat, lon);
    
                // get reverseGeocode
                QGeoSearchReply* reply = searchManager->reverseGeocode(myCoord);
    
                QObject::connect(reply, SIGNAL(finished()), this, SLOT(readReverseGeocode()));
            }
        }
    }
    
    void Magic::readReverseGeocode()
    {
        qDebug() << "readReverseGeocode()";
        QGeoSearchReply* reply = qobject_cast(sender());
        // Save the city name to Settings for further use
        if (reply->error() != QGeoSearchReply::NoError)
            return;
    
        QList places = reply->places();
        if (places.length() <= 0)
            return;
        else {
            QGeoAddress address = places[0].address();
            qDebug() << "address.postcode() :" << address.postcode();
        }
        disconnect(reply, SIGNAL(finished()), this,SLOT(readReverseGeocode()));
        reply->deleteLater();
    }
    
  • Key capture within a ScrollView

    I have a check that when I get a touch, I followed the touch() signal when the user moves upwards and downwards, to change the value there is a. Like in this video https://www.youtube.com/watch?v=aK0Mqxg89xc , but in the vertical direction.

    If I put the control inside a ScrollView, control no longer works, because I get a TouchEvent Cancel.

    I tried to change all the ancestors of TouchPropagationMode view touchPropagationMode:assThrough button down event and bring back them into the contact upwards / button cancel event (so the ScrollView should stop running events for the scrollbar, when this control has captured the touch event), but it does not work, and I keep getting the Cancel event.

    I also had a look at this thread http://supportforums.blackberry.com/t5/Cascades-Development/block-scroll-view/td-p/2029435 , that he says makes the turn of events, but I don't understand leave a control within the view, but from the outside.

    No hint of how to capture key events and prevent the ScrollView parent of during my control is the capture of the touch event!

    Finally found a way to solve this problem. Sorry for the 'spam' in the forum :/

    The path is the same used in the post I mentioned in my first post.

    I put a signal handler for my touch event.

    QObject::connect( counterLabel, SIGNAL( touch(bb::cascades::TouchEvent*) ),
                          this, SLOT( onTouchEvent( bb::cascades::TouchEvent* )));
    

    So when I get a touch down in my counterLabel, I call the hijackTouchEvents:

    void TouchCounter::onTouchEvent( bb::cascades::TouchEvent* touchEvent )
    {
        TouchType::Type eType = touchEvent->touchType();
    
        if( eType == TouchType::Down ){
            counterUpdateTimer->start();
            initialY = touchEvent->windowY();
            counterUpdateIncrement = 0;
            timerIntervalAccum = 0;
            hijackTouchEvents();
            touchEvent->accept();
        }
    }
    

    and I get the "oldest ancestor" to install a touchCapture Manager and block all events key to its immediate children (save mode to restore them later).

    void TouchCounter::hijackTouchEvents()
    {
        blockedNode = NULL;
        capturingTouchesNode = this;
        VisualNode* next;
        while( (next = qobject_cast(capturingTouchesNode->parent() ) ) != 0){
            blockedNode = capturingTouchesNode;
            capturingTouchesNode = next;
        }
        QObject::connect( capturingTouchesNode, SIGNAL( touchCapture(bb::cascades::TouchEvent*) ),
                              this, SLOT( onTouchCaptureEvent( bb::cascades::TouchEvent* )));
        if( blockedNode != NULL ){
            blockedNodeOriginalPropagationMode = blockedNode->touchPropagationMode();
            blockedNode->setTouchPropagationMode( TouchPropagationMode::None);
        }
    }
    

    I also have the function to disconnect from the touchCapture:

    
    void TouchCounter::freeTouchEvents()
    {
        QObject::disconnect( capturingTouchesNode, SIGNAL(  touchCapture(bb::cascades::TouchEvent*) ),
                                  this, SLOT( onTouchCaptureEvent( bb::cascades::TouchEvent* )));
        capturingTouchesNode = 0;
    
        if( blockedNode != NULL){
            blockedNode->setTouchPropagationMode( blockedNodeOriginalPropagationMode );
            blockedNode = NULL;
        }
    }
    

    And I call the freeTouchEvents function in the onTouchCaptureEvent, when I get a touch up or touch cancel event.

    
    void TouchCounter::onTouchCaptureEvent( bb::cascades::TouchEvent* touchEvent )
    {
        TouchType::Type eType = touchEvent->touchType();
        VisualNode* tgt = touchEvent->target();
        touchEvent->propagationPhase();
        if( eType == TouchType::Move && capturingTouchesNode != 0 ){
            float a = touchEvent->windowY();
            float diff = a - initialY;
            counterUpdateIncrement = getUpdateRateMilliseconds( diff  );
            if( diff > 10.0f ){
                valueDirection = -1;
            }else if( diff < 10.0f ){
                valueDirection = 1;
            }else{
                valueDirection = 0;
            }
            touchEvent->accept();
        }else if( eType== TouchType::Up || eType == TouchType::Cancel ){
            initialY = 0;
            counterUpdateTimer->stop();
            touchEvent->accept();
            freeTouchEvents();
        }
    }
    

    I hope this is help someone!

  • signal no disconnection when the page is closed by the gesture of eye?

    Hello

    Falling on a particular issue... First of all, I connect my context object to signal a bit of javascript using the onCreationCompleted

    onCreationCompleted:
    {
            // When the top-level Page is created, direct the data source to start
            // loading data
            MyObject.signal_1.connect(onJavaScriptFunction_1);         MyObject.signal_2.connect(onJavaScriptFunction_2);               MyObject.signal_3.connect(onJavaScriptFunction_3); }
    

    So far everything is going well, but if I unplug these signals, the page is busted, so the next time that the page is created, these signals will be attached to the same javascript function once more and so on for every time that the page is re-created.

    Then I thought, I should unplug these signals when the page came out... Therefore, I have given the NavigationPage because I couldn't see any signal onPopped or onDestroy... So I used the following code:

        paneProperties: NavigationPaneProperties
        {
            backButton: ActionItem
            {
                onTriggered:
                {
                    console.debug("Popping page, disconnect signals...")                // Disconnect signals
                    MyObject.signal_1.disconnect(onJavaScriptFunction_1);                      MyObject.signal_2.disconnect(onJavaScriptFunction_2);                 MyObject.signal_3.disconnect(onJavaScriptFunction_3);
    
                    // define what happens when back button is pressed here
                    // in this case is closed the detail page
                    navigationPane.pop();
                }
            }
        }
    

    After testing a few creation of the page / page popping, everything works fine. Signal is attached only once. But every time I close the page by using the gesture of look, then I suddenly I begin to see multiple signals attached to my context object... as directed by the console log output:

    emit > signal_1
    onJavaScriptFunction_1()
    onJavaScriptFunction_1()
    emit > signal_2
    onJavaScriptFunction_2()
    onJavaScriptFunction_2()
    

    My questions

    1. Where can I sign out signals to avoid leaving the unwanted signals connection?
    2. All the QML object seems to have a signal of {onCreationCompleted}, is an onDestroyCompleted or something similar?

    Thank you

    Hello

    There is no equivalent onCreationCompleted.

    But you can set a JavaScript function such as

    Page {
      function cleanup() {
        // disconnect signals here
      }
    

    and call from NavigationPane onPopTransitionEnded:

    NavigationPane {
      onPopTransitionEnded: {
        page.cleanup()
        page.destroy() // destroy the page if it was created dynamically
      }
    

    UPD: another option is to use the element of connection of QtQuick. According to this thread, it works in Cascades:

    http://supportforums.BlackBerry.com/T5/native-development/QML-connections-element/m-p/2063301#M9550

    Connect/disconnect signals automatically, but I haven't checked this app cascading.

  • 1370 wlan mini-pci card - media disconnected? no signal, connects to the network

    I installed a dell pc on a 1370 wlan mini card

    Dell inspiron 1200 reference.

    I get a signal of 1% with the wireless network wizard. I was able to

    get in touch with the router, but the signal is very weak.

    I made a report with ipconfig/all, and here are the results:

    Microsoft Windows XP [Version 5.1.2600]
    Copyright (C) 1985-2001 Microsoft Corp.

    C:\Documents and Settings\Christopher Schmidt > ipconfig/all

    Windows IP configuration

    Name of the host...: CHRISLAPTOP
    Primary Dns suffix...:
    Node... type: hybrid
    Active... IP routing: No.
    Active... proxy WINS: No.

    Adapter Ethernet Wireless Network Connection 4:

    State of the media...: Media disconnected
    ... Description: Dell Wireless 1370 WLAN Minipci car
    d
    Physical address.... : 00-16-CF-CC-13-2E

    The State of the media: media disconnected means that the

    card is not seated correctly?

    In Device Manager, it says that the device is functioning properly.

    Driver version: 4.10.40.0

    Driver date: 02/11/2005


Maybe you are looking for

  • internal document hyperlinks does not

    I created a web page of html with internal hyperlinks to parts of the page, for example < a href = "#qm_1.0" > QM. 1.0 < /a >, which connects to < a name = "#qm_1.0" > QM 1.0 < /a >.These links work fine in IE but not with Firefox. Links to other pag

  • Satellite A200 - 14 d: vertical scrolling touchpad works more regularly

    The driver is updated, the touchpad works normally most of the time, but occasionally (very often) the vertical scrolling stops (the bar on the right side of the touchpad) react and it is impossible to scroll vertically. After awhile, he reactivates

  • Satellite A300 restarts when I connect AC adapter / CC

    I have Toshiba Satellite A300, and there is problem, as soon as I connect my adapter to my labtob it restarts directry, and there is no problem when I connect my adapter for my labtob in offline or even in safe mode.I tried to update the BIOS but I c

  • HP Pavilion x 360 Convertible: the Intel HD graphics driver update fails to install

    Hello I got my new laptop for Christmas and a few days ago, HP support assistant told me that there was a Version "Intel high definition (HD) Graphics Driver Update": 10.18.15.4281Ep3. I downloaded the updated, but after that 4 attempts trying to ins

  • laptop Pavilion 15 PCn205TX: drive hard short DST check failed

    The problem is that my computer takes really long to start about 1 to 2 hours (yes I was sick for hours) Diagnosics result told that check DST short of disk hard failed and gave the failure ID 6E1W7W-76R81Q-MFPWWK-60QU03