OlivierLDff / Qaterial

🧩 Collection of Material Components based on QtQuickControls2.
https://olivierldff.github.io/Qaterial/
MIT License
291 stars 54 forks source link

ColorIcon.qml RangeError: Maximum call stack size exceeded #140

Open MichaelHeiser opened 1 year ago

MichaelHeiser commented 1 year ago

I have a weird error when using Colorize and ColorOverlay from Graphical effects:

file:///D:/Qt/5.15.12/msvc2019_64/qml/QtGraphicalEffects/Colorize.qml:0: RangeError: Maximum call stack size exceeded.

The error seems to come from a ColorIcon.qml I'm using in my application:

 /**
 * Copyright (C) Olivier Le Doeuff 2019
 * Contact: olivier.ldff@gmail.com
 */

// Qt
import QtQuick 2.12
import QtGraphicalEffects 1.12 as QGE

import Qaterial 1.0 as Qaterial

Item
{
  id: root

  property color color: Qaterial.Style.colorTheme.primaryText
  property alias icon: dummyImage.source
  property real size: Qaterial.Style.smallIcon
  property bool cached: true

  readonly property real _implicitSize: icon.toString() ? size : 0
  readonly property bool isImage: color.a === 0

  implicitWidth: _implicitSize
  implicitHeight: _implicitSize

 Image
  {
    id: dummyImage

    anchors.fill: parent

    fillMode: Image.PreserveAspectFit
    sourceSize: Qt.size(root.width, root.height)
    visible: root.isImage && root.enabled
  } // Image

  QGE.ColorOverlay
  {
    anchors.fill: parent

    source: dummyImage
    readonly property color implicitColor: enabled ? root.color : Qaterial.Style.colorTheme.disabledText
    color: Qt.rgba(implicitColor.r, implicitColor.g, implicitColor.b, implicitColor.a)

    cached: root.cached
    visible: !root.isImage
  } // ColorOverlay

  QGE.Colorize
  {
    anchors.fill: parent

    source: dummyImage
    hue: 0
    saturation: 0
    lightness: -0.2

    cached: root.cached
    visible: root.isImage && !root.enabled
  } // Colorize
} // Item

Can anyone perhaps tell me how I can solve this issue? I'm not so familiar with Graphical effects...

OlivierLDff commented 1 year ago

This seems to be a qt error, maybe related to https://bugreports.qt.io/browse/QTBUG-27433 ?

MichaelHeiser commented 1 year ago

But what does it mean? Do i generate too much Items? I have generated custom components based on Qaterial controls.

OlivierLDff commented 1 year ago

I have no idea without seeing any code, I won't have time to investigate at the moment.