QT Design Studio - Generation of objectName
-
The generated "*.ui.qml" files by QT Design Studio, create an "id" for each component but do not generate an "objectName". Finding components is typically done using the "objectName". Is it possible to ensure QT Design Studio generates an "objectName" for each component? If not, how is one supposed to be able to find/reference the components from python or c++?
-
The generated "*.ui.qml" files by QT Design Studio, create an "id" for each component but do not generate an "objectName". Finding components is typically done using the "objectName". Is it possible to ensure QT Design Studio generates an "objectName" for each component? If not, how is one supposed to be able to find/reference the components from python or c++?
Hi, and welcome!
@Targo said in QT Design Studio - Generation of objectName:
Is it possible to ensure QT Design Studio generates an "objectName" for each component?
Qt Design Studio does not currently let us edit the
objectNames via the property editor. You could manually add it via the code editor, however: https://doc.qt.io/qtdesignstudio/qtquick-text-editor.html@Targo said in QT Design Studio - Generation of objectName:
Finding components is typically done using the "objectName" ... how is one supposed to be able to find/reference the components from python or c++?
May I ask where you learnt about finding items using "objectName"?
The current recommendation is to expose C++/Python classes to QML via
QML_ELEMENT/QmlElement: https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html This way, you can call C++/Python methods from QML. -
S SGaist moved this topic from Qt in Education on