Results 1 to 8 of 8

Thread: Read the file into

  1. #1
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Read the file into

    i want to read WEBOPEN in config.qt file. can you help me?
    Qt Code:
    1. QString Urlweb;
    2. static const ConfigFile *config = new ConfigFile("config.qt");
    3. config->readInto(Urlweb,"WEBOPEN");
    4. QWebView *view = new QWebView;
    5.  
    6. view->load(QUrl(Urlweb));
    7. view->show();
    8. view->setWindowState(Qt::WindowFullScreen);
    To copy to clipboard, switch view to plain text mode 

    config.qt file

    WEBOPEN=http://www.google.com.tr

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Read the file into

    What is ConfigFile? What does readInto() do? Have you seen QSettings class?

  3. #3
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Read the file into

    a class ConfigFile . reanInto a reading function. I can not access the file. How can I use QSettings Class?

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Read the file into

    then you have to show the code for reanInTo() function

  5. #5
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Read the file into

    Qt Code:
    1. template<class T>
    2. bool ConfigFile::readInto( T& var, const string& key ) const
    3. {
    4. mapci p = myContents.find(key);
    5. bool found = ( p != myContents.end() );
    6. if( found ) var = string_as_T<T>( p->second );
    7. return found;
    8. }
    9.  
    10.  
    11. template<class T>
    12. bool ConfigFile::readInto( T& var, const string& key, const T& value ) const
    13. {
    14. mapci p = myContents.find(key);
    15. bool found = ( p != myContents.end() );
    16. if( found )
    17. var = string_as_T<T>( p->second );
    18. else
    19. var = value;
    20. return found;
    21. }
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Read the file into

    What is it exactly that you want from us? I understand you have some class and you are doing something with it but what does Qt have to do with it and what exactly is the problem?

  7. #7
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Read the file into

    common man, how i the whole world i would know what mapci or Config(to start with) means.. ? we are not gods.

  8. #8
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Read the file into

    I found a bug. the problem is ConfigFile class. Thank you..

Similar Threads

  1. How to read a XML file that uses UTF-8?
    By PaladinKnight in forum Newbie
    Replies: 2
    Last Post: 10th April 2010, 13:52
  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: 1
    Last Post: 20th June 2008, 18:43
  4. read file in b/w mode
    By eric in forum Qt Programming
    Replies: 3
    Last Post: 11th December 2007, 20:35
  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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.