Results 1 to 4 of 4

Thread: In the QTimer Slot, the setStyleSheet Problem

  1. #1
    Join Date
    Dec 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Wink In the QTimer Slot, the setStyleSheet Problem

    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?????

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: In the QTimer Slot, the setStyleSheet Problem

    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.

  3. #3
    Join Date
    Dec 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Re: In the QTimer Slot, the setStyleSheet Problem

    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

  4. #4
    Join Date
    Dec 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: In the QTimer Slot, the setStyleSheet Problem

    No matter how, Thanks !

Similar Threads

  1. QTimer problem
    By vv in forum Qt Programming
    Replies: 9
    Last Post: 3rd July 2007, 08:13
  2. Problem with slot
    By beerkg in forum Qt Programming
    Replies: 29
    Last Post: 3rd April 2007, 19:54
  3. QSpinBox and setStylesheet problem
    By Ace-X in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2007, 11:21
  4. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  5. Qthread n QTimer Problem
    By quickNitin in forum Qt Programming
    Replies: 5
    Last Post: 8th June 2006, 14:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.