PDA

View Full Version : Multi-column Q3ListView and horizontal scrolling



bmahf
14th March 2014, 17:51
Hi all,

Asked this on StackOverflow, but no bites. Thought I'd see if anyone here has knowledge of the Q3ListView class available in Qt 4.7. Looking for an answer to the question of getting horizontal scrolling to happen in a Q3ListView with multiple columns. I assume Q3ListView was used as a quick way to upgrade to 4.x. Legacy code, and I am tasked with making this thing horizontally scrollable.

The list view has two columns, the first of which contains titles for the content to the right, and so it always shows full text, as none of the text is very long. The second column can have text that is wider than my 24" screen can show (seen when I roll over it and view the tool tip).

The Q3ListView object was created in Designer with both vScrollBarMode and hScrollBarMode set as Auto (the default). Since the number of entries is quite large, the vertical scrollbar always shows and I can scroll up and down. When I see data in the second column that is too long for the width available, it always has an ellipsis (...) at the end with no horizontal scrollbar shown. If I change the definition of the horizontal scrollback in Designer to AlwaysOn, I see the horizontal scroll bar, but it's greyed, and has no handle, even though there is text too long for the viewable area.

I'm just wondering how I can get a functioning horizontal scroll bar for my Q3ListView that will be able to scroll to show the full text of the second column. Any suggestions?

--

P.S. - Just tried something new. I called the setColumnWidthMode() function on the second column of the Q3ListView object as follows:

myUi.myValueList->setColumnWidthMode(1, Q3ListView::Maximum);
Didn't make any difference. There is still an ellipsis applied at the end of long text. I tried putting this inside a QScrollArea, but still no go.

anda_skoa
15th March 2014, 15:43
Have you tried changing the Q3ScrollView::ResizePolicy?

Depending on how complicated the code around the view is, it might be worth to consider porting to QTreeWidget

Cheers,
_