Important: Please read the Qt Code of Conduct -

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

  • 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


    QQmlApplicationEngine engine;

    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?

  • 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.


  • Tried but this have not fixed it

Log in to reply