0

I have an issue usign QTableWidgetItem. I normally use the QTableWidget like this

    this->setItem(i, j, new QTableWidgetItem());
    this->item(i, j)->setText(string);

The column I'm writing to is narrow, only about 20px. I need to write 2 digits in there and from the definition I cannot resize the column.

The problem is that once the text overlaps the column width, it totally disappears and only three dots (or even nothing) appear instead. Can I suppress this behavior? I dont mind if there will be 1-2px overlap/clip, but I'm definitely not comfortable with the text disappearance.

Thanks for any help.

EDIT:

Well, after a couple of tries, I must say that the TextElide think works, however, now I face another problem. Sometimes, when there are more lines in the QTableWiddgetItem, the bottom lines just disappear and only the top one is visible. Any suggestions why this may happen?

EDIT 2:

It looks like this....note that the only difference between the images is a bigger font size. The cells are definitely high enough to containt all the text. http://www.stud.fit.vutbr.cz/~xnavra23/TWIbug1.png http://www.stud.fit.vutbr.cz/~xnavra23/TWIbug2.png

4

2 回答 2

0

请参阅textElideMode属性。this->setTextElideMode(Qt::ElideNone)将删除点。

于 2011-04-26T14:17:14.583 回答
0

您是否尝试过设置项目的 sizeHint ?看到这个

于 2011-04-25T19:49:34.750 回答