Results 1 to 3 of 3

Thread: Batch image process freezes the GUI

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Batch image process freezes the GUI

    Hi!

    I have an application that aims to resize some pictures, listed in a QTreeWidget.
    If I try to do it with a loop in the MainWindow (with a large number of pictures) it causes the GUI to freeze:
    Qt Code:
    1. for (int i = 0; i < ui->listTreeWidget->selectedItems().count(); i++)
    2. {
    3. QImage image(ui->listTreeWidget->selectedItems().at(i)->text(5));
    4. image.save("test" + QString::number(i), ui->formatComboBox->currentText().toLower().toAscii(), 100);
    5. }
    To copy to clipboard, switch view to plain text mode 

    I know that a solution is to use a separate thread, so the GUI won't freeze anymore. I know how to do this, but I can't access the QTreeWidget properties from the QThread, and so I can't load the QImage.
    Is there a way to do this? Maybe pass some argument to the QThread from the MainWindow?
    Or is there any other solution except using a separate thread?

    Thanks for help

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

    Default Re: Batch image process freezes the GUI

    Have you read this?
    [wiki]Keeping the GUI Responsive[/wiki]
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    Lymphatus (17th January 2011)

  4. #3
    Join Date
    Jan 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Batch image process freezes the GUI

    No, I didn't read that article
    Thank you very much!

Similar Threads

  1. Blinking problem with QListWidget with batch
    By visiray in forum Qt Programming
    Replies: 0
    Last Post: 12th December 2010, 18:35
  2. QProcess running batch file
    By Vit Stepanek in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2010, 14:23
  3. Batch translation using a .ts as source
    By bender86 in forum Qt Tools
    Replies: 4
    Last Post: 21st July 2009, 09:52
  4. distclean batch file
    By talk2amulya in forum Qt Programming
    Replies: 0
    Last Post: 11th April 2009, 12:19
  5. Batch update fails with QSqlQuery
    By William Wilson in forum Qt Programming
    Replies: 2
    Last Post: 20th July 2007, 15:36

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
  •  
Qt is a trademark of The Qt Company.