当前位置: 首页>>代码示例>>C++>>正文


C++ QTime::fromString方法代码示例

本文整理汇总了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;
}
开发者ID:mjoppich,项目名称:ACARSv4.0,代码行数:8,代码来源:ACARSAirport.cpp

示例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;
}
开发者ID:kartagis,项目名称:KVIrc,代码行数:14,代码来源:KvsObject_dateTimeEdit.cpp

示例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");
}
开发者ID:ALeschev,项目名称:tunel,代码行数:18,代码来源:timekeeper.cpp

示例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();
}
开发者ID:anava014,项目名称:AvisionR---Windows-GUI-Application,代码行数:74,代码来源:usermanagement.cpp

示例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());
}
开发者ID:chenpusn,项目名称:Musicplayer,代码行数:6,代码来源:musictime.cpp


注:本文中的QTime::fromString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。