QTableWidget or QListWidget
I have a question about which one I should use for my project.
Essentially I am going to obtain a QStringList of tokened data.
When I iterate through this list I am going to tokenize that string into 3 strings.
Graphically speeking, I basically want a list with three columns.
Each iteration adds a row, the column data is what is tokenized from the string.
I have used the QTableWidget so far. I am creating headings for the columns... something I don't think QListWidget will do. I need those. BUT, QTableWidget seems to be "cell" oriented. When I click on a cell, I want the row highlighted. This makes me wonder if it needs to be a QListWidget instead.
Do you guys have any good advice on what I should do?
Essentially when you select a row, there will be a number of functions that you can call... like pressing a button that will delete that row or perform various routines pertaining to the database record represented by that row.
Re: QTableWidget or QListWidget
Just set selectionBehavior property to QAbstractItemView::SelectRows.
Re: QTableWidget or QListWidget
Thanks a lot Jacek for that advice. I didn't see that option.
I have one last question... if I set my column size to 3, for example, can I store data about that row in column 4?
Re: QTableWidget or QListWidget
Quote:
Originally Posted by
bpetty
if I set my column size to 3, for example, can I store data about that row in column 4?
Yes, but you'll have to hide that fourth column. Better use QTableView and a custom model --- you'll have more control over the data.