本文整理汇总了C++中QTime::fromString方法的典型用法代码示例。如果您正苦于以下问题:C++ QTime::fromString方法的具体用法?C++ QTime::fromString怎么用?C++ QTime::fromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTime
的用法示例。
在下文中一共展示了QTime::fromString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCurrentTime
QTime ACARSAirport::getCurrentTime(QTime UTCTime)
{
QTime LCL = QTime(0,0,0,0);
LCL = LCL.fromString(UTCTime.toString());
LCL = LCL.addSecs(m_iTimezone);
return LCL;
}
示例2:
KVSO_CLASS_FUNCTION(dateTimeEdit,setTime)
{
CHECK_INTERNAL_POINTER(widget())
QString szFormat,szTime;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("format",KVS_PT_STRING,0,szFormat)
KVSO_PARAMETER("date",KVS_PT_STRING,0,szTime)
KVSO_PARAMETERS_END(c)
QTime time;
time=time.fromString(szTime,szFormat);
((QDateTimeEdit *)widget())->setTime(time);
return true;
}
示例3: on_pushButtonAddTask_clicked
void TimeKeeper::on_pushButtonAddTask_clicked()
{
QTime time;
Task task;
time = time.fromString(ui->lineEditStartTime->text());
task.setTime(time);
task.setID(ui->lineEditTaskId->text());
task.setActive(true);
taskList.append(task);
addTaskView(&task);
ui->lineEditTaskId->clear();
ui->lineEditStartTime->setText("00:00:00");
}
示例4: on_commandLinkButton_forceCLockOut_clicked
void UserManagement::on_commandLinkButton_forceCLockOut_clicked()
{
QDate currentDate = QDate::currentDate();
QTime currentTime = QTime::currentTime();
int hour = currentTime.toString("HH").toInt();
int minutes = currentTime.toString("mm").toInt();
if(minutes > 30)
{
hour++;
}
currentTime = currentTime.fromString(QString::number(hour) + ":" + "00", "HH:mm");
QString date = currentDate.toString("yyyy-MM-dd");
QString time = currentTime.toString("HH:mm");
{
Database conn;
conn.connOpen("Clock");
QSqlQuery * qry = new QSqlQuery(conn.mydb);
QString queryString;
QTextStream queryStream(&queryString);
queryStream << "UPDATE '" << currentEmpId <<"'"
<< " SET 'Time Out' = '" << time << "' where Date ='" << date << "'";
qry->prepare(queryString);
if(!qry->exec())
{
QMessageBox::critical(this, tr("Error"), qry->lastError().text());
}
else
{}
conn.connClose();
}
{
Database conn;
if(!conn.connOpen("Employee"))
{
qDebug () << "Database Connection Fatal Error";
}
QSqlQuery * qry = new QSqlQuery(conn.mydb);
QString queryString;
QTextStream queryStream(&queryString);
queryStream << "UPDATE 'Employees'"
<< " SET ONCLOCK = '0' where ID = '" << currentEmpId << "'";
qry->prepare(queryString);
if(!qry->exec())
{
QMessageBox::critical(this, tr("Error"), qry->lastError().text());
}
else
{}
conn.connClose();
}
this->setup();
}
示例5: fromString
void MusicTime::fromString(const QString &s, const QString &format)
{
QTime t;
t.fromString(s, format);
setHMSM(0, t.hour(), t.minute(), t.second(), t.msec());
}