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. [Qt]Object::connect
Forum Updated to NodeBB v4.3 + New Features

[Qt]Object::connect

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.9k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    Phenixo
    wrote on last edited by
    #1

    hello

    I simplify the code.
    So I want QWebView displays detai loading the page in a QStatuBar
    @
    #include <QApplication>
    #include <QWidget>
    #include <QWebView>
    #include <QVBoxLayout>
    #include <QMainWindow>
    #include <QStatusBar>
    #include <QProgressBar>
    #include <QObject>
    int main(int argc, char* argv[])
    {
    QApplication app(argc,argv);
    QStatusBar *a=new QStatusBar();
    QMainWindow *ongle = new QMainWindow();
    a->setVisible(true);
    QWebView *page=new QWebView();
    page->load(QUrl("http://siteduzero.com"));
    ongle->setCentralWidget(page);
    QObject::connect(page,SIGNAL(statusBarMessage(QString)),a,SLOT(showMessage(QString)));
    ongle->show();

    return app.exec();
    }@
    the problems is that code displays the page without details for exempel chrome when it load a page it display a small bar in the right corner that displai details

    to be a professional programmer is my goal :p

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      statusBarMessage is not a loading progress message. It's what a web page can set via javascript windows.status property. Most(all?) of the current browsers don't show this at all (by default). What chrome shows is the url of the currently loaded resource.

      Btw. You've got your variable name wrong - QWebView is not a page. QWebView::page() returns a QWebPage that is a page. QWebView is a widget.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Phenixo
        wrote on last edited by
        #3

        thx chris
        if you haven't shown up, I suppose that I will continue trying to solve a problem without solution
        so how do Imake this "the url of the currently loaded resource"

        to be a professional programmer is my goal :p

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dbzhang800
          wrote on last edited by
          #4

          Hi, the simplified code you given doesn't work, as your mainWindow don't have a statusbar at all. and the toplevel statusbar which isn't belong to mainWindow isn't shown by you too.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Phenixo
            wrote on last edited by
            #5

            hi 1+1=2
            how I fix it and how to do to make the satutbar display information about the page load (the currently loaded resource.)

            to be a professional programmer is my goal :p

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You can add a QStatusBar to your QMainWindow with "setStatusBar":http://qt-project.org/doc/qt-5.1/qtwidgets/qmainwindow.html#setStatusBar or via the designer. Also by default, when you create a new app, you get a .ui form with mainwindow that already has a statusbar and a toolbar.

              Now for monitoring resources. The easiest way is to subclass QNetworkAccessManager and set it on your QWebPage with "setNetworkAccessManager":http://qt-project.org/doc/qt-5.1/qtwebkit/qwebpage.html#setNetworkAccessManager

              In your NAM implementation you override get, post and other types of requests to emit a custom signal like requestedResource(QString url) and then call base implementation.
              Then, in your main window you connect to that custom signal and display the url in the status bar.

              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