Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to display errors for Loader?
Qt 6.11 is out! See what's new in the release blog

How to display errors for Loader?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.3k 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
    philk
    wrote on last edited by
    #1

    I have a loader defined and would like to display a Text element with an error text if the loader failed to load a source.
    @
    Loader {
    id: view;
    asynchronous: true;
    visible: status == Loader.Ready
    clip: true;
    focus: true;

      width: main.width - sidePanel.width;
      height: parent.height;
      z: 1;
    
      Text {
        visible: view.status == Loader.Error
        text: "Could not load" + view.source
      }
    }
    

    @

    The text is not visible though.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You need to anchor your Text element.

      Also, make sure Loader is working as you expect with:
      @
      id: view
      // ...
      onStatusChanged: {
      console.log("Loader status changed to " + status);
      }
      @

      (Z(:^

      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