02-21-2013 12:28 AM
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.
02-21-2013 02:06 AM
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.
02-27-2013 01:08 AM
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.