Results 1 to 2 of 2

Thread: flicker when hide() QPushButton with stylesheet (background-image)

  1. #1
    Join Date
    Jun 2007
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default flicker when hide() QPushButton with stylesheet (background-image)

    Hi @all

    Can you please tell me how to avoid the flickering which you can see on this
    video:

    http://www.pokerth.net/hideButtonFlicker.mpeg

    The green "raise" botton was set with:
    ----------------------------------------------------------------------------------------------------------------
    pushButton_BetRaise->setStyleSheet("QPushButton { border:none;
    background-image: url(" + myAppDataPath
    +"gfx/gui/table/default/playeraction_03.png); "+ font2String +" font-size:
    11px; font-weight: bold; color: #F0F0F0; }");
    ------------------------------------------------------------------------------------------------------------------

    myAppDataPath could be "/home/user/PokerTH-0.6/data/" so the url value would
    be: background-image:
    url(/home/user/PokerTH-0.6/data/gfx/gui/table/default/playeraction_03.png);

    Please note that it reads the gfx from an external directory NOT from an
    resource collection files (.qrc). May be that is the problem?

    The grey square (which is the default-look of the button in designer) flicker
    happends when doing:
    ----------------------------------------------------------------------------------------------------------------
    pushButton_BetRaise->hide();
    spinBox_set->show();
    ----------------------------------------------------------------------------------------------------------------

    The screencapture video grabs it not very accurate. When doing the code above
    the first time after application start the grey square appears around one
    whole second until it *disappears and spinBox_set is show.

    The next time doing the pushButton_BetRaise->hide(); spinBox_set->show(); it
    works nearly without flickering.

    Sometimes ago i used the resource collection files to store the gfx files.
    There wasn't any flickering problems. But i also changed to qt-4.3.1 during
    remove the use of qrc so i'am cannot guess which is the problem qt-4.3.1
    or "not-qrc".

    May be there is a totaly different problem you can tell me about and may be
    you can help me how to fix it.

    best regards
    Felix Hammer
    _______________________________________
    http://www.pokerth.net

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: flicker when hide() QPushButton with stylesheet (background-image)

    Quote Originally Posted by doitux View Post
    Please note that it reads the gfx from an external directory NOT from an resource collection files (.qrc). May be that is the problem?
    Yes, it could be. It takes a bit of time to read the data from disk, while if you use resources, the data is already in memory.

    Quote Originally Posted by doitux View Post
    But i also changed to qt-4.3.1 during
    remove the use of qrc so i'am cannot guess which is the problem qt-4.3.1
    or "not-qrc".
    You could create a .qrc file with that problematic image to see whether the flicker will go away.

    Since the flicker doesn't appear, if you show the widget for the second time, the solution would be to make Qt cache the image before you use it. QPixmapCache might help you with this.

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.