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

QProxyStyle doesn't steal back base style from other QProxyStyles

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.6.3, 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.7.4, 4.8.0, 4.8.1, 4.8.2, 4.8.3, 4.8.4, 5.0.0
    • GUI: Look'n'Feel
    • None
    • Windows, Linux, Mac

      QProxyStyle::ensureBaseStyle() should always reset the proxy of its base style.

      Here is an example why:

      QProxyStyle* proxyWidgetA = new QProxyStyle(base);
      proxyWidgetA->standardPalette(); // call QProxyStyle::ensureBaseStyle()
      Q_ASSERT(base->proxy() == proxyWidgetA);

      QProxyStyle* proxyWidgetB = new QProxyStyle(base);
      proxyWidgetB->standardPalette(); // QProxyStyle::ensureBaseStyle()
      Q_ASSERT(base->proxy() == proxyWidgetB);

      // When the widget A is drawn...
      proxyWidgetA->standardPalette(); // QProxyStyle::ensureBaseStyle()
      Q_ASSERT(base->proxy() == proxyWidgetA); // -> fail

      Please also note that QProxyStyle::QProxyStyle() QProxyStyle::setBaseStyle() and QProxyStyle::ensureBaseStyle() could benefit from refactorization. (calls to setProxy(...) and setParent(...) are duplicated). Worst, QProxyStyle::QProxyStyle(QStyle* s) creates an unnecessary style because of the order of the calls (in constructor, setParent() triggers a ensureBaseStyle() that creates a system style)

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

            bachewii Jens
            finetjul Julien Finet
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes