简体   繁体   中英

Creating a user table in Qt

I want to add to my project a possibility of a user creating his own table, where he/she could choose the number of columns, add their name and choose the type for each column. The idea is, that value of a number is got from lineEdit, names as well and type from a comboBox. How can I do it in QtCreator using c++?

I'm really new in that, so, I'm open to any option and I'd like to have a direct answer with an explanation. Thanks!

If you want create a table with "QTableWidget" you can make this with

QTableWidget tableWidget = new QTableWidget(this);
tableWidget->setColumnCount( numberCols );

now you can set header of columns with:

tableWidget->setHorizontalHeaderLabels(m_tableHeader);

where tableHeader is a array of titles.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM