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. Use loader to load the components come with Qt(ex: Rectangle)

Use loader to load the components come with Qt(ex: Rectangle)

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.0k 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.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    A simple example
    @
    iimport QtQuick 2.0
    import QtGraphicalEffects 1.0

    Rectangle {
    width: 640
    height: 480

    Loader{
       id: loader
    
       anchors.fill: parent
    }
    
    Component.onCompleted: {
        loader.source("DirectionalBlur.qml")
    }
    

    }
    @

    However, this wouldn't work, is it possible to load the build in qml component by loader?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JapieKrekel
      wrote on last edited by
      #2

      I guess the double letter 'i' is a typo in your example.
      @
      iimport QtQuick 2.0
      @

      Try changing line 15 to
      @
      loader.source = "DirectionalBlur.qml"
      @

      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