Results 1 to 20 of 21

Thread: How to use a file to setup a QProgressDialog, Thanks

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to use a file to setup a QProgressDialog, Thanks

    could you show the written file..i wanna see where it is missing..or u can use qDebug to print all lines that u r reading and showing...then show me the output

  2. #2
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use a file to setup a QProgressDialog, Thanks

    Quote Originally Posted by talk2amulya View Post
    could you show the written file..i wanna see where it is missing..or u can use qDebug to print all lines that u r reading and showing...then show me the output
    Thanks!
    for example, the inputfile format is :
    20040101 C 0 C 0 C 0 ENE 10 -1 11 0 0 -1 11 0 0
    20040102 WSW 10 NW 30 NNW 30 NNW 10 -1 7 0 0 -1 6 0 0
    20040103 NNW 20 C 0 SSE 20 SE 30 -1 8 0 0 -1 0 0 0
    20040104 C 0 NE 10 S 20 SSW 10 -1 7 6 0 -1 0 0 0
    20040105 E 10 C 0 S 20 C 0 -1 9 0 0 -1 0 0 0
    20040106 E 10 NNW 20 SW 10 NNW 10 -1 10 6 0 -1 10 0 0


    but the output one is only one line when the input data size is small.:
    20040101 C 0 C 0 C 0 ENE 10 -1 11 0 0 -1 11 0 0


    How to use a qDebug() in a GUI programming? I can make it in a console window, but fail in a GUI one. Maybe it's to fast, how I can make it pause? like system("pause");

    Thanks!

  3. #3
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use a file to setup a QProgressDialog, Thanks

    Qt Code:
    1. while(file.pos()<file.size()) //-->
    2. while(in.pos()<file.size())
    To copy to clipboard, switch view to plain text mode 

    Somebody had helped me to solve the problem.


    By the way, it's that any way to reuse output file name and QTextStream name? Such as:
    Qt Code:
    1. if(month!=list.at(0))
    2. {
    3. QFile monthFile(outDirName+QDir::separator()+list.at(0)+".txt");
    4. QTextStream monthOut(&monthFile);
    5. month=list.at(0);
    6. }
    7.  
    8. monthOut<<list.at(0)<<'\t'<<list.at(1)<<'\t'<<list.at(2)<<"\n";
    To copy to clipboard, switch view to plain text mode 

    In my previous standard C++ code, I do it in this way:
    cpp Code:
    1. while(getline(ifile, str))
    2. {
    3. filename = str.substr(0, 6)+".txt";
    4. ofstream ofile(filename.c_str(), ios_base::app);
    5. str.erase(0,10);
    6. ofile << str << endl;
    7. ofile.close();
    8. }
    To copy to clipboard, switch view to plain text mode 

    But I do think that reopen and reclose a file in this way is not a wise choice. But i can not work out a better method.

    There are lots of problem to learn in practical experiment. Thanks sincerely to all the friends help me.
    Last edited by wysota; 22nd February 2009 at 07:54. Reason: missing [code] tags

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

    Default Re: How to use a file to setup a QProgressDialog, Thanks

    If you store the name in some variable, you can use it later. Or you can call QFile::fileName() to retrieve the name from the QFile object.
    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. Apparent error in QtCore/quuid.h
    By cwp500 in forum Qt Programming
    Replies: 11
    Last Post: 18th December 2008, 20:51
  2. Can you specify a file engine?
    By skimber in forum Qt Programming
    Replies: 2
    Last Post: 18th September 2008, 15:54
  3. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  4. file renaming on windows
    By jdd81 in forum Qt Programming
    Replies: 9
    Last Post: 2nd October 2007, 19:41
  5. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

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.