Important: Please read the Qt Code of Conduct -

[desktop components] Bug in Splitter?

  • Hi,

    I've checked out the "QML desktop components plugin": (trunk on master branch) and tried to run the SplitterGallery example (using Qt 4.7.3).
    But it does not work correctly: When I drag any splitter, I can only resize the gray row at the very left.
    The size of the other rows never change.

    I'm getting this error in the command line:
    @file:///home/manuel/lib/desktop-components/components/custom/SplitterRow.qml:388: Error: Cannot assign a function to a property.

    This corresponds to this function:
    @ onWidthChanged: {
    // We need to update the layout:
    if (d.itemWidthGuard === true)
    d.itemWidthGuard = true

                // Break binding:
                width = 0
                // Restablish binding:
                width = function() { return parent.width; } // <<<--- line 388
                d.itemWidthGuard = false


    If I modify this line to @width = parent.width;@ the error does not occur anymore, but the strange behaviour of the splitters in the SplitterGallery.qml does not change.

    Does anybody have a clue how to fix this?

  • Hi,

    With the most current publicly released version of Qt (4.7.3), assigning a function to a property is an error. However, when QtQuick 1.1 is released (you can test this with HEAD of 4.7), assigning a function to a property will be allowed, and is the method to assign bindings in imperative code.

    Prior to this, you might be able to use the Binding element, or states, to accomplish the same thing (temporarily disable a binding).


  • Ok, thanks, mbrasser!

    I'm giving 4.8-TechPreview a try (I'm just compiling...)

  • hmm, the <Tab> keys are not working for the desktop-components.
    What's the best way to give the desktop-component developers feedback?

  • There is a qt-components mailing list (, as well as a section in JIRA for components ( -- you could try one of those.


  • manuelsch: Feel free to open bug reports as above. Make sure to mark them as QTCOMPONENTS and the module as "desktop" so we can find them. Tab keys don't work out of the box. The widget gallery demonstrates how you can enable it though. There is a known issue with the groupbox eating tabs at the moment.

    I think we will depend on Qt Quick 1.1 for the splitter as mbrasser pointed out. But this will eventually be available in Qt 4.7 as well. We will change the import statement to reflect this. It might have other issues though.

Log in to reply