View Full Version : In the QTimer Slot, the setStyleSheet Problem
nightrain
29th December 2009, 09:52
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?????
high_flyer
29th December 2009, 09:58
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.
nightrain
29th December 2009, 10:21
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
nightrain
29th December 2009, 10:39
No matter how, Thanks !
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.