BlackBerry Q10 timer does not work for a project of 10 Q Lable in Blackberry

Hi all

I'm just a new Black Berry Q 10 and just beginner. I get some helpful solutions here to correct my mistakes. I am very grateful for this site and its members.

In my application, I would like to add a timer to a lable. for every second, I want to Christophe Lable value. Here is my code Qml and timer.

// Default empty project template
import bb.cascades 1.0
import CustomTimer 1.0
// creates one page with a label
Page {
    Container {
        id:root
        layout: DockLayout {}
        property int f: 10
        Label {
            id: timerLabel
            text: qsTr("Hello World")
            textStyle.base: SystemDefaults.TextStyles.BigText
            verticalAlignment: VerticalAlignment.Center
            horizontalAlignment: HorizontalAlignment.Center

        }
        Timer {
            id: lightTimer
            // Specify a timeout interval of 1 second
            interval: 1000
            onTimeout: {
                root.f -= 1;
                timerLabel.text = "Timer:"+root.f;
                lightTimer.start();
                if(root.f<0){
                    lightTimer.stop();
                }
                } // end of onTimeout signal handler
        } // end of Timer

    }
}
#include 
#include "timer.hpp"

Timer::Timer(QObject* parent)
     : bb::cascades::CustomControl(),
     _timer(new QTimer(this))
{
    Q_UNUSED(parent);
    connect(_timer, SIGNAL(timeout()), this, SIGNAL(timeout()));
    setVisible(false);
}

bool Timer::isActive()
{
    return _timer->isActive();
}

int Timer::interval()
{
    return _timer->interval();
}

void Timer::setInterval(int m_sec)
{
    // If the timer already has the specified interval, do nothing
    if (_timer->interval() == m_sec)
        return;

    // Otherwise, set the interval of the timer and emit the
    // intervalChanged() signal
    _timer->setInterval(m_sec);
    emit intervalChanged();
}

void Timer::start()
{
    // If the timer has already been started, do nothing
    if (_timer->isActive())
        return;

    // Otherwise, start the timer and emit the activeChanged()
    // signal
    _timer->start();
    emit activeChanged();
}

void Timer::stop()
{
    // If the timer has already been stopped, do nothing
    if (!_timer->isActive())
        return;

    // Otherwise, stop the timer and emit the activeChanged()
    // signal
    _timer->stop();
    emit activeChanged();
}
#ifndef TIMER_HPP_
#define TIMER_HPP_

#include 
#include 

class QTimer;

class Timer : public bb::cascades::CustomControl
{
    Q_OBJECT

    Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
    Q_PROPERTY(int interval READ interval WRITE setInterval
               NOTIFY intervalChanged)

public:
    explicit Timer(QObject* parent = 0);

    bool isActive();
    void setInterval(int m_sec);
    int interval();

public

slots:
    void start();
    void stop();

signals:
    void timeout();
    void intervalChanged();
    void activeChanged();

private:
    QTimer* _timer;
};

#endif /* TIMER_HPP_ */

and I sign up time as follws custome...

Registering the custome timer
qmlRegisterType("CustomTimer", 1, 0, "Timer");
    // 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);

where I'm wrong... I'm just Hello world but Timer shows no lable value. Please help me!

Hello

It was my mistake in looking at timer in Qml. The good way to start is given below.

Already... .i was

  Timer {
            id: lightTimer
            // Specify a timeout interval of 1 second
            interval: 1000
            onTimeout: {
                root.f -= 1;
                timerLabel.text = "Timer:"+root.f;
                lightTimer.start();
                if(root.f<0){
                    lightTimer.stop();
                }
               } // end of onTimeout signal handler
        } // end of Timer

but now to hide a bad start timer and start in the right way

Timer {
            id: lightTimer
            // Specify a timeout interval of 1 second
            interval: 1000
            onTimeout: {
                root.f -= 1;
                timerLabel.text = "Timer:"+root.f;
//                lightTimer.start();
//                if(root.f<0){
//                    lightTimer.stop();
//                }
               } // end of onTimeout signal handler
        } // end of Timer

    }
    onCreationCompleted: {
        lightTimer.start();
    }

Thank you!!!

