문제

I've got the following custom widget:

class QDESIGNER_WIDGET_EXPORT MySpecialButton : public QAbstractButton
{
    Q_OBJECT
    ...etc...
};

Qt Designer recognizes this widget, and I can place it onto my form without a problem. However, when looking in the property editor, only the QObject and QWidget properties are visible. How do I get Qt Designer to recognize that this is also a QAbstractButton object?

도움이 되었습니까?

해결책

First, make sure you have the Q_OBJECT macro in your class definition. Also, make sure the file was properly moced. If neither of those help, you might investigate how QPushButton and QToolButton are declared to see if that gives you any hints.

Finally, if you need a chainsaw approach rather than a scalpel, you could define the properties you want to set in your class, giving the QAbstractButton functions as the ones to call for the properties. Look into the Q_PROPERTY macro.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top