title: QML error "Unknown component. (M300)" but the code works
body: <p>I want to use a custom font in a QML application, and to not have to specify it in every text field, I use a component as suggested in <a href="https://stackoverflow.com/a/8750188/788824">this answer</a>.</p>
  
  <p>I have a <code>DefaultText.qml</code> under a <code>styles</code> prefix in my <code>qml.qrc</code>, which resides in the folder <code>styles</code>.</p>
  
  <pre><code>import QtQuick 2.0
  
  Text {
      color: "black"
      font.family: myCustomFont.name
      font.bold: false
      font.italic: false
      font.pixelSize: 14
  }
  </code></pre>
  
  <p>I use it, among other places, in a qml named <code>PanelRight.qml</code>, under the prefix <code>Panels</code> in the folder <code>widgets</code>. It's all under the same <code>qml.qrc</code>.</p>
  
  <pre><code>import "qrc:/styles/styles"
  
  Item
  {
      // ...
      DefaultText { text: "xyz" }
  }
  </code></pre>
  
  <p>Interestingly, <code>DefaultText</code> is underlined as an error, with the message <strong>"Unknown component. (M300)"</strong>. However, I can successfully compile and run my application, and the custom font is displayed correctly. However, it's annoying that I have a long list of errors (I intend to use it in a lot of places) and that autocomplete doesn't work.</p>
  
  <p>I searched the Qt forums, this problem was mentioned there in case of custom plugins, which I don't use.</p>