PDA

View Full Version : Qt4.4 QListView paragraph



bunjee
12th May 2008, 16:04
Hey there,

I'm using a QListView to display a list of QTextDocument based paragraphs.

Everytime I resize my view I have to call : QAbstractListModel::reset(), to update the paragraph's geometry.

here is my paint delegate content :

painter->save();

QTextDocument document;
document.setHtml(mText);
document.setPageSize(QSize(rect.width(), rect.height()));

QAbstractTextDocumentLayout::PaintContext context;
painter->translate(rect.x(), rect.y());
document.documentLayout()->draw(painter, context);

painter->restore();

When resizing my widgets : the view goes blank, until resize is completed.
Is there a way to avoid this ?

bunjee
12th May 2008, 17:00
// Resizing mode
setResizeMode(QListView::Adjust);

This solved the problem for the blank flickering.

Now I have another problem :
- I have my QListView inside a QSplitter.
- When I do have 2 paragraph items or so in my view, the display is fine.
- When I do have 10 or so paragraph items the display is laggy when I drag the splitter left or right.
- When resizing the window itself : no problem.

Has anyone experienced that ?

bunjee
14th May 2008, 21:43
Using my listView I get white flickering.

This happens when I do subsequent reset() operation. Is there a way to avoid QListView blank paiting flickers ?

wysota
14th May 2008, 22:29
Yes, don't call reset :) It's very computation intensive. Try using some other approach. The recent versions of the delegate can signal the view that the size hint of an item might have changed.