Results 1 to 5 of 5

Thread: How can I see custom components in QtDesigner?

  1. #1
    Join Date
    Dec 2016
    Posts
    3
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How can I see custom components in QtDesigner?

    I am developing a Qt Quick 2 Application using QML to define my components.

    I would like to create a folder in the project where to put common components (such as customized buttons or labels), and specifically I would like to see this components in the Qt Designer view, in order to be able to drag-drop those elements while designing new views.

    I see that the Qt Designer view only shows to you the components located at the same path of the qml that you are currently developing, but I haven't found a way to display components located in other paths.

    The project tree should be something like this:

    • RootFolder
    • CommonComponents
    • Views



    where the qmls developed in the Views folder will use components defined in the CommonComponents folder.

    Does anyone know how to configure the project or the QtDesigner in order to achieve this goal? Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How can I see custom components in QtDesigner?

    Does the file you are designing have the import for your component directory?

    Cheers,
    _

  3. #3
    Join Date
    Dec 2016
    Posts
    3
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How can I see custom components in QtDesigner?

    Yes it has the import statement.
    The point is that the import allows me to use the component by manually editing the current ui.qml, but the side effect is that the preview in the designer will be no longer available.
    Morover the component is still not shown in the designer library section.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How can I see custom components in QtDesigner?

    Hmm, since you said components on the same path are shown I hoped that was because these were implicitly imported.

    Does your component directory have a qmldir file?

    Does it help if you set QML2_IMPORT_PATH to include your component directory before launching QtCreator?

    Otherwise we'll probably have to look at the code to see how it determines viable directories.

    Cheers,
    _

  5. #5
    Join Date
    Dec 2016
    Posts
    3
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How can I see custom components in QtDesigner?

    Yes there is a qmldir file in the directory, listing the files as described herehttp://doc.qt.io/qt-5/qtqml-syntax-d...g-qmldir-files
    But nothing seems to happen while having or not having this file

Similar Threads

  1. How to create a custom dock widget like QtDesigner
    By ad5xj in forum Qt Programming
    Replies: 3
    Last Post: 25th May 2015, 19:08
  2. Custom C++-based QML components in Qt 5?
    By fonzi337 in forum Qt Quick
    Replies: 8
    Last Post: 7th August 2013, 20:21
  3. Create custom plugin into qtdesigner with qt5 alpha
    By alizadeh91 in forum Qt Programming
    Replies: 0
    Last Post: 1st December 2012, 08:39
  4. Replies: 9
    Last Post: 15th October 2009, 11:40
  5. Replies: 1
    Last Post: 25th October 2006, 16:41

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.