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. [Solved] - Starting a QDialog hidden
Forum Updated to NodeBB v4.3 + New Features

[Solved] - Starting a QDialog hidden

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.2k 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.
  • M Offline
    M Offline
    maximus
    wrote on last edited by
    #1

    I want to show my QDialog only after it's QWebView has finished loading.

    I tried multiple approach, but all failed (setting setVisible to false in the constructor still show the QDialog)

    main.cpp

    @
    DialogLogin *login = new DialogLogin();

    while (!login->isLoginPageLoaded()) {
        qDebug() << "waiting for loading page....";
        QThread::msleep(700);
    }
    
    login->exec(&#41;;@
    

    this code stay in the loop forever, it seems if the QWebView isn't been displayed, it's not loading the URL..


    Free Indoor Cycling Software - https://maximumtrainer.com

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      If I understood you correctly, use QWebView's "loadFinished":http://qt-project.org/doc/qt-5/qwebview.html#loadFinished signal. You can connect it to a slot and then create DialogLogin there or just show().

      157

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hsierra00
        wrote on last edited by
        #3

        hi
        you could create a slot

        private slots:
        void webLoadFinished(bool);
        in slot implementations

        void MainWindow::webLoadFinished(bool)
        {
        DialogLogin *login = new DialogLogin();
        login->exec();
        }

        in QWebView setting

        connect(ui->webView, SIGNAL(loadFinished(bool)),this,SLOT(webLoadFinished(bool)));
        ui->webView->load(QUrl("http://stackoverflow.com"));

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hsierra00
          wrote on last edited by
          #4

          hi
          more clear
          you could create a slot

          @
          private slots:
          void webLoadFinished(bool);
          @

          in slot implementations

          @
          void MainWindow::webLoadFinished(bool)
          {
          DialogLogin *login = new DialogLogin(); login->exec();
          }
          @

          in QWebView setting

          @
          connect(ui->webView, SIGNAL(loadFinished(bool)),this,SLOT(webLoadFinished(bool)));
          ui->webView->load(QUrl("http://stackoverflow.com"));
          @

          1 Reply Last reply
          0
          • M Offline
            M Offline
            maximus
            wrote on last edited by
            #5

            Hey,

            The problem is that the QDialog is executed in the main (before QMainWindow), so I can't really connect a slot there. Also just calling .exec() show the QDialog automatically..
            Will try some other approach, thanks!


            Free Indoor Cycling Software - https://maximumtrainer.com

            1 Reply Last reply
            0
            • M Offline
              M Offline
              maximus
              wrote on last edited by
              #6

              Also food for thought, how do I connect a the signal loadFinished of a QWebView if I don't have a QDialog, QWebView needs a parent to live (can't live on it's own)
              If the QDialog .exec() isn't called, the QWebView never get to the signal "loadFinished"


              Free Indoor Cycling Software - https://maximumtrainer.com

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hsierra00
                wrote on last edited by
                #7

                hi
                You use QWebView inside of DialogLogin ?

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  maximus
                  wrote on last edited by
                  #8

                  I used another approach, instead of hiding the QDialog, I just hide the QWebView until it's loading and show a loading indicator before

                  Result :
                  "https://www.dropbox.com/s/dzatqvkttd3hw5z/aaab.png?dl=0":https://www.dropbox.com/s/dzatqvkttd3hw5z/aaab.png?dl=0

                  Thanks for your help!


                  Free Indoor Cycling Software - https://maximumtrainer.com

                  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