[Python] Pyside6-designer: custom promoted widget export Python code

Discussão em 'Python' iniciado por Stack, Março 11, 2025.

  1. Stack

    Stack Membro Participativo

    I've created the design for a widget in PySide6 GUI.
    This MetadataRenameEditWidget custom promoted widget is within a form that contains many other things.

    I would like to get the class of the promoted widget so created, in order to create instances of it elsewhere in my code.

    When I export the code for my Form, I get something like:

    ################################################################################
    ## Form generated from reading UI file 'main_window_uiERYisl.ui'
    ##
    ## Created by: Qt User Interface Compiler version 6.8.0
    ##
    ## WARNING! All changes made in this file will be lost when recompiling UI file!
    ################################################################################

    from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
    QMetaObject, QObject, QPoint, QRect,
    QSize, QTime, QUrl, Qt)

    # More imports [...]

    from metadatarenameeditwidget import MetadataRenameEditWidget


    Where metadatarenameeditwidget is the module containing the widget, as I've promoted it.

    However, the module metadatarenameeditwidget is not exported -- only the main_window.ui content is exported in a single file, and I cannot access the code of the promoted widget.

    How can I export the code of the promoted widget?

    Continue reading...

Compartilhe esta Página