Results 1 to 5 of 5

Thread: QTreeWidget row updates inside QDialog

  1. #1
    Join Date
    Oct 2008
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTreeWidget row updates inside QDialog

    Hello!

    I have a problem regarding udpates to a QTreeWidget inside a QDialog.

    The dialog pops up and prompts the user to select a file. This file is read and for each line I want the data to be displayed inside a QTreeWidget. So far so easy.

    But, I want each row to be displayed as soon as it is read from the file, but at preset the treeWidget blocks until the whole file is read - only then is all the data displayed.

    I'm sure there's an eay fix for this -but I can't for the life of me find it! I've tried various modality options, calls to QCoreApplication:rocessEvents(), even using threads (slght overkill) - but nothing seems to work.

    Any clues anyone?

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeWidget row updates inside QDialog

    How are you populating the treewidget ? can we see the code ?

  3. #3
    Join Date
    Oct 2008
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeWidget row updates inside QDialog

    The treeWidget is populated as ..
    Qt Code:
    1. QTreeWidgetItem* topLevelItem = new QTreeWidgetItem (treeWidget);
    2. treeWidget->addTopLevelItem(currItem);
    3.  
    4. for (read line from file) {
    5. QTreeWidgetItem* item = new QTreeWidgetItem (topLevelItem);
    6. item->setText(0, "field 1 from file")
    7. item->setText(1, "field 2 from file")
    8. treeWidget->scrollToItem(item);
    9. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTreeWidget row updates inside QDialog

    you can create a thread in which you can read data from file line by line and then you can send signal with line which has been read from file to your dialog and then add this line to QTreeWidget.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeWidget row updates inside QDialog

    Try calling treewidget->update() in the for loop
    Am not sure though if it wil work

Similar Threads

  1. Drag and Drop item inside QTreeWidget
    By nina1983 in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2008, 11:43
  2. QDialog inside QWizardPage
    By baray98 in forum Qt Programming
    Replies: 1
    Last Post: 9th May 2008, 07:28
  3. ScrollBar inside QTreeWidget is Blurring on Scrolling
    By santosh.kumar in forum Qt Programming
    Replies: 0
    Last Post: 11th April 2008, 14:33
  4. Resizing a QTreeWidget inside a layout
    By bruccutler in forum Qt Programming
    Replies: 11
    Last Post: 27th March 2007, 15:35

Tags for this Thread

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.