1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

更新QQtDataPersistence,隐藏marker()函数

This commit is contained in:
tianduanrui 2020-03-09 12:08:31 +08:00
parent e55e68036d
commit 193c8eca75
3 changed files with 36 additions and 30 deletions

View File

@ -51,28 +51,9 @@ void QQtDataPersistence::start()
QQtDictionary& QQtDataPersistence::dictionary() { return mDict; }
void QQtDataPersistence::marker ()
{
bMarker = true;
}
void QQtDataPersistence::reset_marker()
{
bMarker = false;
}
bool QQtDataPersistence::setMarker ( bool mark )
{
bMarker = mark;
}
bool QQtDataPersistence::getMarker() const
{
return bMarker;
}
void QQtDataPersistence::stop()
{
marker();
mLock.unlock();
}
@ -190,3 +171,23 @@ void QQtDataPersistence::writeFile ( const QByteArray& bytes )
file.write ( bytes );
file.close();
}
void QQtDataPersistence::marker ()
{
bMarker = true;
}
void QQtDataPersistence::reset_marker()
{
bMarker = false;
}
bool QQtDataPersistence::setMarker ( bool mark )
{
bMarker = mark;
}
bool QQtDataPersistence::getMarker() const
{
return bMarker;
}

View File

@ -81,21 +81,13 @@ public:
//2! 操作
QQtDictionary& dictionary();
/*设置标记*/
void marker ();
/*重置标记*/
void reset_marker ();
/*设置标记 default: true*/
bool setMarker ( bool mark = true );
/*获取标记 default: false*/
bool getMarker() const;
//3! 关闭
void stop();
//持久化数据保存周期 [default:1000ms]
int timerInterval() const;
void setTimerInterval ( int millSecond = 1000 );
private slots:
void slotTimeOut();
@ -108,9 +100,20 @@ protected:
virtual void writeFile ( const QByteArray& bytes );
private:
/*设置标记*/
void marker ();
/*重置标记*/
void reset_marker ();
/*设置标记 default: true*/
bool setMarker ( bool mark = true );
/*获取标记 default: false*/
bool getMarker() const;
/*一个标记*/
bool bMarker;
private:
QReadWriteLock mLock;
QQtDictionary mDict;

View File

@ -67,7 +67,9 @@ void MainWindow::on_pushButton_clicked ( bool checked )
handler.fromJson ( bytes );
//旁边的按钮更改了内部数据又给改回去了只好force writemarker()。
dp0.marker();
//dp0.marker();
//QQtDataPersistence已经内部自动调用用户正常操作数据即可。
dp0.stop();