本文整理汇总了C++中QDate::shortMonthName方法的典型用法代码示例。如果您正苦于以下问题:C++ QDate::shortMonthName方法的具体用法?C++ QDate::shortMonthName怎么用?C++ QDate::shortMonthName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDate
的用法示例。
在下文中一共展示了QDate::shortMonthName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: answerReceived
void LogSensor::answerReceived( int id, const QList<QByteArray>& answer ) //virtual
{
QFile mLogFile( mFileName );
if ( !mLogFile.open( QIODevice::ReadWrite | QIODevice::Append ) ) {
stopLogging();
return;
}
switch ( id ) {
case 42: {
QTextStream stream( &mLogFile );
double value = 0;
if ( !answer.isEmpty() )
value = answer[ 0 ].toDouble();
if ( mLowerLimitActive && value < mLowerLimit ) {
timerOff();
mLimitReached = true;
// send notification
KNotification::event( "sensor_alarm", QString( "sensor '%1' at '%2' reached lower limit" )
.arg( mSensorName ).arg( mHostName), QPixmap(), 0 );
timerOn();
} else if ( mUpperLimitActive && value > mUpperLimit ) {
timerOff();
mLimitReached = true;
// send notification
KNotification::event( "sensor_alarm", QString( "sensor '%1' at '%2' reached upper limit" )
.arg( mSensorName).arg( mHostName), QPixmap(), 0 );
timerOn();
} else {
mLimitReached = false;
}
const QDate date = QDateTime::currentDateTime().date();
const QTime time = QDateTime::currentDateTime().time();
stream << QString( "%1 %2 %3 %4 %5: %6\n" ).arg( date.shortMonthName( date.month() ) )
.arg( date.day() ).arg( time.toString() )
.arg( mHostName).arg( mSensorName ).arg( value );
}
}
emit changed();
mLogFile.close();
}