Tags: BlackBerry Smartphones

Similar Questions

  • Family timer does not work for Windows 8

    I can view the activity report and check the websites visited, but everything doesn't seem to work properly.  The time settings and the curfew does not work and when I view the reports using pc is far from what is used.

    Hello

    I would like to you can check this post about delays on parental control. Refer to the post of Eugene_R.

    Time does not

    Moreover, in a resolution of the initial problem, I suggest that reconfigure you the account user. Here's how:

    In Windows 8, you can use accounts of Microsoft as a user. You just link the Microsoft e-mail account to the new standard user. Follow these steps:

    Note: Make sure that you have an internet connection to create a user with a Microsoft account.

    1. press Windows key on your keyboard to access the applications screen.

    2. tap create an account (you will be redirected to search application screen automatically).

    3. click on settings (second option with the gear icon).

    4. click on create an account on the selection to the left pane. (You may be prompted for access admin select an admin user, and then enter the administrator password).

    5. in the account management window, click Add a user account.

    6. you will be prompted to add a user, enter the Microsoft account email address in the text box then click on Next.

    7. check This is a child account? Turn on family safety for PC usage reports.

    8. click on Finish.

    After you create the child account, you can then go to the Family Safety website, log in using the parent account and then manage restrictions and control of your child options.

    Second: In case you want your child free of any restriction which actually an adult account, you will need to just make sure that he or she is not a member of the safety of your family to check on the Family Safety website. To remove a child, go to manage the list of the members of the family. Select the account you want to delete by checking the box on the right, click on remove, then confirm by clicking on remove again.

    In case you have problems after deleting the account as a child, please update the personal data of the account by connecting to https://account.live.com/summarypage.aspx.

    Note: If you are currently logged in using your account, you must open a session and re-enter your child's account.

    Thank you.

  • BlackBerry App line does not work for me on 10.3.1.1179

    Hello
    Is - it still works?
    I ask because the link does not work for me on 10.3.1.1179

    I installed the nod as the link says without problems, then I downloaded and install the link on my phone. But it automatically closes when I press on it, even with Snapchat & Spotify.
    Anyone got it works on a Q10?

    MOD Edit: Edited post to reflect the new title of the topic

    Not all android applications work on BB10. I know that Snapchat does not work. Snapchat does not work, nor will they let someone else create an app to work. They don't like the BB users and do not plan to support them. Others I have not used personally so I can't say with certainty the current state for these applications.

  • Tap to talk time does not work on my watch

    Hey guys!

    Tap to talk time does not work on my watch.

    I know that his works only with Mickey/minnie.

    the watch is after unpari/pair, the "tap to speek" function is enabled (on the iphone and the watch)

    both are updated to the latest ios/watch OS and still...

    any ideas...?

    Thank you!

    Return on investment

    Hi King

    I suggest to wait until a few hours, leaving the face of Mickey or Minnie Mouse selected on your watch.

    My own experience (tested on two watches) is that the feature became available after waiting, without rebooting or unpairing / rematching of the watch. In one case, it took somewhere 3-5 hours, but you can see that the function starts working sooner than that.

    It can help to first turn the tap to set the time to stop, pause for a few moments and then turn it back on again.

  • EL Capitan automatic date time does not work

    People

    I use an El Capitan 10.11.5 MacBook Air version.

    I noticed that the data and time does not work even though it was set to auto to time.asia.apple.com.

    I ran these commands on a terminal

    $ping-c 5 time.asia.apple.com

    Ping: impossible to solve the time.asia.apple.com: Unknown host

    $ping-c 5 time.nist.gov

    PING ntp1.glb.nist.gov (64.113.32.5): 56 bytes

    64 bytes from 64.113.32.5: icmp_seq = 0 ttl = time 44 = 386,629 ms

    64 bytes from 64.113.32.5: icmp_seq = 1 ttl = time 44 = 307,532 ms

    tell me ping works but not for the server ntp - time.asia.apple.com

    $nslookup time.asia.apple.com

    Server: 192.168.1.254 address: 192.168.1.254 #53

    Non-authoritative answer: time.asia.apple.com canonical name = time - ios.g.aaplimg.com.

    time - ios.g.aaplimg.com canonical name = site time.apple.com.

    Site Time.Apple.com canonical name = time - osx.g.aaplimg.com

    $cat /etc/ntp.conf

    Server time.asia.apple.com.

    $ ntpq Pei

    No returned ID association

    Please, back up all data.

    Open the window of network preferences, if necessary, by clicking on the padlock icon in the lower left corner and entering your password. Cllck advanced, open the DNS tab and change the addresses of the servers as follows:

    8.8.8.8

    8.8.4.4

    It's Google DNS. Click OK, and then apply.

    In Safari, select

    ▹ Safari preferences... ▹ Confidentiality ▹ Remove All site data

    and confirm. If you use another browser, clear the cache memory. Test. Any difference?

    Notes:

    1. If you lose Internet access after the above change is made to your network settings, remove the Google servers in the network preferences pane, then click on the TCP/IP tab, then click on renew the DHCP lease. That should restore the original DNS settings; otherwise restore them yourself. Remember that you must click on apply so that the changes take effect.

    2. I do not use Google DNS myself, but I tested it, and I do not recommend it or any other provider DNS; the addresses of the servers are only available for testing purposes. There may be privacy and technical issues involved in the use of this service, that you should personally study before deciding whether to retain the settings. Other public DNS services exist.

  • WindowsXPSP3 / MSNDialup DOES NOT WORK FOR 6 weeks.

    WindowsXPSP3 / MSNDialup DOES NOT WORK FOR 6 weeks. I've been with remote access, since it was offered so I understand speed and ETC.

    Hot Mail (which I don't like) seems to work.

    On E-mail MSN - Cannot send or what I get Emails (all once in a while, we get... and when I go to Hotmail... arrived at 22). Spoke with 13 technicians, deleted all files (alt/shiftF9) 7 times. Some of the questions:

    MSN Inbox (on top left over files) continues to go to the yellow throttle and says I am offline and yet I am on line. Connection errors are the following: 0x80072efd / 0 x 0 80191002 / 0x80072eff deleted trash e.a. returns every time. Mark an unread Email and it is deleted. Tons and tons and tons of other issues. Microsoft Techs seem to be stuck on Shift/Alt/F9 and nothing is improving and sometimes gets worse... as the last time I alt/shif/F9...folders came back but old e-mail appears. Electronic mail in white and empty window. Super slow navigation & usually stops and tell me that I'm not online. Diagnosis of micro said: I am and contact MFG. A tech admitted that a new server is entered in questions. But 6weeks and I pay for the service? A tech says it's at my end frustrated, I got another PC, downloaded my MSN dialup and now... I stillHAVE questions about the addition of the computer. The 2 computers are not connected. Stand alones. Telephone lines checked. Audited modems. Microphone seems to keep secrets. And obviously can't solve my problems. Visibly frustrated spendinging 15 hours on the phone, and tired of the Microsoft Music on hold. Should I cancel? Today, same hot mail was. Using Internet Explorer, I get ERROR 500 messages or a web page from Microsoft to the particular address no longer exists. Unable to navigate while using MSN Internet Browser. What in the world that happens to us all the MSN people?

    Hi Buck,

    The question that you are running better agrees to the MSN forum at the link below.

    http://answers.MSN.com/forums.aspx?ForumID=c58ac82d-9d92-4FE0-8681-91e2d0bb1268

    For the related issue of Windows or anything related to the Windows operating system, do not hesitate to contact us and we will be happy to help you.

  • "Include the header row in the following Pages" does not work for the table

    Hello

    I use the 8.1.2.3337.1.509884 version.

    Pagnation function "include header line in the following Pages" does not work for any table in my design. (the check box cannot be verified little matter how many times I click it)

    I put such table already in a bodypage flow.

    Any reported similar problem?

    Any suggestions?

    Thank you.

    -Vicky

    The only thing I can think is that your table is not in a subform flowed. Who will stop the check boxes.

  • Single-pass does not work for Web sites after the last update of firefox

    Single-pass does not work for Web sites after the last update of firefox. This works in IE and Chrome and it works under windows (when starting the computer), but not with any website in Firefox.

    Firefox 30 spent some less commonly used "Always turned on" plugins "asking to activate. To check and change this to SimplePass, you can use the page modules. Either:

    • CTRL + SHIFT + a
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click on Plugins. Then on the right, check the control on the right side of the SimplePass.

    You may need to exit Firefox and start it again before it takes effect.

    A little luck?

  • Firefox Sync does not work for Tablet Android Nexus 10.

    Firefox Sync works for 2 PCs, but does not work for an Android tablet. It is said, that the tablet was connected successfully, I checked the bookmarks and history options to be synchronized and or bookmarks, or history of the browser has not been updated on my tablet.
    No errors. Anything not came to the Android device.
    I tried with 2 different synchronization profiles - same story for the second profile.

    Please note that we are currently living with Sync server issues. Our technicians are working around the clock to the question of setting and ensure that it works at its best. The current option is to try to keep synchronized and if you are able to synchronize properly, we recommend to not not to sync more than once every 2 hours.

    Thank you and sorry for the inconvenience.

  • Face time does not work since this morning if my wifi connection is fine and parameters also very well.

    IPhone 6, 114 GB, GB 72.6 available capacity. iOS 9.3.1

    Face time does not work since this morning. Connection Wi - Fi works very well

    Mamimisra wrote:

    IPhone 6, 114 GB, GB 72.6 available capacity. iOS 9.3.1

    Face time does not work since this morning. Connection Wi - Fi works very well

    https://support.Apple.com/en-us/HT204168

  • Recently closed tabs does not work for me

    Recently closed tabs does not work for me. When I go to history-> recently closed tabs is not available and the shortcut does not work. It happened a few weeks ago, and when it happened first, the shortcut would open the tabs in the weeks earlier. I can't find any information on this and would like to see it fixed.

    There are other things that need your attention on the updated the prefs that shows in your list of details of the system.

    Reset the general.useragent.compatMode.firefox to false, and all prefs network.http on the topic: config page.

    What is the value of the browser.sessionstore.max_tabs_undo pref?

  • The date and time does not work.

    I have an iphone 5 c.

    The date and time does not work. This is the second time.  The first time was about 3 to 4 months again and now again after upgrade to iOs9.3.1.

    Even after trying to change it manually, time slows down or stops.

    Everyone has problems with their date and time?

    • Try a forced reboot: hold down the House and on the buttons until the unit turns off. Ignore the cursor off if it appears. Once completed, if it does not start on it own, turn off power with the key On. In some cases, it also contributes to double click the Home button and close all applications before restarting.
    • Restore factory settings (no backup)
    • Make an appointment at your local Apple store to have it checked.
  • iMessage does not work for me. I have no text to send or receive texts as an alternative. I am able to use the Internet to navigate / social media but iMessage completely ceased to operate. I tried the usual phone turn off / on, reboot, etc.

    iMessage does not work for me. I have no text to send or receive texts as an alternative. I am able to use the Internet to navigate / social media but iMessage completely ceased to operate. I tried the usual phone turn off / on, reboot, etc. and still nothing. What can I do?

    What methods have tired to get it activated?

    You can disconnect from the iMessage

    Disconnect from the iCloud

    Reboot your phone

    Reconnect

    Wait iMessage activate

    Do you have a viable data plan?

  • AutoFill does not work for Firefox 4 and Microsoft Outlook

    AutoFill has already worked on Firefox 3.16 and Microsoft Outlook.
    Now I get a msg something like:
    "AutoFill does not work for this site" when I want to fill my info on a petition, etc..

    What "complete" you use in Firefox 4.0?

    Firefox is not a built-in function "fill", it has "full automatic" that would not display a message such as.

  • "Show my windows and tabs from last time ' does not work in version 3.6.8

    I select "show my windows and tabs from last time ' on the Options window - Panel general"when firefox starts", but it opens as my home page every time I start firefox.

    I tried this on two different computers. Both of them have the same problem.

    It worked fine in previous versions, but it does not work in version 3.6.8.

    If you use delete, search and download Firefox browsing history in Firefox 3.5 and later versions to clear the 'browsing history' the closing of Firefox then in restaurant tabs in the last session ("Save and exit" or "show my windows and tabs from last time ') does not work.

Maybe you are looking for