Important: Please read the Qt Code of Conduct -

Row inside Row

  • Hi guys.. just started playing around with Qt Quick and QML :)

    This might be totally trivial but I haven't spend much time with QT Quick yet. In short I'm trying to create an abstraction of 2 panels and I want to put them in a Row enclosure. However both panels already specify a Row inside of them. So suppose there's the X panel which contains one Row with "X" text and 2 rectangles, and then there's the Y panel which contains one Row with "Y" text and 2 rectangles.

    If then on my main QML file I create a Row with the XPanel{} everything works fine (as in.. I see the "X" text and the 2 rectangles). As soon as I add the YPanel{} then they overlap which is not what I expected...

    It seems as if the top level Row cannot calculate the space of the 2 custom types which have in turn Row inside of them.. I'm sure I am missing something, it must be possible to do this..

  • Well I solved my own problem... turns out the XPanel and the YPanel have to specifically declare width and height in them at the top level type since it's not computed automatically from the other elements that constitute the panel which do have specified width and height.

    Then the Row element knows how to place them correctly wrapping XPanel and YPanel

Log in to reply