So, I have a QFrame
with its layout set as a QGridLayout
.
Within this layout I have tiles in rows of 16 which represent something of a palette.
I want this grid of tiles to be separated by lines, like a grid should be. I can do this easily with the tiles' paintEvent
s.
However, the obvious problem is that between the tiles, the lines are doubled up. When I scale this up for other applications, the difference becomes even more noticeable.
So, is there a way to create a gridline overlay for my QFrame
? I have considered converting the whole thing to a view/scene solution, and using drawForeground
, however this seems like a completely inappropriate use of the paradigm.
Thanks for any assistance!
Put the QFrame
into a QGridLayout
, then put a custom QWidget
with transparent background and paintEvent
that paints the grid on top of it (same QGridLayout
position).
Or since you already have a QGridLayout
, just put the custom QWidget
in that, above the tiles, filling the entire grid.
A side note, are you sure you want QFrame
there, or if just QWidget
would do? Just saying, because with QFrame
you get that 1990's look into your UI... If you do want that then go ahead, just saying.