Results 1 to 4 of 4

Thread: File size limitation in qt

  1. #1
    Join Date
    Oct 2014
    Posts
    1
    Qt products
    Qt/Embedded
    Platforms
    Windows

    Question File size limitation in qt

    I have a text file size of 3.33MB which i need to render in the text browser. But only 1MB of text file data is read and rendered.
    It would be helpfull i could know the text file size limit to render in qt.

    I am using the following code.

    Qt Code:
    1. #include "file.h"
    2. #include "ui_file.h"
    3. #include<QFile>
    4. #include<QTextStream>
    5. #include<QMessageBox>
    6.  
    7. file::file(QWidget *parent) :
    8. QMainWindow(parent),
    9. ui(new Ui::file)
    10. {
    11. ui->setupUi(this);
    12. }
    13.  
    14. file::~file()
    15. {
    16. delete ui;
    17. }
    18.  
    19. void file::on_pushButton_clicked()
    20. {
    21. QFile file ("D:\\Users\\aisu1452\\Thales_db_frgbsa9.pc");
    22.  
    23. if(!file.open(QIODevice :: ReadOnly))
    24. {
    25. QMessageBox :: information(0,"info", file.errorString());
    26. }
    27. else
    28. {
    29. QTextStream in (&file);
    30. ui->textBrowser->setText(in.readAll());
    31. }
    32.  
    33. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 20th October 2014 at 10:04. Reason: missing [code] tags

  2. #2
    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: File size limitation in qt

    There is no "text file size limit" in Qt.
    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.


  3. #3
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: File size limitation in qt

    Have you tried QTextBrowser::setSource() to let the widget load the document as it sees fit, instead of loading the whole contents in RAM?

  4. #4
    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: File size limitation in qt

    If your text file contains a null character (0x0), the QString returned by readAll() will be effectively truncated at that point. Likewise, I think QTextBrowser will stop loading when it hits a null.

Similar Threads

  1. Qwt axis scale limitation
    By Momergil in forum Qwt
    Replies: 2
    Last Post: 14th January 2013, 18:03
  2. QPixmap size limitation
    By Thuan Seah Tan in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2012, 01:26
  3. QImage size limitation
    By JovianGhost in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2010, 13:01
  4. QPoint Limitation
    By archanasubodh in forum Qt Programming
    Replies: 1
    Last Post: 5th August 2008, 11:22
  5. Limitation when adding more than 256 items to a model
    By darkadept in forum Qt Programming
    Replies: 5
    Last Post: 25th May 2006, 16:26

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.