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


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

本文整理汇总了C++中QTime::msec方法的典型用法代码示例。如果您正苦于以下问题:C++ QTime::msec方法的具体用法?C++ QTime::msec怎么用?C++ QTime::msec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTime的用法示例。


在下文中一共展示了QTime::msec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setInterval

void Timelapse::setInterval(const QTime &time){
    intervalTime->setHMS(time.hour(),time.minute(),time.second(),time.msec());
    realinterval = interval = time.second()*1000+time.msec();
    LOG_TIMELAPSE_DEBUG << "Timelapse setInterval: " << time.second()  << time.msec() << interval;

    timer->setInterval(timerresolution);
}
开发者ID:klangobjekte,项目名称:CameraRemote,代码行数:7,代码来源:timelapse.cpp

示例2: GetElapsedMSecs

long GetElapsedMSecs(const QTime &startTime, const QTime &endTime)
{
	int eHours = endTime.hour() - startTime.hour();
	int eMinutes = endTime.minute() - startTime.minute();
	int eSecs = endTime.second() - startTime.second();
	int eMSecs = endTime.msec() - startTime.msec();
	return eHours*60*60*1000 + eMinutes*60*1000 + eSecs*1000 + eMSecs;
}
开发者ID:dalinhuang,项目名称:networkprogram,代码行数:8,代码来源:commandchannel.cpp

示例3: setFrameTime

void TTCurrentFrameInfo::setFrameTime( QTime time_1, QTime time_2 )
{
  QString str_time;

  str_time.sprintf("%s,%d / %s,%d",time_1.toString().ascii(), time_1.msec(),
		   time_2.toString().ascii(), time_2.msec() );
  leFrameTime->setText( str_time );

}
开发者ID:BackupTheBerlios,项目名称:ttcut-svn,代码行数:9,代码来源:ttmpeg2mainwnd.cpp

示例4: re

QTime operator+(QTime l,QTime r)
{
	int h=l.hour()+r.hour(),m=l.minute()+r.minute(),s=l.second()+r.second(),ms=l.msec()+r.msec();
	if (ms>=1000) {ms=ms-1000;s++;}
	if (s>=60) {s-=60;m++;}
	if (m>=60) {m-=60;h++;}
        if (h>=24) {h-=24;}
	QTime re(h,m,s,ms);
	
	return re;
}
开发者ID:AlphaPixel,项目名称:3DNature,代码行数:11,代码来源:workitem.cpp

示例5: QWidget

Board::Board(QWidget *parent, IGame * _activeGame) : QWidget(parent)
{
	activeGame = _activeGame;

	QTime time = QTime::currentTime();
	srand((uint)time.msec());
	qsrand((uint)time.msec());

	this->resize(500, 500);
	setMouseTracking(true);
}
开发者ID:houpcz,项目名称:DDA,代码行数:11,代码来源:Board.cpp

示例6: while

QString Soprano::DateTime::toString( const QTime& t )
{
    QString frac;
    if( t.msec() > 0 ) {
        frac.sprintf( ".%03d", t.msec() );
        // remove trailing zeros
        while( frac.endsWith( '0' ) )
            frac.truncate( frac.length() -1 );
    }

    return t.toString( "HH:mm:ss" ) + frac;
}
开发者ID:dudochkin-victor,项目名称:libqttracker,代码行数:12,代码来源:datetime.cpp

示例7: updateLog

//Обновление консоли оповещени в GUI о начале и конце копиляции, её времени
void Compiler::updateLog(QTime &startTime)
{
  QTime endTime = QTime::currentTime();
  if(out) {
    out->clear();
    QString secnd = QString::number(abs(endTime.second() - startTime.second()));
    QString min   = QString::number(abs(endTime.minute() - startTime.minute()));
    QString msecnd = QString::number(abs(endTime.msec() - startTime.msec()));
    QString outPutMsg = "Компиляция прошла успешно время: " +
        formatTime(min, 2) + ":" +
        formatTime(secnd, 2) + ':' +
        formatTime(msecnd, 3) ;
    mBar->setValue(mBar->maximum());
    out->append(outPutMsg);
  }
}
开发者ID:Buvaluy,项目名称:VirtualMachine,代码行数:17,代码来源:compiler.cpp

示例8: QThread

Operator::Operator(QObject *parent, Runner *runner, int id) :
    QThread(parent), runner(runner), id(id),
    tools(0), m1(0), m2(0), product(0), take_tool_attemp(0)
{
    QTime time = QTime::currentTime();
    srand((uint)time.msec() + id);
}
开发者ID:xhacker,项目名称:CMPT-300-HW2,代码行数:7,代码来源:operator.cpp

示例9: qrand

QList<int> MainScreen::randomizeBuyers()
{
	QList<int> order;
	for(int i = 0; i < m_participants.size(); ++i)
	{
		order.append(i);
	}

	unsigned int size = m_participants.size();
	unsigned int i = 0;
	// seed the random number generator with the current time
	QTime time = QTime::currentTime();
	qsrand((uint)time.msec());

	// Use Fisher-Yates to randomly swap indexes
	while(i < size)
	{
		int index = qrand();
		index = index % size;
		int temp = order[index];
		order[index] = order[i];
		order[i] = temp;
		++i;
	}
	return order;
}
开发者ID:eghantous82,项目名称:OOH,代码行数:26,代码来源:MainScreen.cpp

示例10: mythCurrentDateTime

/** \fn mythCurrentDateTime()
 *  \brief Returns the current QDateTime object, stripped of its msec component
 */
QDateTime mythCurrentDateTime()
{
    QDateTime rettime = QDateTime::currentDateTime();
    QTime orig = rettime.time();
    rettime.setTime(orig.addMSecs(-orig.msec()));
    return rettime;
}
开发者ID:microe,项目名称:mythtv,代码行数:10,代码来源:util.cpp

示例11: QDialog

NewGraphDialog::NewGraphDialog(DBCHandler *handler, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NewGraphDialog)
{
    ui->setupUi(this);

    dbcHandler = handler;

    connect(ui->colorSwatch, SIGNAL(clicked(bool)), this, SLOT(colorSwatchClick()));
    connect(ui->btnAddGraph, SIGNAL(clicked(bool)), this, SLOT(addButtonClicked()));

    // Seed the random generator with current time
    QTime time = QTime::currentTime();
    qsrand((uint)time.msec());

    QPalette p = ui->colorSwatch->palette();
    //using 160 instead of 255 so that colors are always at least a little dark
    p.setColor(QPalette::Button, QColor(qrand() % 160,qrand() % 160,qrand() % 160));
    ui->colorSwatch->setPalette(p);

    connect(ui->cbMessages, SIGNAL(currentIndexChanged(int)), this, SLOT(loadSignals(int)));
    connect(ui->cbSignals, SIGNAL(currentIndexChanged(int)), this, SLOT(fillFormFromSignal(int)));

    loadMessages();
}
开发者ID:klasrocket,项目名称:SavvyCAN,代码行数:25,代码来源:newgraphdialog.cpp

示例12: QDateTimeToDATE

static DATE QDateTimeToDATE(const QDateTime &dt)
{
    if (!dt.isValid() || dt.isNull())
        return 949998;
    
    SYSTEMTIME stime;
    memset(&stime, 0, sizeof(stime));
    QDate date = dt.date();
    QTime time = dt.time();
    if (date.isValid() && !date.isNull()) {
        stime.wDay = date.day();
        stime.wMonth = date.month();
        stime.wYear = date.year();
    }
    if (time.isValid() && !time.isNull()) {
        stime.wMilliseconds = time.msec();
        stime.wSecond = time.second();
        stime.wMinute = time.minute();
        stime.wHour = time.hour();
    }
    
    double vtime;
    SystemTimeToVariantTime(&stime, &vtime);
    
    return vtime;
}
开发者ID:stephaneAG,项目名称:PengPod700,代码行数:26,代码来源:qaxtypes.cpp

示例13: QDialog

gamewidget::gamewidget(QWidget *parent) :
    QDialog(parent)
{
    //background
    this->setAutoFillBackground(true);
    this->resize(391,220);
    this->setWindowTitle("snack");
    QPalette  palette;
    palette.setBrush(QPalette::Background,QBrush(QPixmap(":/new/prefix1/img/green.jpg")));
    this->setPalette(palette);
    //button
    left_button = new QPushButton("Left",this);
    left_button->setGeometry(QRect(260,70,40,30));
    right_button = new QPushButton("Right",this);
    right_button->setGeometry(QRect(340,70,40,30));
    up_button = new QPushButton("Up",this);
    up_button->setGeometry(QRect(300,40,40,30));
    down_button = new QPushButton("Down",this);
    down_button->setGeometry(QRect(300,70,40,30));
    start_button = new QPushButton("Start",this);
    start_button->setGeometry(270,120,50,30);
    return_button = new QPushButton("Return",this);
    return_button->setGeometry(330,120,50,30);
    //signal and slot
    connect(left_button,SIGNAL(clicked()),this,SLOT(left_click()));
    connect(right_button,SIGNAL(clicked()),this,SLOT(right_click()));
    connect(up_button,SIGNAL(clicked()),this,SLOT(up_click()));
    connect(down_button,SIGNAL(clicked()),this,SLOT(down_click()));
    connect(start_button,SIGNAL(clicked()),this,SLOT(start_click()));
    connect(return_button,SIGNAL(clicked()),this,SLOT(return_click()));
    //key singnal
    connect(this,SIGNAL(UpSignal()),this,SLOT(up_click()));
    connect(this,SIGNAL(DownSignal()),this,SLOT(down_click()));
    connect(this,SIGNAL(LeftSignal()),left_button,SLOT(click()));
    connect(this,SIGNAL(RightSignal()),right_button,SLOT(click()));
    //auto update
    timer = new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(timeoutslot()));
    //rand seed
    QTime t;
    t= QTime::currentTime();
    qsrand(t.msec()+t.second()*1000);
    //head
    snake[0][0] = qrand()%ROW;
    snake[0][1] = qrand()%COL;
    //data init
    foodcount = 0;
    suicide = false;
    thesame = false;
    speed = 300;
    sound_eat = new QSound(":/sounds/eating.wav",this);
    sound_die = new QSound(":/sounds/gameover.wav",this);
    foodx = qrand()%ROW;
    foody = qrand()%COL;
    while (foodx==snake[0][0]&&foody==snake[0][1]) {
        foodx = qrand()%ROW;
        foody = qrand()%COL;
    }
    directioin = qrand()%4;
}
开发者ID:TryUseGit,项目名称:C-code,代码行数:60,代码来源:gamewidget.cpp

示例14: blue

WaveChart::WaveChart(QChart* chart, QWidget* parent) :
    QChartView(chart, parent),
    m_series(new QLineSeries()),
    m_wave(0),
    m_step(2 * PI / numPoints)
{
    QPen blue(Qt::blue);
    blue.setWidth(3);
    m_series->setPen(blue);

    QTime now = QTime::currentTime();
    qsrand((uint) now.msec());

    int fluctuate = 100;

    for (qreal x = 0; x <= 2 * PI; x += m_step) {
        m_series->append(x, fabs(sin(x) * fluctuate));
    }

    chart->addSeries(m_series);

    QObject::connect(&m_timer, SIGNAL(timeout()), this, SLOT(update()));
    m_timer.setInterval(5000);
    m_timer.start();

}
开发者ID:wangyun123,项目名称:Third,代码行数:26,代码来源:wavechart.cpp

示例15: screenShot

void Tohkbd::screenShot()
{
    QDate ssDate = QDate::currentDate();
    QTime ssTime = QTime::currentTime();

    ssFilename = QString("%8/ss%1%2%3-%4%5%6-%7.png")
                    .arg((int) ssDate.day(),    2, 10, QLatin1Char('0'))
                    .arg((int) ssDate.month(),  2, 10, QLatin1Char('0'))
                    .arg((int) ssDate.year(),   2, 10, QLatin1Char('0'))
                    .arg((int) ssTime.hour(),   2, 10, QLatin1Char('0'))
                    .arg((int) ssTime.minute(), 2, 10, QLatin1Char('0'))
                    .arg((int) ssTime.second(), 2, 10, QLatin1Char('0'))
                    .arg((int) ssTime.msec(),   3, 10, QLatin1Char('0'))
                    .arg("/home/nemo/Pictures");


    QDBusMessage m = QDBusMessage::createMethodCall("org.nemomobile.lipstick",
                                                    "/org/nemomobile/lipstick/screenshot",
                                                    "",
                                                    "saveScreenshot" );

    QList<QVariant> args;
    args.append(ssFilename);
    m.setArguments(args);

    if (QDBusConnection::sessionBus().send(m))
        printf("Screenshot success to %s\n", qPrintable(ssFilename));
    else
        printf("Screenshot failed\n");

    notificationSend("Screenshot saved", ssFilename);
}
开发者ID:ljo,项目名称:tohkbd2,代码行数:32,代码来源:tohkeyboard.cpp


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