I have this code:
connect(timer, SIGNAL(timeout()),this,SLOT(delete_old_tuples()));
timer->start(3600000);
QTimer *timer=new QTimer;
connect(timer, SIGNAL(timeout()),this,SLOT(delete_old_tuples()));
timer->start(3600000);
To copy to clipboard, switch view to plain text mode
void MainWindow::delete_old_tuples(){
if (now >= timeoftheaction){
qApp
->tr
("Click Cancel to exit."),
QMessageBox::Cancel);
}
}
void MainWindow::delete_old_tuples(){
QDateTime now = QDateTime::currentDateTime();
QDateTime timeoftheaction (QDate (now.date()), QTime (15,0,0));
if (now >= timeoftheaction){
QMessageBox::critical(0, qApp->tr("Deleting tuples"),
qApp->tr("Click Cancel to exit."), QMessageBox::Cancel);
}
}
To copy to clipboard, switch view to plain text mode
Is this code correct? I want to delete the tuples of my database everyday at 15:00....Is there a better way?
Bookmarks