Results 1 to 3 of 3

Thread: Why my webview does not load page at QML start?!?

  1. #1
    Join Date
    Feb 2015
    Location
    Poland
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Exclamation Why my webview does not load page at QML start?!?

    Hi
    My Qml page is very simple: ToolButton and WebView. Now it loads background and shows nothing but white rectangle (WebView object) even toolbutton is transparent, but accessible. I can load page by hand (clicking on toolbutton). But I want open page at application start! My code is as follow:
    Qt Code:
    1. import QtQuick 2.2
    2. import QtQuick.Controls 1.4
    3. import QtWebView 1.1
    4. import QtQuick.Layouts 1.1
    5.  
    6. Rectangle {
    7. id: rec1
    8. color: "black"
    9. gradient: Gradient {
    10. GradientStop {
    11. position: 0.00;
    12. color: "#000000";
    13. }
    14. GradientStop {
    15. position: 1.00;
    16. color: "#ffffff";
    17. }
    18. }
    19.  
    20. ToolButton {
    21. id: reloadButton
    22. tooltip: qsTr("Reload")
    23. onClicked: web1.url = "http://google.pl"
    24. }
    25.  
    26.  
    27. // anchors.fill: parent
    28. WebView {
    29. id: web1
    30. objectName: "web1"
    31. visible: true
    32. anchors.top: reloadButton.bottom
    33. anchors.bottom: parent.bottom
    34. anchors.left: parent.left
    35. anchors.right: parent.right
    36. //anchors.fill: parent
    37. anchors.margins: 10
    38. url: "http://google.pl"
    39. onLoadingChanged: {
    40. if(loadRequest.errorString)
    41. console.error(loadRequest.errorString);
    42. else
    43. console.info("Load web page successfull");
    44. }
    45. Component.onCompleted: function() { web1.url = "http://google.pl"; web1.reload(); console.info("Load successfull"); }
    46. }
    47. }
    To copy to clipboard, switch view to plain text mode 

    How to load web page just after application start?!?

    thanks and best regards
    Szyk Cech

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Why my webview does not load page at QML start?!?

    Works for me, with and without the Component.onCompleted.

    Qt 5.8 on Linux

    Cheers,
    _

  3. #3
    Join Date
    Feb 2015
    Location
    Poland
    Posts
    34
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Why my webview does not load page at QML start?!?

    I try it with Qt 5.6.2 on Windows 10. So maybe it is some already fixed bug...

Similar Threads

  1. How to load CHM file in Qt webview?
    By Gokulnathvc in forum Newbie
    Replies: 1
    Last Post: 22nd January 2016, 10:43
  2. Load a simple Page after the Main Page.
    By mrhevor in forum Qt Quick
    Replies: 1
    Last Post: 27th September 2011, 10:32
  3. Can't load HTML page with QNetworkReply
    By T4ng10r in forum Qt Programming
    Replies: 2
    Last Post: 19th September 2011, 06:56
  4. How to add page break when printe a webview to PDF format
    By richardander in forum Qt Programming
    Replies: 1
    Last Post: 18th December 2009, 15:21

Tags for this Thread

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.