Cómo utilizar el control dateTimeEdit de QT para configurar la hora
void moreidDialog: :slot_save_time_ key()
{
QDateTime hora
QString str = txt_time-gt(); p>
// Determinar si el formato es correcto
if (str.count(".") != 4)
{
txt_time -gt; setText (tr("ge shi cuo wu"));
retorno
}mid(i 1, j - i - 1); p> i = j;
j = str.indexOf("."." , i 1);
QString día = str.mid(i 1, j - i - 1);
i = j;
j = str.indexOf("."." ." , i
QString hora = cadena .mid(i 1, j - i - 1);
i = j
j = str.indexOf("."." , i 1);
QString min = str.mid(i 1, j - i - 1
j = str.indexOf(".mid(i 1, j - i - 1); p>
bool ok = false
año.toInt(amp; ok
if (ok == false)
{ p>
txt_ time-gt; setText(tr("ge shi cuo wu"));
return
}
mes.toInt; (amp; ok );
if (ok == false)
{
txt_time- gt; setText(tr("ge shi cuo wu")
retorno
}
día.toInt(amp; ok
if (ok == false)
p>{
txt_time- gt; setText(tr("ge shi cuo wu");
return;
}
hora .toInt(amp;ok);
if (ok == false)
{
txt_time-gt(tr(" ge shi cuo wu ");
return;
}
min.toInt(amp; ok);
if (ok == falso)
{
p>
txt_time-gt; setText(tr("ge shi cuo wu");
Retorno;
}
if (ok == falso)
{
txt_time-gt; setText(tr("ge shi cuo wu");
Retorno.
str = "fecha -s " mes "/" día "/" año
system(str.toLatin1().data()
str = "fecha -s "); hora ":" min ":" "00";
system(str.toLatin1().data());
//Forzar escritura en CMOS
sistema("reloj -w");
}