1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
This commit is contained in:
tianduanrui 2018-07-14 12:18:03 +08:00
commit 6aa99df2b5
2 changed files with 24 additions and 2 deletions

View File

@ -81,7 +81,8 @@ QByteArray& operator>> ( QByteArray& l, quint64& r )
{
quint8 r0 = 0, r1 = 0, r2 = 0, r3 = 0, r4 = 0, r5 = 0, r6 = 0, r7 = 0;
l >> r0 >> r1 >> r2 >> r3 >> r4 >> r5 >> r6 >> r7;
r = ( (quint64)r0 << 56 ) | ( (quint64)r1 << 48 ) | ( (quint64)r2 << 40 ) | ( (quint64)r3 << 32 ) | ( r4 << 24 ) | ( r5 << 16 ) | ( r6 << 8 ) | r7;
r = ( ( quint64 ) r0 << 56 ) | ( ( quint64 ) r1 << 48 ) | ( ( quint64 ) r2 << 40 ) | ( ( quint64 ) r3 << 32 ) |
( r4 << 24 ) | ( r5 << 16 ) | ( r6 << 8 ) | r7;
return l;
}
@ -138,3 +139,23 @@ void QQtSleep ( int millsecond )
}
}
void QQtSleepWaitingForSignal ( int millsecond, const QObject* obj, const char* signal )
{
//initilize
QEventLoop eventloop;
QObject::connect ( obj, signal, &eventloop, SLOT ( quit() ) );
QTimer timer;
timer.setSingleShot ( true );
timer.setInterval ( millsecond );
QObject::connect ( &timer, SIGNAL ( timeout() ), &eventloop, SLOT ( quit() ) );
//process
eventloop.exec();
//clear
if ( timer.isActive() )
timer.stop();
}

View File

@ -1,4 +1,4 @@
#ifndef QQTCORE_H
#ifndef QQTCORE_H
#define QQTCORE_H
#include <QWidget>
@ -108,6 +108,7 @@ typedef unsigned char uint8_t;
QQTSHARED_EXPORT void QQtSleep ( int millsecond );
QQTSHARED_EXPORT void QQtSleepWaitingForSignal ( int millsecond, const QObject* obj, const char* signal );
#ifdef __cplusplus
}