Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Open html page

Open html page

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 5.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luca72
    wrote on last edited by
    #1

    hello i have a page called test_page.html like this:
    @ <table>
    <b>Inserisci la password</b>
    <form name="form_a" method="POST" action="http://www.test_site/riverside.php">
    <input type="passwd" name="password" value="myvalue"></input>;
    <input type="submit" name="Entra" value="entra"></input>;
    </form>
    </table>

    </div>
    [removed]
    document.form_a.submit();
    [removed]@
    i need to open in in a web browser how can i use?
    Thanks

    Luca

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You could start a web browser in QProcess. If you like to have an external browser.

      Within Qt how about "QWebView":http://doc.qt.nokia.com/4.7/qwebview.html#QWebView ?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • L Offline
        L Offline
        luca72
        wrote on last edited by
        #3

        Hello i have write this c++:
        @#include "widget.h"
        #include "ui_widget.h"
        #include <QWebView>

        Widget::Widget(QWidget *parent) :
        QWidget(parent),
        ui(new Ui::Widget)
        {
        ui->setupUi(this);
        connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(apro_pagina()));
        connect(&vista,SIGNAL(loadStarted()),this,SLOT(inizio_caricamento()));
        connect(&vista,SIGNAL(loadProgress(int)),this,SLOT(stato(int)));
        connect(&vista,SIGNAL(loadFinished(bool)),this,SLOT(finito(bool)));

        }

        Widget::~Widget()
        {
        delete ui;
        }

        void Widget::apro_pagina(){
        vista.setHtml("test_page.html");
        }

        void Widget::inizio_caricamento(){
        ui->label->setText("Inizio Caricamento");
        }

        void Widget::stato(int perc){
        ui->label->setText(QString::number(perc));
        }

        void Widget::finito(bool vero){
        ui->label->setText("Caricamento Finito");
        vista.show();
        }@

        But when the widget is open i see only a white page with written inside test_page.html

        What is wrong

        Thanks
        Luca

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          vista.setHtml() should have the HTML as argument, not the path to a file!

          For a file, you should call load() with a QUrl as parameter (denoting the complete path to your html file).

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • L Offline
            L Offline
            luca72
            wrote on last edited by
            #5

            Thanks for your time, now works

            Luca

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dialingo
              wrote on last edited by
              #6

              QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::TolerantMode));

              1 Reply Last reply
              0
              • K Offline
                K Offline
                koahnig
                wrote on last edited by
                #7

                I guess you have checked already that the signals are triggered and that you are arriving the appropriate slots.

                Have a look to the "previewer example":http://doc.qt.nokia.com/4.7/webkit-previewer.html
                I guess your problem is
                @
                void Widget::apro_pagina(){
                vista.setHtml("test_page.html");
                }
                @
                I would have passed a string containing the web page content, but not the name of file with the content.
                If you debug through the example, you should see what you have to pass.

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  leon.anavi
                  wrote on last edited by
                  #8

                  Hi,

                  I see that the issue is already solved thanks to Volker but I want to advertise two very simple code snippets related to the topic that I have added lately to the wiki :)
                  "Open Web Page in QWebView":http://developer.qt.nokia.com/wiki/Open_Web_Page_in_QWebView
                  "How to launch Web Browser":http://developer.qt.nokia.com/wiki/How_to_Launch_Web_Browser

                  Cheers,
                  Leon

                  http://anavi.org/

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved