Results 1 to 20 of 46

Thread: How to work with files

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2015
    Posts
    125
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Unhappy How to work with files

    I am newbie to Qt. So I would like to ask how create the app that would display (indx) the file system (or some directory). Then it should write this file to XML (with name, size etc). This app should also has capability to search for file. So I want to one how to create such application, what components of Qt I should use, where I can refere for similar examples, especially for this 3 issues and creating such interface. How much work it needs and how many files I should create?

  2. #2
    Join Date
    Oct 2014
    Posts
    7
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to work with files

    Sounds like homework. What have you done so far?

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to work with files

    Sounds like homework.
    No! Someone wouldn't actually post a homework problem here and expect us to feed them the solution, would they?

  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: How to work with files

    I don't think they would. Everybody knows rules of this forum forbid to post solutions to homework.
    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.


  5. #5
    Join Date
    Mar 2015
    Posts
    125
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to work with files

    Really I can do it at home, at library. But it is not the homework, but the presupposition for the potential employment. But I am familiar with C++ just theoretically, and now I need to write this app even in unnnown for me, Qt (now I just try to free the space for Qt installation). So I would like to have some help here -- at least theoretically. How much files (.cpp, .ui, .h) I should create here, what components for the UI I need use, and how they should be connected with the code itself. What IDE I need- f.e. Codeblocks or Qtcreator. And the main--how to index the file system in the whole or locally (in some directory), how transfer this file description to xml, and search it (by name probably)? So I do not ask to do it for me, but theoretically as far as possible to explain and refer to most appropriate similar code --as I have just few days for it and it is very important for me.

  6. #6
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to work with files

    But I am familiar with C++ just theoretically
    Sorry, but I think it will be almost impossible to use Qt if you don't have any practical experience with C++.

    Anyway, as for the IDE, I'd choose QtCreator.
    First I'd try to get familiar with Qt by studying some simple examples, you will have plenty of them in your Qt installation folder.
    As for your main task, here are some useful classes: QDir, QFileInfo, QFileDialog, QFileSystemModel, QXmlStreamWriter.
    Regarding the ui, I'd start with something very simple, like having just single button to browse for existing folder and tree view to display the folder contents, and then you can build more complicated functionality based on that.

  7. #7
    Join Date
    Mar 2015
    Posts
    125
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to work with files

    http://het.as.utexas.edu/HET/O_M/Ope...-filetree.html -- Can such files be some patterns for the app structure? Or this-- http://doc.qt.digia.com/qt-5.2/qtxml...e-example.html -- for the displaying file system? I think the indxing should be done in some simple way or it need some particular file? Then I need QXml probably with QFileInfo function. And as far as I know it superficially the search should be done by Xqueries as I did not found any information on search in qt files.Then I need the outlook of my UI -- probably the button for the indeexing, converting to xml, and the field for the search and field for the results for thee tasks (at least for the last one). Then the structure of app is also important except the code itself as I was tasked that such app should be relatively easy in Qt?

  8. #8
    Join Date
    Mar 2015
    Posts
    125
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to work with files

    Any suggestions? Would show any framework for this app, at list nessesary functions, then I would handle it be myself?

  9. #9
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to work with files

    Your Qt installation comes with a whole slew of examples. Look at the DirView, File System, and maybe the XML Schema Validation examples. There is a Getting Started with Qt Widget tutorial, also installed with your Qt distro.

  10. #10
    Join Date
    Mar 2015
    Posts
    125
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to work with files

    But what the indexing of file system means -- how I should do it exactly? Should I do some DB of all files of disk or directory -- or directory files should be dislayed in some UI window with some files pictograms as usual windows?
    And I have recently seen that search aslo could be done by QFileInfo, despite it has such attributes as size, path of files.
    What main fuctions I should use: funct1 (Q...1), func2 (Q..2) XML, func3 (Q..2) search?
    If I use Qcreator -- how connect it with the code? And the important questions is shoudl I use a lot of signals or slots as this constructions is new for me?
    So the first task--hwo to index the file system ...then it would be more understandable for me as to do evrything else

  11. #11
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to work with files

    What main fuctions I should use: funct1 (Q...1), func2 (Q..2) XML, func3 (Q..2) search?
    If I use Qcreator -- how connect it with the code? And the important questions is shoudl I use a lot of signals or slots as this constructions is new for me?
    With your lack of experience in Qt I suggest you to start with something basic, like selecting a file and displaying its stats (name, size, creation date etc) in a simple widget. You know, "Rome was not built in a day."

Similar Threads

  1. Replies: 1
    Last Post: 14th April 2011, 09:58
  2. Replies: 1
    Last Post: 8th April 2011, 13:45
  3. Work with directory and files
    By amiref in forum Qt Programming
    Replies: 4
    Last Post: 24th March 2011, 09:26
  4. Replies: 4
    Last Post: 11th January 2011, 13:27
  5. Pack all .qm files into .qrc, why doesn't work???
    By yxmaomao in forum Qt Programming
    Replies: 3
    Last Post: 8th May 2008, 19:38

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.