Results 1 to 4 of 4

Thread: Read File -> Use class

  1. #1
    Join Date
    Nov 2009
    Location
    Austria
    Posts
    30
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Read File -> Use class

    Hi,

    today I got a pretty tough question, or at least I think it's a tough one.

    Is it possible check the files in the project and somehow read those files, but not characters or whatever. I want to use to class which is created in this file. So if there is a file, I'll be able to use this class in this project, if not, then not. I know how to implement that in assembler, so i thought maybe it's possible to do that in QT too.

    I hope someone can make a rime out of what I'm saying and tell me wheter that's possible or not, and if so, how to do it.

    Thanks
    Tobias

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Read File -> Use class

    You want to use class in a file if the file is there, but not to use the class in the file if the file is not there? You want to use this at runtime rather than before the compilation and link steps.

    In which case, I would refer you to the Component Object Model, which allows you to export a class from a file and access that class from another file at run time.

  3. #3
    Join Date
    Nov 2009
    Location
    Austria
    Posts
    30
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Read File -> Use class

    Thanks for the quick reply.

    Just read the article, sounds good, but how do I use it in QT, if I didn't get anything wrong I have to create special classes that suport this COM can i use those classes then without any trouble?
    Do you know any whole code examples? That would be awesome to understand how it's implemented.

    By the way, how do I use reflections in QT?

    tobi

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Read File -> Use class

    That depends on the target OS for your application, as well as the data you wish to exchange with this other class. If the target app is Linux, or other Unix-like OS, then DBus may be preferred solution. Last I heard about DBus on Windows was that it was still in its infancy.

    I'm not sure how you would use QObject-derived classes with COM (signals and slots across COM - I don't know if thats even possible), but data and methods should be easy enough.

    Checkout the Introduction to COM and Introduction to RPC

    (Note that the introduction to COM doesn't describe how to write your own, but is a good introduction to see if it fits your requirements)

Similar Threads

  1. Read binary from file
    By weldpua2008 in forum Newbie
    Replies: 2
    Last Post: 3rd April 2009, 23:50
  2. is qt phonon can read realmedia file and divx file
    By fayssalqt in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2009, 15:42
  3. Replies: 3
    Last Post: 27th December 2008, 19:34
  4. Replies: 1
    Last Post: 20th June 2008, 18:43
  5. Read An Xml File
    By Alienxs in forum Qt Programming
    Replies: 3
    Last Post: 5th January 2007, 00:28

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.