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


C++ QDateTime::currentMSecsSinceEpoch方法代码示例

本文整理汇总了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);
}
开发者ID:azrilrahim,项目名称:TodakServer,代码行数:16,代码来源:clienthandler.cpp

示例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);
    }
}
开发者ID:qt-labs,项目名称:talk-schedule,代码行数:19,代码来源:sortfiltermodel.cpp

示例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 ();
}
开发者ID:chenhuang511,项目名称:nitrokey-app,代码行数:101,代码来源:main.cpp


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