PDA

View Full Version : In a QTableVew, how to get text to flow into the adjacent cell?



dave2
11th January 2011, 19:42
Hi,

In Excel, if I do this:
* open a new, blank spreadsheet
* write "foo" in cell B1
* write "this is a long sentence" in cell A1
I can see:
* in cell A1: "this is a lo"
* in cell B1: "foo"

Then, if I delete the text ("foo") from cell B1, the text that was entered into A1 is now entirely visible:
* in cell A1: "this is a lo"
* in cell B1: "ng text"

Now, how could one get this behaviour in a QTableView?

I have tried severay things (such as setTextElideMode()), but in all cases the text entered in a cell that does not fit into it never shows up in the adjacent, textless cell. So, in the Excel example above, when cell B1 has no text, cell A1 would show "this is a lo", and cell B1 would show nothing.

Is there a simple way (that I missed) to get this behaviour in a QTableView?

I use Qt 4.6.2 on Windows.

-- dave

ChrisW67
11th January 2011, 20:19
Is QTableView::setSpan() what you are looking for?

dave2
11th January 2011, 21:08
Yes, that's it :)

Thanks!

-- dave