Is it possible to access custom properties from QT Designer after conversion to python?

I am new to PyQt and Qt Designer, and I am trying to create a simple method for linking qWidgets to tables and columns in a SQLite database. My idea was to mark each qWidget in the designer with two custom properties, one of which is the table name and the other is the column name. Later, I used the information provided by the developer to create my own class, which creates a connection between qwidets and the SQLite database.

Adding custom properties to Designer seems to work fine, however, the code for these custom properties is not generated when converting the xml constructor to python (using UIC). Has anyone done this successfully? Perhaps there is a better way to do this?

Thank,

Eric

+3
source share
3 answers

Refuse Eric in this article . In particular, see the "Creating a Plugin" section. River Bank Computing has another great PyQt link .

EDIT: , . , , . setProperty() QObject, QWidget.

, , . QWidget , QSqlTableModel, . - QTableView . Qt. .

0

Designer, "myproperty", ...

mywidget.property("myproperty")

pyqt 4.8.3, , .

+2

"" - , pyuic, .

It looks like you could easily complete your task by creating your own custom class that inherits from QWidgetand has additional properties that you described. Trying to use custom widgets in the designer, I think it’s β€œeasier” to just write the class yourself, and then customize the layout manually.

I know that this does not exactly answer your question, but maybe you will try some of my suggestions.

0
source

Source: https://habr.com/ru/post/1734126/


All Articles