本文整理汇总了C++中setInterval函数的典型用法代码示例。如果您正苦于以下问题:C++ setInterval函数的具体用法?C++ setInterval怎么用?C++ setInterval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setInterval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpectrogramData
SpectrogramData()
{
// setInterval( Qt::XAxis, QwtInterval( -1.5, 1.5 ) );
setInterval( Qt::XAxis, QwtInterval( -1.5, 1.5 ) );
setInterval( Qt::YAxis, QwtInterval( -1.5, 1.5 ) );
setInterval( Qt::ZAxis, QwtInterval( 0.0, 10.0 ) );
}
示例2: setInterval
PlotRasterData::PlotRasterData()
{
setInterval( Qt::XAxis, QwtInterval( -100, 100, QwtInterval::ExcludeMaximum ) );
setInterval( Qt::YAxis, QwtInterval( -100, 100, QwtInterval::ExcludeMaximum ) );
setInterval( Qt::ZAxis, QwtInterval( 0.1, 2.0 ) );
setResampleMode( static_cast<QwtMatrixRasterData::ResampleMode>( 1 ) ); // Сглаживание
}
示例3: QwtRasterData
SaxsviewFrameData::SaxsviewFrameData(const QSize& size)
: QwtRasterData(), p(new Private) {
p->data = saxs_image_create();
saxs_image_set_size(p->data, size.width(), size.height(), 1, 1);
setInterval(Qt::XAxis, QwtInterval(0.0, size.width() - 1.0));
setInterval(Qt::YAxis, QwtInterval(0.0, size.height() - 1.0));
setInterval(Qt::ZAxis, QwtInterval(0.0, 1.0));
}
示例4: switch
void DragNDropResponse::execute(int call) {
switch (call) {
case 0: // pre-phase : ensure widgets are painted in order to mapToGlobal to work
m_src->repaint ();
m_dest->repaint ();
setInterval(100);
break;
case 1: // 1: press event
m_srcPosGlobal = m_src->mapToGlobal(m_srcPos);
m_destPosGlobal = m_dest->mapToGlobal(m_destPos);
qApp->postEvent(m_src,
new QMouseEvent(QEvent::MouseButtonPress,
m_srcPos,
m_srcPosGlobal,
Qt::LeftButton,
Qt::NoButton,
Qt::NoModifier));
break;
case 2: { // 2: WaitForDragStart
setInterval(qApp->startDragTime() + 20);
break;
}
case 3: { // 3: do some move event
setInterval(0);
QList<QPoint> moves;
calculate_drag_n_drop_moves(moves, m_srcPosGlobal, m_destPosGlobal, 4);
foreach (const QPoint & move, moves) {
QWidget * widgetUnderCursor = qApp->widgetAt(move);
if (widgetUnderCursor) {
qApp->postEvent(widgetUnderCursor,
new QMouseEvent(QEvent::MouseMove,
widgetUnderCursor->mapFromGlobal(move),
move,
Qt::LeftButton,
Qt::NoButton,
Qt::NoModifier));
}
}
break;
}
case 4: { // 4: now release the button
qApp->postEvent(m_dest,
new QMouseEvent(QEvent::MouseButtonRelease,
m_destPos,
m_destPosGlobal,
Qt::LeftButton,
Qt::NoButton,
Qt::NoModifier));
}
case 5: // and reply
writeResponse(QtJson::JsonObject());
break;
}
示例5: SpectrogramData
SpectrogramData()
{
// some minor performance improvements wgen the spectrogram item
// does not need to check for NaN values
setAttribute( QwtRasterData::WithoutGaps, true );
setInterval( Qt::XAxis, QwtInterval( -1.5, 1.5 ) );
setInterval( Qt::YAxis, QwtInterval( -1.5, 1.5 ) );
setInterval( Qt::ZAxis, QwtInterval( 0.0, 10.0 ) );
}
示例6: s
RasterData::RasterData(MouseSpectrogram *spectrogram) :
s(spectrogram),
max(0)
{
memset(d, 0, Statistic::SCREEN_SIZE * Statistic::SCREEN_SIZE * sizeof(int));
setInterval(Qt::XAxis,
QwtInterval(0.0, Statistic::SCREEN_SIZE));
setInterval(Qt::YAxis,
QwtInterval(0.0, Statistic::SCREEN_SIZE));
s->setAxisScale(QwtPlot::xBottom, 0, Statistic::SCREEN_SIZE);
s->setAxisScale(QwtPlot::yLeft, Statistic::SCREEN_SIZE, 0);
s->setAxisScale(QwtPlot::yRight, 0.0, 1.0);
}
示例7: cacheTrim
static void
cacheTrim (
sTimer *tp
)
{
static time_tClock cycle;
static pwr_tBoolean first = 1;
if (first) {
#ifdef OS_LINUX
cycle = 1 * sysconf(_SC_CLK_TCK);
#else
cycle = 1 * CLK_TCK;
#endif
setInterval(&cycle, gdbroot->db->cache_trim_int);
first = 0;
}
if (gdbroot->db->log.b.tmon)
errh_Info("cacheTrim: %u", tp->clock);
cvolcm_TrimOld();
cvol_Qtrim(&gdbroot->db->cacheNew);
setTimer(tp, cycle);
insertTimer(tp);
}
示例8: init
/**
* Creates instances of BasicBehaviours, needed according to the PlanRepository, with the help of the given
* BehaviourCreator. If a BasicBehaviour cannot be instantiated, the Initialisation of the Pool is cancelled.
* @param bc A BehaviourCreator.
* @return True, if all necessary BasicBehaviours could be constructed. False, if the Initialisation was cancelled.
*/
bool BehaviourPool::init(IBehaviourCreator* bc)
{
if (_behaviourCreator != nullptr) {
delete _behaviourCreator;
}
_behaviourCreator = bc;
const PlanRepository::Accessor<BehaviourConfiguration>& behaviourConfs = _ae->getPlanRepository()->getBehaviourConfigurations();
for (const BehaviourConfiguration* beh : behaviourConfs) {
auto basicBeh = _behaviourCreator->createBehaviour(beh->getId());
if (basicBeh != nullptr) {
// set stuff from behaviour configuration in basic behaviour object
basicBeh->setConfiguration(beh);
basicBeh->setDelayedStart(beh->getDeferring());
basicBeh->setInterval(1000 / beh->getFrequency());
basicBeh->setEngine(_ae);
basicBeh->init();
_availableBehaviours.insert(make_pair(beh, basicBeh));
} else {
return false;
}
}
return true;
}
示例9: PollingTuneController
/**
* \brief Constructs the controller.
*/
WinAmpTuneController::WinAmpTuneController()
: PollingTuneController(),
antiscrollCounter_(0)
{
startPoll();
setInterval(NormInterval);
}
示例10: stop
void PausableTimer::pause() {
if (isActive()) {
stop();
time_t elapsedTime = time(NULL) - startTime;
setInterval(interval() - elapsedTime*1000);
}
}
示例11: setSurfaceType
TestWindow::TestWindow() {
setSurfaceType(QSurface::OpenGLSurface);
auto timer = new QTimer(this);
timer->setInterval(5);
connect(timer, &QTimer::timeout, [&] { draw(); });
timer->start();
connect(qApp, &QCoreApplication::aboutToQuit, [this, timer] {
timer->stop();
_aboutToQuit = true;
});
#ifdef DEFERRED_LIGHTING
_light->setType(model::Light::SUN);
_light->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset::OLD_TOWN_SQUARE);
_light->setIntensity(1.0f);
_light->setAmbientIntensity(0.5f);
_light->setColor(vec3(1.0f));
_light->setPosition(vec3(1, 1, 1));
_renderContext->args = _renderArgs;
#endif
QSurfaceFormat format = getDefaultOpenGLSurfaceFormat();
format.setOption(QSurfaceFormat::DebugContext);
//format.setSwapInterval(0);
setFormat(format);
_glContext.setFormat(format);
_glContext.create();
_glContext.makeCurrent(this);
show();
}
示例12: WRITE_STRING_TO_PLAYLIST
void Playlist::clear(uint8_t clearFlags) {
if(clearFlags & CLEAR_SCRIPT_URL) {
WRITE_STRING_TO_PLAYLIST(script, (char *) "");
}
if(clearFlags & CLEAR_SETTINGS) {
setPlayOrder(FORWARDS_ORDER);
setPortamento(true);
setVolume(DEFAULT_VOLUME);
setUpdateFlags(0);
setInterval(DEFAULT_INTERVAL);
setAutoplayTimes(0, 0, 0);
setAutoplayChirpLimit(PLAYLIST_CAPACITY);
}
if(clearFlags & CLEAR_LIST) {
WRITE_TO_PLAYLIST(addIndex, 0);
// codes starting with 0 byte are considered empty
uint8_t *addr = PLAYLIST_FIELD_ADDR(codes);
for(uint8_t i = 0; i < PLAYLIST_CAPACITY; i++) {
Store::writeValue(addr, 0, 1);
addr += CODE_LENGTH;
}
nChirps = 0;
playIndex = 0;
isFirst = true;
}
}
示例13: HelpText
HelpText(MyScene *scene){
QFont font = g_editor->main_window->font();
font.setPointSize(15);
font.setPixelSize(15);
// When is this text shown?
_text = scene->addText(
// "* Add objects with right mouse button\n"
"* Move objects with right mouse button.\n"
"\n"
"* Double-click the name of an object to open GUI. (only if there is one)\n"
"\n"
"* Delete objects or connections by pressing SHIFT and click left.\n"
" - Alternatively, click with middle mouse button.\n"
"\n"
"* Select more than one object by holding CTRL when clicking.\n"
" - Alternatively, mark an area of objects with left mouse button.\n"
"\n"
"* To autoconnect a new object to an existing object, right click at the input or output of an existing object.\n"
"\n"
"* Zoom in and out by pressing CTRL and using the scroll wheel.\n"
,
font);
_text->setDefaultTextColor(get_qcolor(HIGH_BACKGROUND_COLOR_NUM).light(70));
_text->setPos(-150,-150);
_text->setZValue(-1000);
setSingleShot(true);
setInterval(1000*60);
start();
}
示例14: setInterval
void EditStaff::updateInstrument()
{
setInterval(instrument.transpose());
QList<StaffNameDoc>& nl = instrument.shortNames();
QTextDocumentFragment df = nl.isEmpty() ? QTextDocumentFragment() : nl[0].name;
shortName->setHtml(df.toHtml());
nl = instrument.longNames();
df = nl.isEmpty() ? QTextDocumentFragment() : nl[0].name;
longName->setHtml(df.toHtml());
if (partName->text() == instrumentName->text()) // Updates part name is no custom name has been set before
partName->setText(instrument.trackName());
instrumentName->setText(instrument.trackName());
_minPitchA = instrument.minPitchA();
_maxPitchA = instrument.maxPitchA();
_minPitchP = instrument.minPitchP();
_maxPitchP = instrument.maxPitchP();
minPitchA->setText(midiCodeToStr(_minPitchA));
maxPitchA->setText(midiCodeToStr(_maxPitchA));
minPitchP->setText(midiCodeToStr(_minPitchP));
maxPitchP->setText(midiCodeToStr(_maxPitchP));
int numStr = instrument.stringData() ? instrument.stringData()->strings() : 0;
numOfStrings->setText(QString::number(numStr));
}
示例15: Tune
Tune WinAmpTuneController::getTune(const HWND &hWnd)
{
Tune tune = Tune();
int position = (int)SendMessage(hWnd, WM_WA_IPC, 0, IPC_GETLISTPOS);
if (position != -1) {
if (hWnd && SendMessage(hWnd,WM_WA_IPC,0,IPC_ISPLAYING) == 1) {
QPair<bool, QString> trackpair(getTrackTitle(hWnd));
if (!trackpair.first) {
// getTrackTitle wants us to retry in a few ms...
int interval = AntiscrollInterval;
if (++antiscrollCounter_ > 10) {
antiscrollCounter_ = 0;
interval = NormInterval;
}
setInterval(interval);
return Tune();
}
antiscrollCounter_ = 0;
tune.setName(trackpair.second);
tune.setURL(trackpair.second);
tune.setTrack(QString::number(position + 1));
tune.setTime(SendMessage(hWnd, WM_WA_IPC, 1, IPC_GETOUTPUTTIME));
}
}
return tune;
}