c++ - SOLVED Qt: Load HTML source code to string -


i have html file stored locally have extract text from.

now managed prompt user location , display html file in qtextbrowser pressing button. understand next step convert string able search text inside source code.

here's button_clicked method far

void mainwindow::on_gethtmlbutton_clicked() {     qstring filename = openfilenamedialog();      if (filename.isempty())     {         qmessagebox::information(this, tr("file name"), "es wurde keine gültige datei angegeben.");     }     else     {         qfile file(filename);         if (!file.open(qiodevice::readonly))         {             qmessagebox::information(0, "info", file.errorstring());         }         else         {             qtextstream in(&file);             ui->textbrowserhtml->settext(in.readall());         }     } } 

the html file shows in textbrowser without issues. understanding far need create string search substring in source code. problem cannot seem create string object source of html file content.

qstring string = in.readall(); 

does not seem work...

i had learn after having read out stream , putting ui by

ui->textbrowserhtml->settext(in.readall());

the stream empty – when attempt to readallagain results in empty string.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -