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

Reply
New Contributor
niharonly
Posts: 6
Registered: ‎01-27-2013
My Device: BB10
My Carrier: Airtel

How to show Analog Clock and Digital Clock??

Hello,

I want to show the analog clock as well as digital clock with current time by using qml file. Is there any idea or it possible only through cpp?? 

 

QDateTime now;
now = QDateTime::currentDateTime();

 

by using this code i am getting the current time and date but i want the proper way to show the current time running like in digital clock/analog clock. Please let me know asap.

 

Thank you.

Please use plain text.
Developer
kunal_one
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: How to show Analog Clock and Digital Clock??

showing digital clock should be easy, 

 

you can use custom font according to required looks and the use data format option to format current time and show that witl label. This should be enought for digital clock.

 

For analog clock, you will need to find out rotation for hour, minute and second clock, apply this rotation on element that represent hour, minute hand.

 

 

Please use plain text.
Developer
kunal_one
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: How to show Analog Clock and Digital Clock??

Hi, To add further clarification as you asked.

 

If you check QTime documentation here.

 

http://qt-project.org/doc/qt-4.8/qtime.htm

 

From QTime, Instance you can easily get hour, minutes and second component of time. That you can use to display the digital clock.

 

QTime also has toString method, using which you can get formated time.

Please use plain text.