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

QProxyStyle doesn't support proxies

    XMLWordPrintable

Details

    Description

      QProxyStyle doesn't support being a basestyle of another QProxyStyle.
      No possibility to nest QProxyStyles.

      Nesting QProxyStyle is useful, one at the application level and one for some widgets.

      To fix it, the main idea is to change the line in QProxyStyle.cpp:104:
      baseStyle->setProxy(const_cast<QProxyStyle*>(q));
      with
      baseStyle->setProxy(const_cast<QStyle*>(q->proxy() ? q->proxy() : q));

      There needs few more tweaks though, e.g.:

      • ensureBaseStyle() always needs to call the setProxy() line even if a baseStyle exists initially.

      In the following example:
      A (is a QCleanlooksStyle)
      B (is an application QProxyStyle that takes A as baseStyle)
      C (is a widget QProxyStyle that takes B as a baseStyle)

      When drawing widget X (that has a custom C style):
      A.proxy = C
      B.proxy = C
      C.proxy = 0

      When drawing widget Y (that uses the application style)
      A.proxy = B
      B.proxy = 0

      The proxy of B needs to be cleared when C is not in use anymore.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            finetjul Julien Finet
            Votes:
            7 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes