这篇教程C++ startTimer函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中startTimer函数的典型用法代码示例。如果您正苦于以下问题:C++ startTimer函数的具体用法?C++ startTimer怎么用?C++ startTimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了startTimer函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: showEventvoid view::showEvent(QShowEvent *){ myTimerId=startTimer(200);}
开发者ID:fengyikil,项目名称:qt_from0,代码行数:4,
示例2: startTimervoid TabBarWidget::enterEvent(QEvent *event){ QTabBar::enterEvent(event); m_previewTimer = startTimer(250);}
开发者ID:Decme,项目名称:otter,代码行数:6,
示例3: startTimer void startTimer(bool up, int msec) { timerUp = up; startTimer(msec); }
开发者ID:BGmot,项目名称:Qt,代码行数:1,
示例4: startTimervoid Settings::propertyChanged(){ ++propertyChanges; if (timerId == 0) timerId = startTimer(500);}
开发者ID:rodrigogolive,项目名称:Bacon2D,代码行数:6,
示例5: KTMainWindow/* * This is the constructor for the main widget. It sets up the menu and the * TaskMan widget. */TopLevel::TopLevel(QWidget *parent, const char *name, int sfolder) : KTMainWindow(name){ /* * create main menu */ menubar = new MainMenu(this, "MainMenu"); connect(menubar, SIGNAL(quit()), this, SLOT(quitSlot())); // register the menu bar with KTMainWindow setMenu(menubar); statusbar = new KStatusBar(this, "statusbar"); statusbar->insertItem(i18n("88888 Processes"), 0); statusbar->insertItem(i18n("Memory: 888888 kB used, " "888888 kB free"), 1); statusbar->insertItem(i18n("Swap: 888888 kB used, " "888888 kB free"), 2); setStatusBar(statusbar); // call timerEvent to fill the status bar with real values timerEvent(0); assert(Kapp); setCaption(i18n("KDE Task Manager")); // create the tab dialog taskman = new TaskMan(this, "", sfolder); // register the tab dialog with KTMainWindow as client widget setView(taskman); connect(taskman, SIGNAL(enableRefreshMenu(bool)), menubar, SLOT(enableRefreshMenu(bool))); setMinimumSize(KTOP_MIN_W, KTOP_MIN_H); /* * Restore size of the dialog box that was used at end of last session. * Due to a bug in Qt we need to set the width to one more than the * defined min width. If this is not done the widget is not drawn * properly the first time. Subsequent redraws after resize are no problem. * * I need to implement some propper session management some day! */ QString t = Kapp->getConfig()->readEntry(QString("G_Toplevel")); if(!t.isNull()) { if (t.length() == 19) { int xpos, ypos, ww, wh; sscanf(t.data(), "%04d:%04d:%04d:%04d", &xpos, &ypos, &ww, &wh); setGeometry(xpos, ypos, ww <= KTOP_MIN_W ? KTOP_MIN_W + 1 : ww, wh <= KTOP_MIN_H ? KTOP_MIN_H : wh); } } readProperties(Kapp->getConfig()); timerID = startTimer(2000); // show the dialog box show(); // switch to the selected startup page taskman->raiseStartUpPage();}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:71,
示例6: startTimervoid CaretComponent::setCaretPosition (const Rectangle<int>& characterArea){ startTimer (380); setVisible (shouldBeShown()); setBounds (characterArea.withWidth (2));}
开发者ID:imekon,项目名称:SampleBrowser2,代码行数:6,
示例7: sortByPriorityvoid SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime){ SMILTime earliestFireTime = SMILTime::unresolved();#ifndef NDEBUG // This boolean will catch any attempts to schedule/unschedule scheduledAnimations during this critical section. // Similarly, any elements removed will unschedule themselves, so this will catch modification of animationsToApply. m_preventScheduledAnimationsChanges = true;#endif AnimationsVector animationsToApply; for (auto& it : m_scheduledAnimations) { AnimationsVector* scheduled = it.value.get(); // Sort according to priority. Elements with later begin time have higher priority. // In case of a tie, document order decides. // FIXME: This should also consider timing relationships between the elements. Dependents // have higher priority. sortByPriority(*scheduled, elapsed); SVGSMILElement* resultElement = 0; unsigned size = scheduled->size(); for (unsigned n = 0; n < size; n++) { SVGSMILElement* animation = scheduled->at(n); ASSERT(animation->timeContainer() == this); ASSERT(animation->targetElement()); ASSERT(animation->hasValidAttributeName()); // Results are accumulated to the first animation that animates and contributes to a particular element/attribute pair. if (!resultElement) { if (!animation->hasValidAttributeType()) continue; resultElement = animation; } // This will calculate the contribution from the animation and add it to the resultsElement. if (!animation->progress(elapsed, resultElement, seekToTime) && resultElement == animation) resultElement = 0; SMILTime nextFireTime = animation->nextProgressTime(); if (nextFireTime.isFinite()) earliestFireTime = std::min(nextFireTime, earliestFireTime); } if (resultElement) animationsToApply.append(resultElement); } unsigned animationsToApplySize = animationsToApply.size(); if (!animationsToApplySize) {#ifndef NDEBUG m_preventScheduledAnimationsChanges = false;#endif startTimer(earliestFireTime, animationFrameDelay); return; } // Apply results to target elements. for (unsigned i = 0; i < animationsToApplySize; ++i) animationsToApply[i]->applyResultsToTarget();#ifndef NDEBUG m_preventScheduledAnimationsChanges = false;#endif startTimer(earliestFireTime, animationFrameDelay);}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:67,
示例8: bump//Most important function of the whole program, it gets a strength variable as an input and based//on it bumps a ball in the air if it is laying still on the ground and is not bouncing or in the airvoid bump(struct SPHERE *sp, double strength) { //if ball not in Air compute it current new airtime SEC based on the strength value if(!sp->inAir&&strength>MAXSTRENGTH/10) { startTimer(sp); //start the timer //this is the main calculation, SEC is always higher for smaller balls than for //bigger balls with the same strength input, that is what the second term of the //function is for, the last term is the max air time and is calculated in sp->SEC=strength/MAXSTRENGTH*(1-(sp->r/(NUMSPHERES*2)))*NUMSEC; //change color of the ball slightly if(COLORCHANGE) { int choice=(int) (rand() % 3); int plusminus=(int) (rand() % 2); float change=(strength/MAXSTRENGTH)/10+0.02; if (plusminus==1) change=-change; sp->color[choice]+=(sp->color[choice]+change<1.0&&sp->color[choice]+change>0.0)?change:-change; } sp->firstUp=true; sp->inAir=true; } //stop the timer and compute seconds till the start of the timer stopTimer(sp); double seconds=timerSeconds(sp); //compute the speed based on the speedfactor and the number of spheres double speed=NUMSPHERES*SPEEDFACTOR; //let the ball fly up and down if(sp->SEC>0.05) { if(!BOUNCE) sp->inAir=true; //up-direction if(sp->up==true) { double max=4.905*sp->SEC*sp->SEC; sp->height=(max-4.905*(sp->SEC-seconds)*(sp->SEC-seconds))*speed; } //down-direction else { double max=4.905*sp->SEC*sp->SEC; sp->height=(max-4.905*seconds*seconds)*speed; } //if ball reaches the floor or is at the top of its flight turn the direction and //probably decrease the height for let the ball bounce if(seconds>sp->SEC) { sp->up=(sp->up==true)?false:true; startTimer(sp); if(sp->SEC>0&&sp->up==true) { sp->firstUp=false; sp->SEC-=(sp->SEC*4/9); if(!BOUNCE) sp->inAir=false; } } } //finished with bouncing or at the ground again and accepting input again else { sp->inAir=false; }}
开发者ID:rpmessner,项目名称:bouncingballs,代码行数:67,
示例9: mainint main(int argc, char **argv){l_int32 i, w, h, d, rotflag;PIX *pixs, *pixt, *pixd;l_float32 angle, deg2rad, pops, ang;char *filein, *fileout;static char mainName[] = "rotatetest1"; if (argc != 4) return ERROR_INT(" Syntax: rotatetest1 filein angle fileout", mainName, 1); filein = argv[1]; angle = atof(argv[2]); fileout = argv[3]; deg2rad = 3.1415926535 / 180.; lept_mkdir("lept/rotate"); if ((pixs = pixRead(filein)) == NULL) return ERROR_INT("pix not made", mainName, 1); if (pixGetDepth(pixs) == 1) { pixt = pixScaleToGray3(pixs); pixDestroy(&pixs); pixs = pixAddBorderGeneral(pixt, 1, 0, 1, 0, 255); pixDestroy(&pixt); } pixGetDimensions(pixs, &w, &h, &d); fprintf(stderr, "w = %d, h = %d/n", w, h);#if 0 /* repertory of rotation operations to choose from */ pixd = pixRotateAM(pixs, deg2rad * angle, L_BRING_IN_WHITE); pixd = pixRotateAMColor(pixs, deg2rad * angle, 0xffffff00); pixd = pixRotateAMColorFast(pixs, deg2rad * angle, 255); pixd = pixRotateAMCorner(pixs, deg2rad * angle, L_BRING_IN_WHITE); pixd = pixRotateShear(pixs, w /2, h / 2, deg2rad * angle, L_BRING_IN_WHITE); pixd = pixRotate3Shear(pixs, w /2, h / 2, deg2rad * angle, L_BRING_IN_WHITE); pixRotateShearIP(pixs, w / 2, h / 2, deg2rad * angle); pixd = pixs;#endif#if 0 /* timing of shear rotation */ for (i = 0; i < NITERS; i++) { pixd = pixRotateShear(pixs, (i * w) / NITERS, (i * h) / NITERS, deg2rad * angle, L_BRING_IN_WHITE); pixDisplay(pixd, 100 + 20 * i, 100 + 20 * i); pixDestroy(&pixd); }#endif#if 0 /* timing of in-place shear rotation */ for (i = 0; i < NITERS; i++) { pixRotateShearIP(pixs, w/2, h/2, deg2rad * angle, L_BRING_IN_WHITE);/* pixRotateShearCenterIP(pixs, deg2rad * angle, L_BRING_IN_WHITE); */ pixDisplay(pixs, 100 + 20 * i, 100 + 20 * i); } pixd = pixs; if (pixGetDepth(pixd) == 1) pixWrite(fileout, pixd, IFF_PNG); else pixWrite(fileout, pixd, IFF_JFIF_JPEG); pixDestroy(&pixs);#endif#if 0 /* timing of various rotation operations (choose) */ startTimer(); w = pixGetWidth(pixs); h = pixGetHeight(pixs); for (i = 0; i < NTIMES; i++) { pixd = pixRotateShearCenter(pixs, deg2rad * angle, L_BRING_IN_WHITE); pixDestroy(&pixd); } pops = (l_float32)(w * h * NTIMES / 1000000.) / stopTimer(); fprintf(stderr, "vers. 1, mpops: %f/n", pops); startTimer(); w = pixGetWidth(pixs); h = pixGetHeight(pixs); for (i = 0; i < NTIMES; i++) { pixRotateShearIP(pixs, w/2, h/2, deg2rad * angle, L_BRING_IN_WHITE); } pops = (l_float32)(w * h * NTIMES / 1000000.) / stopTimer(); fprintf(stderr, "shear, mpops: %f/n", pops); pixWrite(fileout, pixs, IFF_PNG); for (i = 0; i < NTIMES; i++) { pixRotateShearIP(pixs, w/2, h/2, -deg2rad * angle, L_BRING_IN_WHITE); } pixWrite("/usr/tmp/junkout", pixs, IFF_PNG);#endif#if 0 /* area-mapping rotation operations */ pixd = pixRotateAM(pixs, deg2rad * angle, L_BRING_IN_WHITE);//.........这里部分代码省略.........
开发者ID:MaTriXy,项目名称:tess-two,代码行数:101,
示例10: QObjectUBIdleTimer::UBIdleTimer(QObject *parent) : QObject(parent) , mCursorIsHidden(false){ startTimer(100);}
开发者ID:Vetal3000,项目名称:Sankore-3.1,代码行数:6,
示例11: troundpvoid TFrameHandle::setTimer(int frameRate) { m_previewFrameRate = frameRate; if (m_timerId != 0) killTimer(m_timerId); int interval = troundp(1000.0 / double(m_previewFrameRate)); m_timerId = startTimer(interval);}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:6,
示例12: startTimervoid CSceneWidget::start(){ // only one timer if(_timerId == 0) _timerId = startTimer(1000 / 25);}
开发者ID:slima4,项目名称:zgui-qt,代码行数:6,
示例13: startTimervoid Sender::run(){ QEventLoop loop; startTimer(2000); loop.exec();}
开发者ID:subbiahkalyan,项目名称:QTSamples,代码行数:6,
示例14: startTimervoid Plot::start(){ d_clock.start(); d_timerId = startTimer(10);}
开发者ID:BryanF1947,项目名称:GoldenCheetah,代码行数:5,
示例15: qKSDebug//.........这里部分代码省略......... // move all the way to the last position now if (scrollTimerId) { killTimer(scrollTimerId); scrollTimerId = 0; setScrollPositionHelper(q->scrollPosition() - overshootDist - motion); motion = QPoint(0, 0); } } } // If overshoot has been initiated with a finger down, // on release set max speed if (overshootDist.x()) { overshooting = bounceSteps; // Hack to stop a bounce in the finger down case velocity.setX(-overshootDist.x() * qreal(0.8)); } if (overshootDist.y()) { overshooting = bounceSteps; // Hack to stop a bounce in the finger down case velocity.setY(-overshootDist.y() * qreal(0.8)); } bool forceFast = true; // if widget was moving fast in the panning, increase speed even more if ((lastPressTime.elapsed() < FastClick) && ((qAbs(oldVelocity.x()) > minVelocity) || (qAbs(oldVelocity.y()) > minVelocity)) && ((qAbs(oldVelocity.x()) > MinimumAccelerationThreshold) || (qAbs(oldVelocity.y()) > MinimumAccelerationThreshold))) { qKSDebug() << "FAST CLICK - using oldVelocity " << oldVelocity; int signX = 0, signY = 0; if (velocity.x()) signX = (velocity.x() > 0) == (oldVelocity.x() > 0) ? 1 : -1; if (velocity.y()) signY = (velocity.y() > 0) == (oldVelocity.y() > 0) ? 1 : -1; // calculate the acceleration velocity QPoint maxPos = q->maximumScrollPosition(); accelerationVelocity = QPoint(0, 0); QSize size = q->viewportSize(); if (size.width()) accelerationVelocity.setX(qMin(int(q->maximumVelocity()), maxPos.x() / size.width() * AccelFactor)); if (size.height()) accelerationVelocity.setY(qMin(int(q->maximumVelocity()), maxPos.y() / size.height() * AccelFactor)); velocity.setX(signX * (oldVelocity.x() + (oldVelocity.x() > 0 ? accelerationVelocity.x() : -accelerationVelocity.x()))); velocity.setY(signY * (oldVelocity.y() + (oldVelocity.y() > 0 ? accelerationVelocity.y() : -accelerationVelocity.y()))); forceFast = false; } if ((qAbs(velocity.x()) >= minVelocity) || (qAbs(velocity.y()) >= minVelocity)) { qKSDebug() << "over min velocity: " << velocity; // we have to move because we are in overshooting position if (!moved) { // (opt) emit panningStarted() } // (must) enable scrollbars if (forceFast) { if ((qAbs(velocity.x()) > MaximumVelocityThreshold) && (accelerationVelocity.x() > MaximumVelocityThreshold)) { velocity.setX(velocity.x() > 0 ? accelerationVelocity.x() : -accelerationVelocity.x()); } if ((qAbs(velocity.y()) > MaximumVelocityThreshold) && (accelerationVelocity.y() > MaximumVelocityThreshold)) { velocity.setY(velocity.y() > 0 ? accelerationVelocity.y() : -accelerationVelocity.y()); } qKSDebug() << "Force fast is on - velocity: " << velocity; } changeState(QAbstractKineticScroller::AutoScrolling); } else { if (moved) { // (opt) emit panningFinished() } changeState(QAbstractKineticScroller::Inactive); } // -- create the idle timer if we are auto scrolling or overshooting. if (!idleTimerId && ((qAbs(velocity.x()) >= minVelocity) || (qAbs(velocity.y()) >= minVelocity) || overshootDist.x() || overshootDist.y()) ) { idleTimerId = startTimer(1000 / scrollsPerSecond); } lastTime.restart(); lastType = e->type(); bool wasMoved = moved; moved = false; qKSDebug("MR: end %d", wasMoved); return wasMoved; // do not swallow the mouse release, if we didn't move at all}
开发者ID:RS102839,项目名称:qt,代码行数:101,
示例16: QDialogCreateSnapshotDialog::CreateSnapshotDialog( QWidget *parent, QString domainName, QString _conName, bool _state, virConnectPtr *connPtrPtr) : QDialog(parent){ QString winTitle = QString("Create Snapshot of <%1> in [ %2 ] connection") .arg(domainName).arg(_conName); setWindowTitle(winTitle); settings.beginGroup("CreateSnapshotDialog"); restoreGeometry( settings.value("Geometry").toByteArray() ); settings.endGroup(); titleLayout = new QHBoxLayout(this); nameLabel = new QLabel("Name:", this); name = new QLineEdit(this); name->setPlaceholderText("generate if omit"); name->setMinimumWidth(100); addTimeSuff = new QCheckBox(this); addTimeSuff->setToolTip("Add Time to Snapshot Name"); timeLabel = new QLabel(this); QString _date(QTime::currentTime().toString()); _date.append("-"); _date.append(QDate::currentDate().toString("dd.MM.yyyy")); timeLabel->setText(_date); timeLabel->setEnabled(false); titleLayout->addWidget(nameLabel); titleLayout->addWidget(name); titleLayout->addWidget(addTimeSuff); titleLayout->addWidget(timeLabel); titleWdg = new QWidget(this); titleWdg->setLayout(titleLayout); description = new QLineEdit(this); description->setPlaceholderText("Short Description"); snapshotType = new QComboBox(this); snapshotType->addItems(SNAPSHOT_TYPES); flagsMenu = new CreateSnapshotFlags(this); flags = new QPushButton(QIcon::fromTheme("flag"), "", this); flags->setMenu(flagsMenu); flags->setMaximumWidth(flags->sizeHint().width()); flags->setToolTip("Creation Snapshot Flags"); // because first item is non-actual there flags->setEnabled(false); typeLayout = new QHBoxLayout(this); typeLayout->addWidget(snapshotType); typeLayout->addWidget(flags); typeWdg = new QWidget(this); typeWdg->setLayout(typeLayout); baseWdg = new QStackedWidget(this); baseWdg->addWidget(new MemStateSnapshot(this, _state)); baseWdg->addWidget(new DiskSnapshot(this, _state, false)); baseWdg->addWidget(new DiskSnapshot(this, _state, true)); baseWdg->addWidget(new SystemCheckpoint(this, _state, false)); baseWdg->addWidget(new SystemCheckpoint(this, _state, true)); info = new QLabel("<a href='https://libvirt.org/formatsnapshot.html'>About</a>", this); info->setOpenExternalLinks(true); info->setToolTip("https://libvirt.org/formatsnapshot.html"); ok = new QPushButton("Ok", this); // because first item is non-actual there ok->setEnabled(false); cancel = new QPushButton("Cancel", this); buttonsLayout = new QHBoxLayout(this); buttonsLayout->addWidget(info); buttonsLayout->addWidget(ok); buttonsLayout->addWidget(cancel); buttonsWdg = new QWidget(this); buttonsWdg->setLayout(buttonsLayout); commonLayout = new QVBoxLayout(this); commonLayout->addWidget(titleWdg); commonLayout->addWidget(description); commonLayout->addWidget(typeWdg); commonLayout->addWidget(baseWdg); commonLayout->addWidget(buttonsWdg); //commonLayout->addStretch(-1); setLayout(commonLayout); connect(snapshotType, SIGNAL(currentIndexChanged(int)), baseWdg, SLOT(setCurrentIndex(int))); connect(snapshotType, SIGNAL(currentIndexChanged(int)), this, SLOT(snapshotTypeChange(int))); connect(ok, SIGNAL(clicked()), this, SLOT(accept())); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); connect(addTimeSuff, SIGNAL(toggled(bool)), timeLabel, SLOT(setEnabled(bool))); for (int i=0; i<baseWdg->count(); i++) { _SnapshotStuff *wdg = static_cast<_SnapshotStuff*>( baseWdg->widget(i)); if ( nullptr!=wdg ) wdg->setParameters(connPtrPtr, domainName); connect(wdg, SIGNAL(errMsg(QString&)), this, SIGNAL(errMsg(QString&))); }; timerID = startTimer(1000);}
开发者ID:cheliequan,项目名称:qt-virt-manager,代码行数:93,
示例17: Point2dvoid testApp::update() { kinect.update(); if(!panel.getValueB("pause") && kinect.isFrameNew()) { zCutoff = panel.getValueF("zCutoff"); float fovWidth = panel.getValueF("fovWidth"); float fovHeight = panel.getValueF("fovHeight"); int left = Xres * (1 - fovWidth) / 2; int top = Yres * (1 - fovHeight) / 2; int right = left + Xres * fovWidth; int bottom = top + Yres * fovHeight; roiStart = Point2d(left, top); roiEnd = Point2d(right, bottom); ofVec3f nw = ConvertProjectiveToRealWorld(roiStart.x, roiStart.y, zCutoff); ofVec3f se = ConvertProjectiveToRealWorld(roiEnd.x - 1, roiEnd.y - 1, zCutoff); float width = (se - nw).x; float height = (se - nw).y; globalScale = panel.getValueF("stlSize") / MAX(width, height); backOffset = panel.getValueF("backOffset") / globalScale; cutoffKinect(); if(panel.getValueB("useSmoothing")) { smoothKinect(); } if(panel.getValueB("useWatermark")) { startTimer(); injectWatermark(); injectWatermarkTime = stopTimer(); } startTimer(); updateSurface(); updateSurfaceTime = stopTimer(); bool exportStl = panel.getValueB("exportStl"); bool useRandomExport = panel.getValueB("useRandomExport"); startTimer(); if((exportStl && useRandomExport) || panel.getValueB("useRandom")) { updateTrianglesRandom(); } else if(panel.getValueB("useSimplify")) { updateTrianglesSimplify(); } else { updateTriangles(); } calculateNormals(triangles, normals); updateTrianglesTime = stopTimer(); startTimer(); updateBack(); updateBackTime = stopTimer(); startTimer(); postProcess(); postProcessTime = stopTimer(); if(exportStl) { string pocoTime = Poco::DateTimeFormatter::format(Poco::LocalDateTime(), "%Y-%m-%d at %H.%M.%S"); ofxSTLExporter exporter; exporter.beginModel("Kinect Export"); addTriangles(exporter, triangles, normals); addTriangles(exporter, backTriangles, backNormals); exporter.saveModel("Kinect Export " + pocoTime + ".stl"); #ifdef USE_REPLICATORG if(printer.isConnected()) { printer.printToFile("/home/matt/MakerBot/repg_workspace/ReplicatorG/examples/Snake.stl", "/home/matt/Desktop/snake.s3g"); }#endif panel.setValueB("exportStl", false); } } float diffuse = panel.getValueF("diffuseAmount"); redLight.setDiffuseColor(ofColor(diffuse / 2, diffuse / 2, 0)); greenLight.setDiffuseColor(ofColor(0, diffuse / 2, diffuse / 2)); blueLight.setDiffuseColor(ofColor(diffuse / 2, 0, diffuse / 2)); float ambient = 255 - diffuse; redLight.setAmbientColor(ofColor(ambient / 2, ambient / 2, 0)); greenLight.setAmbientColor(ofColor(0, ambient / 2, ambient / 2)); blueLight.setAmbientColor(ofColor(ambient / 2, 0, ambient / 2)); float lightY = ofGetHeight() / 2 + panel.getValueF("lightY"); float lightZ = panel.getValueF("lightZ"); float lightDistance = panel.getValueF("lightDistance"); float lightRotation = panel.getValueF("lightRotation"); redLight.setPosition(ofGetWidth() / 2 + cos(lightRotation + 0 * TWO_PI / 3) * lightDistance, lightY + sin(lightRotation + 0 * TWO_PI / 3) * lightDistance, lightZ); greenLight.setPosition(ofGetWidth() / 2 + cos(lightRotation + 1 * TWO_PI / 3) * lightDistance, lightY + sin(lightRotation + 1 * TWO_PI / 3) * lightDistance, lightZ); blueLight.setPosition(ofGetWidth() / 2 + cos(lightRotation + 2 * TWO_PI / 3) * lightDistance,//.........这里部分代码省略.........
开发者ID:4dkorea,项目名称:Makerbot,代码行数:101,
示例18: QWidget//.........这里部分代码省略......... pub_psm_control_mode_ = nh_.advertise<std_msgs::Int8>("/dvrk_psm/control_mode", 100); pub_enable_slider_ = nh_.advertise<sensor_msgs::JointState>("/dvrk_mtm/joint_state_publisher/enable_slider", 100); // pose display mtm_pose_qt_ = new vctQtWidgetFrame4x4DoubleRead; psm_pose_qt_ = new vctQtWidgetFrame4x4DoubleRead; QVBoxLayout *poseLayout = new QVBoxLayout; poseLayout->addWidget(mtm_pose_qt_); poseLayout->addWidget(psm_pose_qt_); // common console QGroupBox *consoleBox = new QGroupBox("Console"); QPushButton *consoleHomeButton = new QPushButton(tr("Home")); QPushButton *consoleManualButton = new QPushButton(tr("Manual")); QPushButton *consoleTeleopTestButton = new QPushButton(tr("TeleopTest")); consoleTeleopButton = new QPushButton(tr("Teleop")); consoleHomeButton->setStyleSheet("font: bold; color: green;"); consoleManualButton->setStyleSheet("font: bold; color: red;"); consoleTeleopTestButton->setStyleSheet("font: bold; color: blue;"); consoleTeleopButton->setStyleSheet("font: bold; color: brown;"); consoleHomeButton->setCheckable(true); consoleManualButton->setCheckable(true); consoleTeleopTestButton->setCheckable(true); consoleTeleopButton->setCheckable(true); QButtonGroup *consoleButtonGroup = new QButtonGroup; consoleButtonGroup->setExclusive(true); consoleButtonGroup->addButton(consoleHomeButton); consoleButtonGroup->addButton(consoleManualButton); consoleButtonGroup->addButton(consoleTeleopTestButton); consoleButtonGroup->addButton(consoleTeleopButton); QHBoxLayout *consoleBoxLayout = new QHBoxLayout; consoleBoxLayout->addWidget(consoleHomeButton); consoleBoxLayout->addWidget(consoleManualButton); consoleBoxLayout->addWidget(consoleTeleopTestButton); consoleBoxLayout->addWidget(consoleTeleopButton); consoleBoxLayout->addStretch(); consoleBox->setLayout(consoleBoxLayout); // mtm console mtmBox = new QGroupBox("MTM"); QVBoxLayout *mtmBoxLayout = new QVBoxLayout; mtmClutchButton = new QPushButton(tr("Clutch")); mtmClutchButton->setCheckable(true); mtmBoxLayout->addWidget(mtmClutchButton); mtmHeadButton = new QPushButton(tr("Head")); mtmHeadButton->setCheckable(true); mtmBoxLayout->addWidget(mtmHeadButton); mtmBoxLayout->addStretch(); mtmBox->setLayout(mtmBoxLayout); // psm console psmBox = new QGroupBox("PSM"); QVBoxLayout *psmBoxLayout = new QVBoxLayout; psmMoveButton = new QPushButton(tr("Move Tool")); psmMoveButton->setCheckable(true); psmBoxLayout->addWidget(psmMoveButton); psmBoxLayout->addStretch(); psmBox->setLayout(psmBoxLayout); // rightLayout QGridLayout *rightLayout = new QGridLayout; rightLayout->addWidget(consoleBox, 0, 0, 1, 2); rightLayout->addWidget(mtmBox, 1, 0); rightLayout->addWidget(psmBox, 1, 1); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addLayout(poseLayout); mainLayout->addLayout(rightLayout); this->setLayout(mainLayout); this->resize(sizeHint()); this->setWindowTitle("Teleopo GUI"); // set stylesheet std::string filename = ros::package::getPath("dvrk_teleop"); filename.append("/src/default.css"); QFile defaultStyleFile(filename.c_str()); defaultStyleFile.open(QFile::ReadOnly); QString styleSheet = QLatin1String(defaultStyleFile.readAll()); this->setStyleSheet(styleSheet); // now connect everything connect(consoleHomeButton, SIGNAL(clicked()), this, SLOT(slot_homeButton_pressed())); connect(consoleManualButton, SIGNAL(clicked()), this, SLOT(slot_manualButton_pressed())); connect(consoleTeleopTestButton, SIGNAL(clicked()), this, SLOT(slot_teleopTestButton_pressed())); connect(consoleTeleopButton, SIGNAL(toggled(bool)), this, SLOT(slot_teleopButton_toggled(bool))); connect(mtmHeadButton, SIGNAL(clicked(bool)), this, SLOT(slot_headButton_pressed(bool))); connect(mtmClutchButton, SIGNAL(clicked(bool)), this, SLOT(slot_clutchButton_pressed(bool))); connect(psmMoveButton, SIGNAL(clicked(bool)), this, SLOT(slot_moveToolButton_pressed(bool))); // show widget & start timer startTimer(period); // 50 ms slot_teleopButton_toggled(false);}
开发者ID:adithyamurali,项目名称:dvrk-ros,代码行数:101,
示例19: METH/* Time are expressed in us */t_uint32 METH(startHighPrecisionTimer)(t_uint32 fisrtAlarm, t_uint32 period) { return startTimer(fisrtAlarm, period);}
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:4,
示例20: startTimervoid SMILTimeContainer::notifyIntervalsChanged(){ // Schedule updateAnimations() to be called asynchronously so multiple intervals // can change with updateAnimations() only called once at the end. startTimer(0);}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:6,
示例21: clearDisplayStatsData::DisplayStatsData(){ clear(); m_timer = startTimer(STAT_TIMER_INTERVAL * 1000);}
开发者ID:robotage,项目名称:SyntroApps,代码行数:5,
示例22: mainint main(int argc, char **argv) { int np, rank; int size = atoi(argv[1]); int matrix[size][size]; //[wiersz][kolumna] int vector[size]; int result[size]; MPI_Init(&argc, &argv); MPI_Status status; MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &np); int partition = size / np; int subresult[partition]; int submatrix[size*partition]; pTimer T = newTimer(); //deklaruje czas T double gotowe_time; //zmienna pod która bed C++ startTransaction函数代码示例 C++ startTime函数代码示例
|