GridLayout problems
-
I'm having two related problems with
GridLayout
objects, both revolving around the use ofLayout.fillWidth
andLayout.fillHeight
to get constant sized cells that their contents can anchor themselves to. I believe they also apply toRowLayout
andColumnLayout
First, some of my children use
Layout.columnSpan
orLayout.rowSpan
. But when I do this, even though the extra columns or rows are "occupied", thefillWidth
orfillHeight
doesn't seem to apply to the extra columns or rows. If this is W.A.D, I can't imagine why anyone would D. it this way--it looks like a bug to me. My "solution" is to create dummy items that force the other columns or rows to be filled. But this isn't without its problems. For instance, if I have aGridLayout
with five columns, and I want to attach a child that is five columns wide (say as a title in the top row), and some of the columns are otherwise unoccupied, I can create a dummyItem
with itsLayer
properties set to occupy those columns. But if I can't find a row in which there isn't something already spanning those columns, then the item clashes with one of the real items I want to display. This "works", but it produces an error message in the log, e.g.,QGridLayoutEngine::addItem: Cell (0, 4) already taken
.BTW, I've found that I only need to insert enough dummy single-cell items to define all the grid boundaries. In the above example, I'd need a dummy in columns 1 and 3, because that's enough to define boundaries 0-1, 1-2, 2-3, and 3-4:
0 1 2 3 4 +---------------------------------------+ | colSpan = 5 | +-------+-------+-------+-------+-------+ | dummy | | dummy | +-------+ +-------+
Second, I specify a
spacing
on theGridLayout
, but sometimes I want a double-wide gap, so I treat that as just another row or column that has nothing in it, and that should therefore have a zero height or width. But when I do that, I don't get the extra spacing--it acts as if the row or column just doesn't exist. Again, W.A.D.? But why? My "solution" is to place a dummyItem
into the empty row with itsLayout.fillWidth
set, but obviously notLayout.fillHeight
(or the opposite for an empty column).These are pretty ugly hacks, they junk up the source code, and they're error-prone. Does anyone have any better ideas on how to do either of these things? Does anyone think they could be called bugs?
-
@Lucinda183 WTF?
-
Hi,
It was spam.