[Development] Problem with QtQuick.Controls, style.panel <-> custom Control children stack order

Bache-Wiig Jens Jens.Bache-Wiig at digia.com
Thu May 16 15:39:42 CEST 2013


On May 16, 2013, at 3:24 PM, Tomasz Olszak <olszak.tomasz at gmail.com> wrote:

> I have encountered some problem related to Control.qml/AbstractCheckable.qml internals.
> Example case:
> CheckBoxStyle has indicator which can interact with user (has mouse area).

Note this discussion probably belongs on the qt-components mailing list so we should continue the thread there.

> Current situation:
> We are not able to handle such case, even by reimplementing panel because:
> * panelLoader(from Control.qml) and MouseArea (from AbstractCheckable) are on the same hierarchy level
> * MouseArea(from AbstractCheckable) is created after panelLoader - is  higher on stack because z's properties are the same
> * MouseArea (from AbstractCheckable) covers all other MouseArea's from style.panel
> 
> I have analysed this case and don't see any obvious solution. Below is some informal draft of object visibility stack. We see that MouseArea from AbstractCheckable covers Items created in CheckBoxStyle (is it a bug? )

(…)

> So content of CheckBoxStyle should be above all default mechanisms and below user items in stack order.
> 
> What do you think?

I don't think this is a valid issue. I am not sure what your are trying to create but I wouldn't say this use case is supported and it is intentional that you do not have control over the button behaviour from the style.
I presume the main reason you need your own mouse area is that you are really trying to make the CheckBox into behaving as a Switch. I would rather that we provide the logic and necessary styling of a Switch (for 5.2) as a separate control, leaving it up to the user which control he wants to make use of rather than overload the behaviour of a CheckBox in a style implementation. 

Regards,
Jens




More information about the Development mailing list