Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get a list of subdirectory and file in special path as soon as possible
Forum Updated to NodeBB v4.3 + New Features

Get a list of subdirectory and file in special path as soon as possible

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    harward
    wrote on last edited by
    #1

    how i can get a list of files and subdirectories in special path (for example D://mainDirectory) by windows system file
    or any other way that it is avalable get list of subdirectories and files as soon as possible.i want create an xml file by this list.
    i write a class by Qt libraries it work well when subdirectorys and files are not many but when i give a path consist of 2600 files and 395 subfolder dont work well and make a heavy process (cpu & memory usage) and program not responding
    if you have a good idea help me plz;

    I have a code editor with line number area. How i can change cursor position an it's anchore to nth textblock ( for example 1200th textblock).i check block by block and use
    QTextCursor::moveposition (QTextCursor::Down , QTextCursor::MoveAnchor) 1200 times;
    but there is a problem when the line number of codes is over 1500 it work with too delay becouse it check 1500 textblock and perform 1500 times "QTextCursor::moveposition (QTextCursor::Down , QTextCursor::MoveAnchor)"
    now you suppose we have over 8000 lines of codes what happend?????
    please help me an give a good solution;

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      Please tell us more details. ;-)

      1. Are you using Qt's Api or OS's API?

      If OS's API works very fast while Qt's QDir works rather slow, it is very likely to be a bug of Qt.

      1. Are you using QTextEdit or QPlainTextEdit?

      If you are using the formal, you can try the latter.

      Debao

      1 Reply Last reply
      0
      • H Offline
        H Offline
        harward
        wrote on last edited by
        #3

        thanks R.Herder

        1. it's not matter for me Qt’s Api or OS’s API only i want speed in getting list of files and subdirectories,
          2-it's QPlainTextEdit.infact i want provide a goto line action
        1 Reply Last reply
        0
        • H Offline
          H Offline
          harward
          wrote on last edited by
          #4

          oh
          please reply

          1 Reply Last reply
          0
          • S Offline
            S Offline
            shanek
            wrote on last edited by
            #5

            Use QDirIterator instead of QDir.
            It uses less memory.
            If you don't call fileInfo() then you can avoid expensive "stat" operations (assuming you only need the filenames)

            This is somewhat optimised in Qt 4.8, so if you're using 4.7 you may consider upgrading.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved