0
votes

I use a subclassed QTableWidget with QTableWidgetItems in cells to display certain data. In the first row, I have a set of numbers separated by new lines in each cell. My problem is that when I increase font size/decrease cell size, some lines completely disappear, allthough the cell is definitely high enough to contain them.

This usually appears when there is a 2-digit number with some other lines under it and (probably) the font size is greater than the box width can match. I have the elide mode set to none to suppress the "three dots" that appear when this happens.

this->setTextElideMode(Qt::ElideNone);

The first row is resized by

this->resizeRowToContents(0); this->setRowWidth(0, this->rowWidth(0) + 10);

so that its high enough.

However, the numbers keep on disappearing. Example shown here, note the font size change and missing numbers.

http://www.stud.fit.vutbr.cz/~xnavra23/TWIbug1.png

http://www.stud.fit.vutbr.cz/~xnavra23/TWIbug2.png

I'm starting to be quite desparate about this...any help highly appreciated.

2

2 Answers

0
votes

Just to investigate the problem, try:

  1. Make shure that string is correctly created (2,5,10,3) and not (10,3)
  2. Try letters instead of numbers to make shure that they are shown
  3. Try use 3digits nuber alongside with 2digits and see what is happened
  4. May be workaround this by using 01,02 numbers?
0
votes

Try resizeColumnsToContents() instead of setColumnWidth. If that doesn't work, try calling resizeColumnsToContents() before resizeRowToContents(0).
By the way, is there any reason for calling resizeRowToContents(0) instead of resizeRowsToContents() (note the different name)?