Hi ALL,
I am developing an application in which i want the clock to show continous time as of my PC(machine) time,when i run the application it shows the time but the time issnt refreshing ,it isnt changing at all ,i have QTimer for that purpose but it doesnt seem to work !!..
anyhelp would be apprecited..
HEADER FILE
..
public slots:
void updateTime();
QTime time;
QTimer *update;
QFont fontTime;
QGraphicsTextItem *timeItem;
QString timeString;
..
public slots:
void updateTime();
To copy to clipboard, switch view to plain text mode
SOURCE FILE
time = QTime::currentTime();
connect(update,SIGNAL(timeout()),this,SLOT(updateTime()));
update->start(1000);
timeString = time.toString("hh:mm A");
.. ..
timeItem = scene->addText(timeString);
timeItem->setFont(fontTime);
timeItem->setTextWidth(100);
timeItem->setPos(TIME_TEXT_X,TIME_TEXT_Y);
.. ..
void TrainingUI::updateTime()
{
time = QTime::currentTime();
}
time = QTime::currentTime();
update = new QTimer();
connect(update,SIGNAL(timeout()),this,SLOT(updateTime()));
update->start(1000);
timeString = time.toString("hh:mm A");
.. ..
timeItem = scene->addText(timeString);
timeItem->setFont(fontTime);
timeItem->setTextWidth(100);
timeItem->setPos(TIME_TEXT_X,TIME_TEXT_Y);
.. ..
void TrainingUI::updateTime()
{
time = QTime::currentTime();
}
To copy to clipboard, switch view to plain text mode
Bookmarks