Segolas
Segolas

Reputation: 575

c++, insert only numbers (double) in a QTableWidget

I'm creating a sort of little spreadshirt and I need to insert only numbers in all the cells of a column.

Is there anyway to do this just with the tablewidget or do I need to "fill" table with LineEdit and then restict on some way the LineEdit input?

Can someone point me to the right direction?

Upvotes: 0

Views: 2296

Answers (1)

spbots
spbots

Reputation: 1553

After perusing some of the documentation, it looks like you might have to use QLineEdit widgets and setValidator to a QDoubleValidator. This is a fairly simple way to accomplish what you want, but for more complex spreadsheets you might need to get into something like a QTableView and get down and dirty in Qt's Model/View framework.

Upvotes: 1

Related Questions