本文整理汇总了C++中QTimer::remainingTime方法的典型用法代码示例。如果您正苦于以下问题:C++ QTimer::remainingTime方法的具体用法?C++ QTimer::remainingTime怎么用?C++ QTimer::remainingTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTimer
的用法示例。
在下文中一共展示了QTimer::remainingTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
BrowserApplication a(argc, argv);
//MainWindow w;
BrowserMainWindow w;
QRect maxRect;
{
QDesktopWidget desktop;
maxRect = desktop.availableGeometry();
maxRect.adjust(50,50,-50,-50);
}
w.setGeometry(maxRect);
qDebug() << QApplication::applicationDirPath() << QApplication::applicationFilePath();
{
QPixmap splashPixmap(QApplication::applicationDirPath() + "/comm/conf/pics/splash.png");
QSplashScreen splash(splashPixmap);
splash.show();
enum {
splashTime = 1500
};
QTimer timer;
timer.start(splashTime);
do {
a.processEvents();
splash.showMessage(QString("Loading Process: %1%").arg(timer.remainingTime()*100.0/splashTime),Qt::AlignBottom);
} while(timer.remainingTime() > 1);
splash.finish(&w);
}
w.show();
a.processEvents();
return a.exec();
}
示例2: lua_sleep
static int lua_sleep(lua_State *L)
{
int m = static_cast<int> (luaL_checknumber(L,1));
QTimer timer;
timer.start(m);
while(timer.remainingTime() > 0)
qApp->processEvents();
LuaManager::LuaControl.forceMapUpdate();
return 0;
}
示例3: remainingTime
void tst_QTimer::remainingTime()
{
TimerHelper helper;
QTimer timer;
connect(&timer, SIGNAL(timeout()), &helper, SLOT(timeout()));
timer.start(200);
QCOMPARE(helper.count, 0);
QTest::qWait(50);
QCOMPARE(helper.count, 0);
int remainingTime = timer.remainingTime();
QVERIFY2(qAbs(remainingTime - 150) < 50, qPrintable(QString::number(remainingTime)));
}
示例4: message
void RICTLMB2B30Widget::btWriteClicked()
{
ui->labelRectangleStatus->close();
if((!ui->rbDecimal->isChecked() && !ui->rbHexadecimal->isChecked())){
SystemMessagesWidget::instance()->writeMessage(tr("Please, select the identification type."),
SystemMessagesWidget::KWarning,
SystemMessagesWidget::KDialogAndTextbox);
return;
}
if(ui->leIdentification->text().isEmpty()){
SystemMessagesWidget::instance()->writeMessage(tr("The identification must have at least 1 characters."),
SystemMessagesWidget::KWarning,
SystemMessagesWidget::KOnlyDialog);
return;
}
QString message(tr("Wait... Trying to write."));
SystemMessagesWidget::instance()->writeMessage(message, SystemMessagesWidget::KInfo);
ui->labelRectangleStatus->setText(message);
ui->labelRectangleStatus->setStyleSheet("QLabel { background-color : yellow;}");
ui->labelRectangleStatus->show();
//Process the events to repaint the widget with the new labelRectangleStatus.
QCoreApplication::processEvents();
ui->btWrite->setEnabled(false);
// Mark the processing to check for a answers on reading.
m_waitingForAnswer = true;
if(m_connectionType == Settings::KNetwork){
int interval = 500;
QTimer timer;
timer.setSingleShot(true);
NetworkCommunication::instance()->sendFullRead(true);
timer.start(interval);
while(timer.remainingTime() > 0)
;
sendCommand("L");
timer.start(interval);
while(timer.remainingTime() > 0)
;
sendCommand("K0");
timer.start(interval);
while(timer.remainingTime() > 0)
;
sendCommand("P" + m_identification);
}else{
/* Send the "L" command to the reader. This ensure that the reader operates in Line Mode.
* It is needed to keep the reader responding for reads, to check the command responses
* and the identification codes from transponder, automatically. */
sendCommand("L");
/* Send the "K0" command to the reader. This ensure that the reader understant it is working
* with a 64-bits transponder, a K0. If the reader is not set with K0, it will not understand
* the commands and will not answer, correctly. */
sendCommand("K0");
/* Send the "P" + identification code to the reader. This is the way to define a new code
* to the trasponder. */
sendCommand("P" + m_identification);
}
// Start the timeout to wait for a response. If the timer ends, define as failed.
m_timeout.start();
}