Results 1 to 4 of 4

Thread: Display files one by one for particular directory - Just like antivirus scanning.

Hybrid View

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

    Default Re: Display files one by one for particular directory - Just like antivirus scanning.

    What do you mean "one by one"? Doesn't the code you posted do that already?
    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.


  2. #2
    Join Date
    Jul 2012
    Posts
    3
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Display files one by one for particular directory - Just like antivirus scanning.

    mean of one by one is that second file must be shown after a one second of first file shown..

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

    Default Re: Display files one by one for particular directory - Just like antivirus scanning.

    Quote Originally Posted by Gurpreet View Post
    mean of one by one is that second file must be shown after a one second of first file shown..
    Hmmm.... why?

    Qt Code:
    1. class InsertToListDelayer : public QObject {
    2. Q_OBJECT
    3. public:
    4. InsertToListDelayer(QStringList items, QListWidget *list, int delay = 1000, QObject *parent = 0) : QObject(parent) {
    5. m_items = items;
    6. m_list = list;
    7. m_delay = delay;
    8. m_timer = -1;
    9. }
    10. public slots:
    11. void start(int delay = -1) {
    12. if(delay > 0) m_delay = delay;
    13. m_timer = startTimer(m_delay);
    14. }
    15. void stop() {
    16. if(m_timer != -1) { killTimer(m_timer); m_timer = -1; }
    17. }
    18. signals:
    19. void finished();
    20. protected:
    21. void timerEvent(QTimerEvent *te) {
    22. m_list->addItem(m_items.takeFirst());
    23. if(m_items.isEmpty()) {
    24. stop();
    25. emit finished();
    26. }
    27. }
    28. private:
    29. int m_timer, m_delay;
    30. QStringList m_items;
    31. QListWidget* m_list;
    32. };
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. InsertToListDelayer *del = new InsertToListDelayer(lsdir.entryList(), lw, 1000, this);
    2. del->start();
    3. connect(del, SIGNAL(finished()), del, SLOT(deleteLater()));
    To copy to clipboard, switch view to plain text mode 
    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.


Similar Threads

  1. List all XML files in a directory
    By ouekah in forum Newbie
    Replies: 4
    Last Post: 30th August 2015, 08:47
  2. display a directory using qtreewidget
    By kamlmish in forum Newbie
    Replies: 2
    Last Post: 19th December 2010, 12:37
  3. Replies: 1
    Last Post: 20th April 2010, 08:14
  4. Display files of a Directory
    By mansu in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2009, 15:08
  5. directory and files
    By rmagro in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2008, 13:40

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.