Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator - show python or c++ based qml components in visual editor
Forum Updated to NodeBB v4.3 + New Features

QtCreator - show python or c++ based qml components in visual editor

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
1 Posts 1 Posters 140 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.
  • lollypollyL Offline
    lollypollyL Offline
    lollypolly
    wrote on last edited by
    #1

    Is that possible to show python-based qml components in visual editor?
    Lets assume I have following component:

    class QmlQImage(QQuickPaintedItem):
        def __init__(self, parent=None):
            super().__init__(parent)
            self.image_val = QImage()
    
        def get_image(self):
            return self.image_val
    
        def set_image(self, val):
            self.image_val = val
    
        image = Property(int, get_image, set_image)
    
        def paint(self, painter: PySide2.QtGui.QPainter):
            painter.drawImage(QRect(0, 0, painter.device().height(), painter.device().width()), self.image_val)
    
    qmlRegisterType(QmlQImage, 'QmlExt', 1, 0, 'QmlQImage')
    

    and qml file

    import QtQuick 2.0
    import QmlExt 1.0
    
    QmlQImage {
        width: 256; height: 256
    }
    

    When trying to edit that qml file I am observing following error:
    f902cc0c-8358-408c-9872-00b21a4ed94f-image.png

    Also, is that possible to display c++ based components in QML editor? If yes, can someone provide link how to achieve that?

    Thanks in advance.

    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