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. files are automatically imported as objects?
Forum Updated to NodeBB v4.3 + New Features

files are automatically imported as objects?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 301 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.
  • anotherChrisA Offline
    anotherChrisA Offline
    anotherChris
    wrote on last edited by
    #1

    I'm very new to QML and QtQuick, so I apologize if the following is a bad question. If the answers could be easily found in some documentation, please point me in that direction, thanks.

    I am trying to change SDDM login on my Lubuntu OS. The appearance is managed by a file called "Main.qml", which imports QtQuick 2.0 and SddmComponents2.0. The code in this file references an object called "PictureBox", which doesn't seem to exist in QtQuick. I assume PictureBox object is created by "PictureBox.qml", part of SDDM components:
    https://github.com/jhonwoo/sddm/tree/master/components/2.0

    PictureBox.qml only imports QtQuick2.0, but it uses another object I can't find in QtQuick called PasswordBox. So, can I assume that QML files located in the same directory can automatically import each other without explicit import statements?

    Also, if I want to modify PictureBox object in any way, can I do this from Main.qml, or do I have to modify the PictureBox.qml file?

    Thanks.

    sierdzioS 1 Reply Last reply
    0
    • anotherChrisA anotherChris

      I'm very new to QML and QtQuick, so I apologize if the following is a bad question. If the answers could be easily found in some documentation, please point me in that direction, thanks.

      I am trying to change SDDM login on my Lubuntu OS. The appearance is managed by a file called "Main.qml", which imports QtQuick 2.0 and SddmComponents2.0. The code in this file references an object called "PictureBox", which doesn't seem to exist in QtQuick. I assume PictureBox object is created by "PictureBox.qml", part of SDDM components:
      https://github.com/jhonwoo/sddm/tree/master/components/2.0

      PictureBox.qml only imports QtQuick2.0, but it uses another object I can't find in QtQuick called PasswordBox. So, can I assume that QML files located in the same directory can automatically import each other without explicit import statements?

      Also, if I want to modify PictureBox object in any way, can I do this from Main.qml, or do I have to modify the PictureBox.qml file?

      Thanks.

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @anotherChris said in files are automatically imported as objects?:

      So, can I assume that QML files located in the same directory can automatically import each other without explicit import statements?

      Yes.

      Also, if I want to modify PictureBox object in any way, can I do this from Main.qml, or do I have to modify the PictureBox.qml file?

      You can modify properties of objects where you use them. So for example:

      Item {
       x: 5
       y: 20
      }
      

      x and y are properties defined in Item.qml, but you can manipulate them in your file. If you want to add a property, you can do it, too:

      Item {
       property int coord: 20
       x: coord + 8
       y: coord
      }
      

      But if you want to do deeper modifications of item (like - remove a property), you need to do it in the source file.

      (Z(:^

      anotherChrisA 1 Reply Last reply
      3
      • sierdzioS sierdzio

        @anotherChris said in files are automatically imported as objects?:

        So, can I assume that QML files located in the same directory can automatically import each other without explicit import statements?

        Yes.

        Also, if I want to modify PictureBox object in any way, can I do this from Main.qml, or do I have to modify the PictureBox.qml file?

        You can modify properties of objects where you use them. So for example:

        Item {
         x: 5
         y: 20
        }
        

        x and y are properties defined in Item.qml, but you can manipulate them in your file. If you want to add a property, you can do it, too:

        Item {
         property int coord: 20
         x: coord + 8
         y: coord
        }
        

        But if you want to do deeper modifications of item (like - remove a property), you need to do it in the source file.

        anotherChrisA Offline
        anotherChrisA Offline
        anotherChris
        wrote on last edited by
        #3

        @sierdzio Thank you!

        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