Improving sailfish silica components

I’ve been doing some development with qt quick controls, and one thing i find really convenient is the distinction between a change event and an interactive change event. This is one of the feature i miss most when using silica components.

If you look for example at ComboBox QML Type | Qt Quick Controls | Qt 6.10.2 , you see the activated(index) signal, which is triggered by user interaction, but not if you programmatically change the value (which would be the case of the currentIndexChanged signal).

Similar signals exist on most qt quick controls. They are really useful when an item both acts as a visualization for a property that can change without user interaction (think of a progress bar of a played music track, for example) and is also used for user interaction (to seek to a specific location). Sailfish silica unfortunately lacks them.

Is there any plans to add them so that the logic would be inside the control, and we do not have to resort to workarounds ?

1 Like

Note that I have zero knowledge about Qt… But are those tools implemented in what Qt version? To my knowledge, Silica uses Qt5.6 which is quite old. Would Qt need to be updated to have those tools?

Unless i’m missing something, it is perfectly doable with current Qt 5.6. It’s about extending sailfish silica components with new features, taking inspiration from what is nice in Qt quick controls, not about using qt quick controls instead of silica components.

2 Likes

Maybe raise this topic in the community meeting? That is usually the best way to get the answer

Thought about that, but it’s unlikely that i will be able to attend. Could try, though.

Usually all topics still generate interesting conversations during the meeting and you will get answer in form of logs. Of course it is always nicer to attend!

Generally on the topic of improving Silica Components:

As development has been rather slow on Silica itself, and the whole thing is not Open Source, the pragmatic way of improving components that lack something would be to contribute to the Opal project:

10 Likes

Makes sense. But Opal is mostly GPL, this may be an issue (not in my case, though). On the other hand, the qml part of silica components tells it is under BSD license. So i’d rather improve the latter if that’s possible.

With the current SailfishOS SDK you can do it:

ComboBox {
    menu: ContextMenu {
        MenuItem {
            
        }
        onActivated: 
    }
}

In Silica the event “onActivated” belongs to “ContextMenu” (= the items of the ComboBox).

You are missing more?

1 Like

I guess that goes in the workarounds i was referring to. It mostly works, but there’s still an issue with it : it is triggerred before the currentIndex property of the combobox is updated. This may lead to bugs if you refer it (or, more probably, the currentItem) in the handler. That’s also unintuitive (i always found unintuitive that combobox uses a menu, but putting the change handler inside the menu itself is another increase in unintuitiveness). But thanks for the tip.

Moreover, this is specific to this component, whereas all silica components lacks this feature : Slider, TextField, xxxxSwitch, etc.

Will there a big difference between this onActived() and onFocusChanged() {if (focus) ..} for this items?

focusChanged does not means the item changed (and item value can change without it losing focus). downChanged is a better alternative in the case of Slider. But they are workarounds, not a real solution (qt quick controls added these signals for a reason…)