QT中QML控件Colorize和Glow一起使用异常

图片修改色相饱和度和辉光效果一起使用存在bug 

Image {                                                                                     
    id: home                                                                                
    x: 706                                                                                  
    y: 64                                                                                   
    source: "qrc:/Image/Theme1/GlobalPanel/menu/homeGray.png"                               
    Colorize {                                                                              
        anchors.fill: parent                                                                
        source: home                                                                        
        hue: rootIndex === 0 ? imgHue : 0                                                   
        saturation: rootIndex === 0 ? imgSaturation : 0                                     
        lightness: rootIndex === 0 ? imgLightness : 0                                       
    }                                                                                       
    layer.enabled: rootIndex === 0                                                          
    layer.effect: Glow { color: "#cfcfdc"; radius: 2; samples: 1 + 2 * radius; spread: 0.2 }
}                                                                                           
                                                                                            

解决bug方式

Image {                                                           
    id: home                                                      
    x: 706                                                        
    y: 64                                                         
    source: "qrc:/Image/Theme1/GlobalPanel/menu/homeGray.png"     
    Colorize {                                                    
        anchors.fill: parent                                      
        source: home                                              
        hue: rootIndex === 0 ? imgHue : 0                         
        saturation: rootIndex === 0 ? imgSaturation : 0           
        lightness: rootIndex === 0 ? imgLightness : 0             
    }                                                             
    layer.enabled: true                                           
    layer.effect: Glow {                                          
        color: "#cfcfdc"                                          
        radius: 2                                                 
        samples: 1 + 2 * radius                                   
        spread: rootIndex === 0 ? 0.2 : 0                         
    }                                                             
}                                                                 
                                                                  

 

你可能感兴趣的:(QT)