Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-34163

checkbox draws unpredictably in QWebView due to animation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.1.1
    • None
    • MS Windows

    Description

      In the attached code the check in the checkbox does not always draw correctly.
      I found a workaround that fixes it.

      class CustomStyle : public QProxyStyle
      {
          void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const
          {
              if (element == QStyle::CE_CheckBox && dynamic_cast<QWebView*>(option->styleObject))
                  option->styleObject->setProperty("_q_no_animation", true);
              QProxyStyle::drawControl(element, option, painter, widget);
          }
      };
      

      since the QStyleOption::styleObject is the QWebView, when the animation is generated it has a bad starting point. QWindowsVistaStyle::drawPrimitive uses QStyleOption::styleObject->property("_q_stylestate") for the starting point. The stylestate of the QWebView has nothing to do with the checkbox state.

      Attachments

        1. main.cpp
          1 kB
          Chris Armstrong

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              allan.jensen Allan Sandfeld Jensen
              chiefarmstrong Chris Armstrong
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes