How to set the color of margins in a QGridLayout? I want to show the different columns and rows separately by placing lines between various rows and columns.
In other words, how to display items in grid-layout such that they are in a table.
How to set the color of margins in a QGridLayout? I want to show the different columns and rows separately by placing lines between various rows and columns.
In other words, how to display items in grid-layout such that they are in a table.
QGridLayout doesn't draw anything, it just calculates the layout. So the QGridLayout itself cannot draw gridlines for you.
The easiest way is to put a QFrame to each of your QGridLayout's cell and move your content to these QFrames. In WinXP, setting QFrame's frameShape to Box and frameShadow to Plain, you get simple boxes.
You could also create a new widget that draws the gridlines according to the layout that the QGridLayout calculates. By using QGridLayout::itemAtPosition
you can get a QLayoutItem for each cell.