Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ShaderEffectSource warning without using it explicitly
QtWS25 Last Chance

ShaderEffectSource warning without using it explicitly

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 1.6k Views
  • 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.
  • M Offline
    M Offline
    Mark81
    wrote on last edited by
    #1

    I wrote this QML object:

    import QtQuick 2.11
    import QtGraphicalEffects 1.0
    
    Rectangle {
        property color activeColor: "black"
    
        id: outer
        color: "transparent"
        clip: true
    
        Behavior on activeColor {
            ColorAnimation { duration: 1000 }
        }
    
        Rectangle {
            id: inner
            width: parent.width
            height: width
            radius: width
    
            LinearGradient {
                anchors.fill: inner
                source: inner
                start: Qt.point(outer.width / 2, 0)
                end: Qt.point(outer.width / 2, outer.height)
                gradient: Gradient {
                    GradientStop { position: 0.0; color: activeColor }
                    GradientStop { position: 1.0; color: "black" }
                }
            }
        }
    }
    

    when I show it or change the activeColor property I get the following warning:

    ShaderEffectSource: 'recursive' must be set to true when rendering recursively.

    I guess it depends on the LinearGradient even if I don't use a ShaderEffectSource directly. But where is the recursion here? And how to set the recursive property to true? It's not a member of LinearGradient.

    raven-worxR 1 Reply Last reply
    0
    • M Mark81

      I wrote this QML object:

      import QtQuick 2.11
      import QtGraphicalEffects 1.0
      
      Rectangle {
          property color activeColor: "black"
      
          id: outer
          color: "transparent"
          clip: true
      
          Behavior on activeColor {
              ColorAnimation { duration: 1000 }
          }
      
          Rectangle {
              id: inner
              width: parent.width
              height: width
              radius: width
      
              LinearGradient {
                  anchors.fill: inner
                  source: inner
                  start: Qt.point(outer.width / 2, 0)
                  end: Qt.point(outer.width / 2, outer.height)
                  gradient: Gradient {
                      GradientStop { position: 0.0; color: activeColor }
                      GradientStop { position: 1.0; color: "black" }
                  }
              }
          }
      }
      

      when I show it or change the activeColor property I get the following warning:

      ShaderEffectSource: 'recursive' must be set to true when rendering recursively.

      I guess it depends on the LinearGradient even if I don't use a ShaderEffectSource directly. But where is the recursion here? And how to set the recursive property to true? It's not a member of LinearGradient.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Mark81 said in ShaderEffectSource warning without using it explicitly:

      I guess it depends on the LinearGradient even if I don't use a ShaderEffectSource directly. But where is the recursion here?

      since the gradient is a child of the source, it will render itself recursively.

      In your case to overcome the error you should place the LinearGradient element next to the source item (as a sibling) and explicitly hide the source item.

      --- 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
      5

      • Login

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