uiloader

QUiLoader: requirements for loading .ui file with custom widgets?

十年热恋 提交于 2019-12-02 06:12:55
问题 I've created a UI using Qt5-Designer which I load at runtime by calling QUiLoader().load(qfile_object, this); Works like charm but now I've promoted some QLabel elements to a widget class MyQLabel with is derived from QLabel . When I now try to load the UI I get a warning for each promoted widget: "QFormBuilder was unable to create a custom widget of the class 'MyQLabel'; defaulting to base class 'QLabel'." The class looks like this: class MyQLabel : public QLabel { Q_OBJECT public: MyQLabel

QUiLoader: requirements for loading .ui file with custom widgets?

家住魔仙堡 提交于 2019-12-02 01:23:57
I've created a UI using Qt5-Designer which I load at runtime by calling QUiLoader().load(qfile_object, this); Works like charm but now I've promoted some QLabel elements to a widget class MyQLabel with is derived from QLabel . When I now try to load the UI I get a warning for each promoted widget: "QFormBuilder was unable to create a custom widget of the class 'MyQLabel'; defaulting to base class 'QLabel'." The class looks like this: class MyQLabel : public QLabel { Q_OBJECT public: MyQLabel(QWidget *parent = nullptr) : QLabel(parent) {} }; It's been auto- moc 'ed and linked against my