本文整理汇总了C++中QDateTime::currentMSecsSinceEpoch方法的典型用法代码示例。如果您正苦于以下问题:C++ QDateTime::currentMSecsSinceEpoch方法的具体用法?C++ QDateTime::currentMSecsSinceEpoch怎么用?C++ QDateTime::currentMSecsSinceEpoch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTime
的用法示例。
在下文中一共展示了QDateTime::currentMSecsSinceEpoch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTmpRandomFileName
QString clientHandler::getTmpRandomFileName()
{
//get new primary is pseudo generate algo for creating DB primary
//key based DDMMYYHHMMSS. This is to replace DB default auto increment
//that will lead inconsistantcy during data update, append, migration
//and rollback
QDateTime now;
QString utc;
quint64 primaryKey = 0;
utc = now.currentDateTimeUtc().toString();
utc.remove(QRegExp("[^0-9]"));
primaryKey = utc.toLongLong() + now.currentMSecsSinceEpoch();
return QString::number(primaryKey);
}
示例2: filterAcceptsRow
bool SortFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
if (filterRole() == "fromNow" && sourceModel()->roleNames().values().contains("start")) {
QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
QDateTime date = sourceModel()->data(index, sourceModel()->roleNames().key("start")).toDateTime();
QDateTime currentDateTime = QDateTime::currentDateTime();
int localTimeZoneOffset = currentDateTime.offsetFromUtc();
currentDateTime.setMSecsSinceEpoch(currentDateTime.currentMSecsSinceEpoch() + localTimeZoneOffset*1000);
return date >= currentDateTime;
} else {
if (m_hide && sourceModel()->roleNames().values().contains("hideInSchedule")) {
QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
bool willBeHidden = sourceModel()->data(index, sourceModel()->roleNames().key("hideInSchedule")).toBool();
if (willBeHidden)
return false;
}
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
}
}
示例3: main
//.........这里部分代码省略.........
if (lang != "en") {
bool success;
success = myappTranslator.load(QLocale::system(), // locale
"", // file name
"nitrokey_", // prefix
":/i18n/", // folder
".qm"); // suffix
if (!success) {
myappTranslator.load(QString(":/i18n/nitrokey_%1.qm").arg(QLocale::system().name()));
}
}
#else
myappTranslator.load(QString(":/i18n/nitrokey_%1.qm").arg(QLocale::system().name()));
#endif
a.installTranslator(&myappTranslator);
// Check for multiple instances
// GUID from http://www.guidgenerator.com/online-guid-generator.aspx
/*
QSharedMemory shared("6b50960df-f5f3-4562-bbdc-84c3bc004ef4");
if( !shared.create( 512, QSharedMemory::ReadWrite) ) { // An instance is already running. Quit the current instance QMessageBox msgBox;
msgBox.setText( QObject::tr("Can't start more than one instance of the application.") ); msgBox.setIcon( QMessageBox::Critical );
msgBox.exec(); exit(0); } else { */
qDebug () << "Application started successfully.";
// }
/*
SplashScreen *splash = 0; splash = new SplashScreen; splash->show();
QFile qss( ":/qss/default.qss" ); if( ! qss.open( QIODevice::ReadOnly ) ) { qss.setFileName( ":/qss/default.qss" ); qss.open(
QIODevice::ReadOnly ); }
if( qss.isOpen() ) { a.setStyleSheet( qss.readAll() ); }
QTimer::singleShot(3000,splash,SLOT(deleteLater())); */
StartupInfo_st.ExtendedConfigActive = FALSE;
StartupInfo_st.FlagDebug = DEBUG_STATUS_NO_DEBUGGING;
StartupInfo_st.PasswordMatrix = FALSE;
StartupInfo_st.LockHardware = FALSE;
StartupInfo_st.Cmd = FALSE;
HID_Stick20Init ();
// Check for commandline parameter
for (i = 2; i <= argc; i++)
{
p = argv[i - 1];
if ((0 == strcmp (p, "--help")) || (0 == strcmp (p, "-h")))
{
HelpInfos ();
exit (0);
}
if ((0 == strcmp (p, "--debug")) || (0 == strcmp (p, "-d")))
{
StartupInfo_st.FlagDebug = DEBUG_STATUS_LOCAL_DEBUG;
}
if (0 == strcmp (p, "--debugAll"))
{
StartupInfo_st.FlagDebug = DEBUG_STATUS_DEBUG_ALL;
}
if ((0 == strcmp (p, "--admin")) || (0 == strcmp (p, "-a")))
{
StartupInfo_st.ExtendedConfigActive = TRUE;
}
/* Disable password matrix if (0 == strcmp (p,"--PWM")) { StartupInfo_st.PasswordMatrix = TRUE; } */
if (0 == strcmp (p, "--lock-hardware"))
StartupInfo_st.LockHardware = TRUE;
if (0 == strcmp (p, "--cmd"))
{
StartupInfo_st.Cmd = TRUE;
i++;
if (i > argc)
{
fprintf (stderr, "ERROR: Can't get command\n");
fflush (stderr);
exit (1);
}
else
{
p = argv[i - 1];
StartupInfo_st.CmdLine = p;
}
}
}
MainWindow w (&StartupInfo_st);
QDateTime local (QDateTime::currentDateTime ());
qsrand (local.currentMSecsSinceEpoch () % 2000000000);
a.setQuitOnLastWindowClosed (false);
return a.exec ();
}