Results 1 to 4 of 4

Thread: Qt4.4 QListView paragraph

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Qt4.4 QListView paragraph

    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 :
    Qt Code:
    1. painter->save();
    2.  
    3. QTextDocument document;
    4. document.setHtml(mText);
    5. document.setPageSize(QSize(rect.width(), rect.height()));
    6.  
    7. QAbstractTextDocumentLayout::PaintContext context;
    8. painter->translate(rect.x(), rect.y());
    9. document.documentLayout()->draw(painter, context);
    10.  
    11. painter->restore();
    To copy to clipboard, switch view to plain text mode 

    When resizing my widgets : the view goes blank, until resize is completed.
    Is there a way to avoid this ?
    Last edited by bunjee; 12th May 2008 at 16:40.

  2. #2
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt QListView paragraph

    Qt Code:
    1. // Resizing mode
    2. setResizeMode(QListView::Adjust);
    To copy to clipboard, switch view to plain text mode 

    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 ?

  3. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt4.4 QListView paragraph

    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 ?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt4.4 QListView paragraph

    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.

  5. The following user says thank you to wysota for this useful post:

    bunjee (14th May 2008)

Similar Threads

  1. Replies: 2
    Last Post: 8th April 2008, 10:35
  2. QListView word wrap
    By serega in forum Qt Programming
    Replies: 17
    Last Post: 30th August 2007, 03:13
  3. QDialog / QListView problem
    By harakiri in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2007, 18:31
  4. Subclass QListView to show two colums in one
    By Mookie in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2007, 02:12
  5. Keeping focus at bottom of QListView
    By jakamph in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2006, 14:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.