本文整理汇总了C++中QTimer::interval方法的典型用法代码示例。如果您正苦于以下问题:C++ QTimer::interval方法的具体用法?C++ QTimer::interval怎么用?C++ QTimer::interval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTimer
的用法示例。
在下文中一共展示了QTimer::interval方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
SessionServer::SessionServer(QObject *parent)
: QObject(parent),
_store(nullptr),
_identman(nullptr),
_sessionLimit(1),
_connectionTimeout(0),
_historyLimit(0),
_expirationTime(0),
_allowPersistentSessions(false),
_mustSecure(false)
{
QTimer *cleanupTimer = new QTimer(this);
connect(cleanupTimer, &QTimer::timeout, this, &SessionServer::cleanupSessions);
cleanupTimer->setInterval(15 * 1000);
cleanupTimer->start(cleanupTimer->interval());
_publicListingApi = new sessionlisting::AnnouncementApi(this);
connect(_publicListingApi, &sessionlisting::AnnouncementApi::sessionAnnounced, this, &SessionServer::sessionAnnounced);
connect(_publicListingApi, &sessionlisting::AnnouncementApi::messageReceived, [this](const QString &msg) {
wall("Session announced: " + msg);
});
QTimer *announcementRefreshTimer = new QTimer(this);
connect(announcementRefreshTimer, &QTimer::timeout, this, &SessionServer::refreshSessionAnnouncements);
announcementRefreshTimer->setInterval(1000 * 60 * 5);
announcementRefreshTimer->start(announcementRefreshTimer->interval());
#ifndef NDEBUG
_randomlag = 0;
#endif
}
示例2: interval
int QTimerProto::interval() const
{
QTimer *item = qscriptvalue_cast<QTimer*>(thisObject());
if (item)
return item->interval();
return -1;
}
示例3: property
QScriptValue TimerClass::property(const QScriptValue &object,
const QScriptString &name, uint /*id*/) {
QTimer *timer = qscriptvalue_cast<QTimer*>(object.data());
if (!timer)
return QScriptValue();
if (name == _interval) {
return timer->interval();
} else if (name == _singleShot) {
return timer->isSingleShot();
}
return QScriptValue();
}
示例4: QObject
SessionServer::SessionServer(QObject *parent)
: QObject(parent),
_store(nullptr),
_identman(nullptr),
_sessionLimit(1),
_connectionTimeout(0),
_historyLimit(0),
_expirationTime(0),
_allowPersistentSessions(false),
_mustSecure(false)
{
QTimer *cleanupTimer = new QTimer(this);
connect(cleanupTimer, SIGNAL(timeout()), this, SLOT(cleanupSessions()));
cleanupTimer->setInterval(15 * 1000);
cleanupTimer->start(cleanupTimer->interval());
}