Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Stylesheet background color bug in Windows 8.0/8.1

Stylesheet background color bug in Windows 8.0/8.1

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tomq
    wrote on last edited by
    #1

    I am currently migrating two large applications from windows 7 to windows 8.0/8.1.

    I've encountered the following bug: when a QLineEdit has a background color set (through a stylesheet), and the mouse hovers over it, the background color changes to white for about 1 or 2 seconds. This occurs in release and debug, regardless of whether a debugger is attached or not.

    The Qt configuration is Qt 4.8.4 with MinGW 4.4.

    I have made a toy project to reproduce the issue, I am only reproducing the code for the main window source file:

    @
    WidgetBackgroundMainWindow::WidgetBackgroundMainWindow(QWidget *parent) :
    QMainWindow(parent)
    {
    m_central = new QWidget();
    setCentralWidget(m_central);

    m_layout = new QVBoxLayout();
    m_central->setLayout(m_layout);
    
    m_lineEdit1 = new QLineEdit();
    m_lineEdit2 = new QLineEdit();
    
    m_layout->addWidget(m_lineEdit1);
    m_layout->addWidget(m_lineEdit2);
    
    m_lineEdit1->setStyleSheet("background-color:#888888;"); //gray
    m_lineEdit2->setStyleSheet("background-color:#13579B;"); //blue
    

    }
    @

    I have tried setting a background color in case of hovering in the stylesheets, but this has no effect on the bug (the background first turns to white for 1 or 2 seconds, and then, if the mouse is still over the widget, it turns to the specified color).

    This seems to be fairly basic code, and it works perfectly in Windows 7, so my guess is that there is a compatibility problem with Windows 8, which may have gone undetected because it is invisible if the background is white to begin with. Does anyone have any ideas as to the root of the problem, and/or a possible fix?

    I'm including below a few screenshots illustrating the issue, based on the code shown above:
    !http://i43.tinypic.com/2agmd0x.png(screenshot)!

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      i currently can't try this and look for a fix.

      But note Windows 8 is not a Tier1 platform nor a Tier2. So officially Qt 4 isn't supported on Windows 8. Thus Digia doesn't run their tests on Windows 8.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tomq
        wrote on last edited by
        #3

        Thanks. I understand that aspect, and upgrading to 5.2 will be inevitable eventually. Nonetheless, it would be great to be able to use qt 4.8.4 for a little longer.

        Note: I could reproduce the same bug for Qt 4.8.5 with MS Visual Studio 2010, also in Windows 8.1. I did this to rule out bugs with 4.8.4 and mingw.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Valeologiya
          wrote on last edited by
          #4

          Hi! I have the same problem with Qt 5.2.0 with MinGW 3.82.90 in Windows 8. I didn't try in other platforms. It seems that еhis problem don't depend of Qt version.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jmaurice
            wrote on last edited by
            #5

            One workaround that worked for me was to disable the frame of the QLineEdit, then the background color stopped changing

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved