Set Headers in Qlistwidget and Qtablewidget
-
Hi,
I'm pretty new to qt and have to finish some stuff for school. I figured out how to add items to Qlistwidget and Qtablewidget but I need to have headers similar to the ones in the picture.
I also have already a cli program from my last homework which should be used to read in data from a text file and store it in objects and then in vectors. Can I just use it and
export the data into Qlistwidget? -
Hi and welcome to devnet,
Do you mean the text ? If so, yes, you can use QTableWidget::setVerticalHeaderLabels.
-
Thanks it worked. I have another question. I know how to add strings in qlistwidget but I need to add a string and some doubles and integers all in the same row?
-
Thanks it worked. I have another question. I know how to add strings in qlistwidget but I need to add a string and some doubles and integers all in the same row?
@tactical77
QListWidgetItem
s are "typically" used to display text, icon & checkbox. Are you sure you don't mean to use aQTableWidget
for "add a string and some doubles and integers all in the same row"? -
@tactical77
QListWidgetItem
s are "typically" used to display text, icon & checkbox. Are you sure you don't mean to use aQTableWidget
for "add a string and some doubles and integers all in the same row"?@JonB
I basically have some client data which is stored in objects and I have to create both a qlistwidget and a qtablewidget. Probably just in order to learn to use both of them. But each one has basically the same data output. -
Thanks it worked. I have another question. I know how to add strings in qlistwidget but I need to add a string and some doubles and integers all in the same row?
@tactical77 Use https://doc.qt.io/qt-5/qstring.html#number-2 and https://doc.qt.io/qt-5/qstring.html#number-6 and concatenate the strings...
-
@tactical77 Use https://doc.qt.io/qt-5/qstring.html#number-2 and https://doc.qt.io/qt-5/qstring.html#number-6 and concatenate the strings...
@jsulm
Thanks it works.