Set Headers in Qlistwidget and Qtablewidget
-
wrote on 9 Apr 2019, 17:42 last edited by tactical77 4 Sept 2019, 17:45
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.
-
wrote on 10 Apr 2019, 07:41 last edited by
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?
wrote on 10 Apr 2019, 08:11 last edited by@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"?wrote on 10 Apr 2019, 10:08 last edited by@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...
wrote on 10 Apr 2019, 14:10 last edited by@jsulm
Thanks it works.
4/7