In my QTimer's SLOT , I Call QTableView's setStyleSheet and continuously change the background of one row in table , But observe the taskmgr, the use of memory increase so quickly; What can I resolve it?????
In my QTimer's SLOT , I Call QTableView's setStyleSheet and continuously change the background of one row in table , But observe the taskmgr, the use of memory increase so quickly; What can I resolve it?????
you probably have a memory leak.
We can't help you without seeing the relevant code.
You mention that you are calling a slot continuously, it could be you are allocating in that slot, but never releasing.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
void CEveAlarmDlg::CreateActions()
{
QTimer *timerlogin = new QTimer(this);
connect(timerlogin, SIGNAL(timeout()), this, SLOT(TimerFlash()));
timerlogin->start(500);
connect(tabWidgetEveAlarm, SIGNAL(currentChanged(int)), this, SLOT(TabChanged()));
}
void CEveAlarmDlg::TimerFlash()
{
flasshfalg = !flashfalg; //flashflag is bool
if(flashflag)
tableViewSys->setStyleSheet("QTableView {selection-background-color: #53A57A; selection-color: #FF0000; gridline-color: #00FF00}");
else
tableViewSys->setStyleSheet("QTableView {selection-background-color: #892245; selection-color: #FF0000; gridline-color: #00FF00}");
}
and I use VC 6.0 +QT 4.3.2
No matter how, Thanks !
Bookmarks