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

checkbox draws unpredictably in QWebView due to animation

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes