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. QtCreator Designer how can I see custom object in QML Types?
Forum Updated to NodeBB v4.3 + New Features

QtCreator Designer how can I see custom object in QML Types?

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

    I'm pretty new to QtCreator, my issue is that I'm not able to see QML Custom Components.
    For example if you import QtQuick.Controls 1.5 you see under QML types: - Qt Quick - Controls.
    So far I have created my personal set of components, here is the folder structure:

    0_1509352349154_Screen Shot 2017-10-27 at 5.20.44 PM.png

    the components qmldir is done in that way:

    # qmldir
    module components
    Header 1.0 Header.qml
    Footer 1.0 Footer.qml
    CentralPage 1.0 CentralPage.qml
    GenericButton 1.0 GenericButton.qml
    ProgressBarCustom 1.0 ProgressBarCustom.qml
    

    than for example in the LandingPageFrom.ui.qml

    import QtQuick 2.6
    import QtQuick.Controls 1.5
    import QtQuick.Layouts 1.3
    
    import components 1.0 as Components
    
    Components.CentralPage {
        pageName: "landingPage"
    
        id: landingPage
    
        width: 800
        height: 1056
        property alias aButton: aButton
    
        Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
    }
    

    And is compiling and running fine but inside the Designer nothing is showing as aspected, I only see .qml that are in the same directory but not the ones in components directory:

    0_1509352496861_Screen Shot 2017-10-27 at 5.25.47 PM.png

    this is what I have done in the .pro and in the main.cpp

    QML_IMPORT_PATH += $$PWD/resources/common/ui
    QML_DESIGNER_IMPORT_PATH += resources/common/ui
    

    main.cpp

    QQmlApplicationEngine engine;
    engine.addImportPath("qrc:///ui");
    engine.load(QUrl("qrc:///ui/main.qml"));
    

    What is strange is that only the designer is not able to see the components, but the QML code is able, what I'm missing here?
    Thanks

    m.sueM 1 Reply Last reply
    0
    • E Elminster_cs

      I'm pretty new to QtCreator, my issue is that I'm not able to see QML Custom Components.
      For example if you import QtQuick.Controls 1.5 you see under QML types: - Qt Quick - Controls.
      So far I have created my personal set of components, here is the folder structure:

      0_1509352349154_Screen Shot 2017-10-27 at 5.20.44 PM.png

      the components qmldir is done in that way:

      # qmldir
      module components
      Header 1.0 Header.qml
      Footer 1.0 Footer.qml
      CentralPage 1.0 CentralPage.qml
      GenericButton 1.0 GenericButton.qml
      ProgressBarCustom 1.0 ProgressBarCustom.qml
      

      than for example in the LandingPageFrom.ui.qml

      import QtQuick 2.6
      import QtQuick.Controls 1.5
      import QtQuick.Layouts 1.3
      
      import components 1.0 as Components
      
      Components.CentralPage {
          pageName: "landingPage"
      
          id: landingPage
      
          width: 800
          height: 1056
          property alias aButton: aButton
      
          Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
      }
      

      And is compiling and running fine but inside the Designer nothing is showing as aspected, I only see .qml that are in the same directory but not the ones in components directory:

      0_1509352496861_Screen Shot 2017-10-27 at 5.25.47 PM.png

      this is what I have done in the .pro and in the main.cpp

      QML_IMPORT_PATH += $$PWD/resources/common/ui
      QML_DESIGNER_IMPORT_PATH += resources/common/ui
      

      main.cpp

      QQmlApplicationEngine engine;
      engine.addImportPath("qrc:///ui");
      engine.load(QUrl("qrc:///ui/main.qml"));
      

      What is strange is that only the designer is not able to see the components, but the QML code is able, what I'm missing here?
      Thanks

      m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      Hi @Elminster_cs

      QML_IMPORT_PATH += $$PWD/resources/common/ui
      QML_DESIGNER_IMPORT_PATH += resources/common/ui

      One is an absolute path, the other a relative path. Maybe that's the essential difference.

      -Michael.

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Elminster_cs
        wrote on last edited by
        #3

        Tried but this have not fixed it

        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