PDA

View Full Version : Adding rows to a grid layout? or is there another way?



aatwo
21st March 2011, 16:38
Hey guys :) Sorry in advance if this is a simple question, but I have been using QT creators drag and drop interface designer to design all of my GUI's up until this point.

I am creating a simple file editor that allows the user to edit files in HEX. For example the user could open a file, and for each block of 16 bytes of data found in the file I wish to create a row of 16 QLineEdits.

So my question is this: is there a way to add a row to a grid layout? I can easily detect the size of the file and determine how many rows and columns I need. And I can also easily apply the file contents to the line edits. But how can I add and remove rows from the grid layout and add line edits to the grid layout cells?

Regards aatwo.

Rhayader
21st March 2011, 19:58
Start by reading about the QGridLayout,
and then examine the example from the reference in http://doc.qt.nokia.com/4.7/layouts-basiclayouts.html.
Basically all you need is an addWidget() function in a loop.