设置系统时间
都是调用win api
void SetSystemInfo::on_pushButton_applyDate_clicked()
{
#ifdef Q_OS_WIN
SYSTEMTIME sysTime;
GetLocalTime(&sysTime);
sysTime.wYear = ui->dateEdit->date().year();
sysTime.wMonth = ui->dateEdit->date().month();
sysTime.wDay = ui->dateEdit->date().day();
SetLocalTime(&sysTime);
#endif
}
void SetSystemInfo::on_pushButton_applyTime_clicked()
{
#ifdef Q_OS_WIN
SYSTEMTIME sysTime;
GetLocalTime(&sysTime);
sysTime.wHour = ui->timeEdit->time().hour();
sysTime.wMinute = ui->timeEdit->time().minute();
sysTime.wSecond = ui->timeEdit->time().second();
SetLocalTime(&sysTime);
#endif
}
http://www.qtcn.org/bbs/read-htm-tid-65438.html