QDesignerPropertyEditorInterface Class

QDesignerPropertyEditorInterface 클래스를 사용하면 Qt Widgets Designer 의 프로퍼티 에디터의 현재 상태를 쿼리하고 조작할 수 있습니다. 더 보기...

헤더: #include <QDesignerPropertyEditorInterface>
CMake: find_package(Qt6 REQUIRED COMPONENTS Designer)
target_link_libraries(mytarget PRIVATE Qt6::Designer)
qmake: QT += designer
상속합니다: QWidget

공용 함수

QDesignerPropertyEditorInterface(QWidget *parent, Qt::WindowFlags flags = {})
virtual ~QDesignerPropertyEditorInterface()
virtual QDesignerFormEditorInterface *core() const
virtual QString currentPropertyName() const = 0
virtual bool isReadOnly() const = 0
virtual QObject *object() const = 0

공용 슬롯

virtual void setObject(QObject *object) = 0
virtual void setPropertyValue(const QString &name, const QVariant &value, bool changed = true) = 0
virtual void setReadOnly(bool readOnly) = 0

시그널

void propertyChanged(const QString &name, const QVariant &value)

상세 설명

QDesignerPropertyEditorInterface에는 일반적으로 프로퍼티 에디터의 현재 상태를 쿼리하는 데 사용되는 함수 모음과 상태를 조작하는 여러 슬롯이 포함되어 있습니다. 이 인터페이스는 프로퍼티 에디터에서 프로퍼티가 변경될 때마다 발생하는 propertyChanged() 신호도 제공합니다. 신호의 인수는 변경된 프로퍼티와 새 값입니다.

예를 들어 사용자 정의 위젯 플러그인을 구현할 때 사용자 정의 슬롯에 신호를 연결할 수 있습니다:

        auto *propertyEditor = formEditor->propertyEditor();

        connect(propertyEditor, &QDesignerPropertyEditorInterface::propertyChanged,
                this, &MyClass::checkProperty);

그러면 사용자 지정 슬롯은 특정 위젯에 속한 지정된 프로퍼티가 변경될 때 새 값이 원하는 범위 내에 있는지 확인할 수 있습니다:

        void checkProperty(const QString &property, const QVariant &value)
        {
            auto *propertyEditor = formEditor->propertyEditor();

            auto *object = propertyeditor->object();
            auto *widget = qobject_cast<MyCustomWidget *>(object);

            if (widget && property == aProperty && value != expectedValue)
                {...}
        }

QDesignerPropertyEditorInterface 클래스는 직접 인스턴스화할 수 없습니다. QDesignerFormEditorInterface::propertyEditor () 함수를 사용하여 Qt Widgets Designer 의 프로퍼티 편집기에 대한 인터페이스를 검색할 수 있습니다. Qt Widgets Designer 의 현재 QDesignerFormEditorInterface 객체(위 예시에서는formEditor )에 대한 포인터는 QDesignerCustomWidgetInterface::initialize() 함수의 파라미터로 제공됩니다. 사용자 정의 위젯 플러그인을 구현할 때는 QDesignerCustomWidgetInterface 을 서브클래스화하여 Qt Widgets Designer 에 플러그인을 노출해야 합니다.

속성 편집기에 액세스하는 함수는 양식 편집기에 대한 인터페이스를 검색하는 데 사용할 수 있는 core() 함수, 속성 편집기에서 현재 선택된 속성 이름을 반환하는 currentPropertyName() 함수, Qt Widgets Designer 의 작업 영역에서 현재 선택된 객체를 반환하는 object() 함수, 속성 편집기가 쓰기 보호된 경우 true를 반환하고 그렇지 않으면 false를 반환하는 isReadOnly() 함수가 있습니다.

속성 편집기의 상태를 조작하는 슬롯은 Qt Widgets Designer 의 작업 영역에서 현재 선택된 개체를 변경하는 데 사용할 수 있는 setObject() 슬롯, 지정된 속성 값을 변경하는 setPropertyValue() 슬롯 및 속성 편집기의 쓰기 보호를 제어하는 setReadOnly() 슬롯입니다.

QDesignerFormEditorInterface참조하세요 .

멤버 함수 문서

[explicit] QDesignerPropertyEditorInterface::QDesignerPropertyEditorInterface(QWidget *parent, Qt::WindowFlags flags = {})

지정된 parent 와 지정된 창 flags 으로 프로퍼티 에디터 인터페이스를 구축합니다.

[virtual noexcept] QDesignerPropertyEditorInterface::~QDesignerPropertyEditorInterface()

프로퍼티 에디터 인터페이스를 삭제합니다.

[virtual] QDesignerFormEditorInterface *QDesignerPropertyEditorInterface::core() const

Qt Widgets Designer 의 현재 QDesignerFormEditorInterface 객체에 대한 포인터를 반환합니다.

[pure virtual] QString QDesignerPropertyEditorInterface::currentPropertyName() const

속성 편집기에서 현재 선택된 속성의 이름을 반환합니다.

setPropertyValue()도 참조하세요 .

[pure virtual] bool QDesignerPropertyEditorInterface::isReadOnly() const

속성 편집기가 쓰기 금지된 경우 참을 반환하고, 그렇지 않으면 거짓을 반환합니다.

setReadOnly()도 참조하세요 .

[pure virtual] QObject *QDesignerPropertyEditorInterface::object() const

Qt Widgets Designer 의 작업 영역에서 현재 선택된 객체를 반환합니다.

setObject()도 참조하세요 .

[signal] void QDesignerPropertyEditorInterface::propertyChanged(const QString &name, const QVariant &value)

이 신호는 속성 편집기에서 속성이 변경될 때마다 발생합니다. 변경된 속성과 새 값은 각각 namevalue 으로 지정됩니다.

setPropertyValue()도 참조하세요 .

[pure virtual slot] void QDesignerPropertyEditorInterface::setObject(QObject *object)

Qt Widgets Designer 의 작업 영역에서 현재 선택된 개체를 object 로 변경합니다.

object()도 참조하세요 .

[pure virtual slot] void QDesignerPropertyEditorInterface::setPropertyValue(const QString &name, const QVariant &value, bool changed = true)

name 에 지정된 속성 값을 value 으로 설정합니다.

또한 속성 편집기에서 속성은 changed 로 표시되어 기본값과 다른 값을 갖습니다.

currentPropertyName() 및 propertyChanged()도 참조하세요 .

[pure virtual slot] void QDesignerPropertyEditorInterface::setReadOnly(bool readOnly)

readOnly 이 참이면 속성 편집기가 쓰기 보호되고, 그렇지 않으면 쓰기 보호가 제거됩니다.

isReadOnly()도 참조하세요 .

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.