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() override |
| 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 의 속성 편집기에 대한 인터페이스를 가져올 수 있습니다. QDesignerCustomWidgetInterface::initialize() 함수의 매개변수를 통해 Qt Widgets Designer 의 현재 QDesignerFormEditorInterface 객체(위 예제에서는formEditor )에 대한 포인터가 제공됩니다. 사용자 정의 위젯 플러그인을 구현할 때는 QDesignerCustomWidgetInterface 를 상속받아 플러그인을 Qt Widgets Designer 에 노출시켜야 합니다.
속성 편집기에 액세스하는 함수로는 폼 편집기에 대한 인터페이스를 가져오는 데 사용할 수 있는 core() 함수, 속성 편집기에서 현재 선택된 속성의 이름을 반환하는 currentPropertyName() 함수, Qt Widgets Designer 의 작업 공간에서 현재 선택된 객체를 반환하는 object() 함수, 그리고 속성 편집기가 쓰기 보호된 경우 true를 반환하는 isReadOnly() 함수가 있습니다 (그렇지 않으면 false)를 반환하는 () 함수가 있습니다.
속성 편집기의 상태를 조작하는 슬롯으로는, Qt Widgets Designer 의 작업 공간에서 현재 선택된 객체를 변경하는 데 사용할 수 있는 setObject() 슬롯, 지정된 속성의 값을 변경하는 setPropertyValue() 슬롯, 그리고 속성 편집기의 쓰기 보호를 제어하는 setReadOnly() 슬롯이 있습니다.
QDesignerFormEditorInterface도 참조하십시오 .
멤버 함수 문서
[explicit] QDesignerPropertyEditorInterface::QDesignerPropertyEditorInterface(QWidget *parent, Qt::WindowFlags flags = {})
지정된 속성 편집기( parent )와 지정된 창 flags 을 사용하여 속성 편집기 인터페이스를 생성합니다.
[override 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
속성 편집기가 쓰기 보호 상태이면 true를 반환하고, 그렇지 않으면 false를 반환합니다.
setReadOnly()도 참조하십시오 .
[pure virtual] QObject *QDesignerPropertyEditorInterface::object() const
Qt Widgets Designer 의 작업 공간에서 현재 선택된 객체를 반환합니다.
setObject()도 참조하십시오 .
[signal] void QDesignerPropertyEditorInterface::propertyChanged(const QString &name, const QVariant &value)
이 신호는 속성 편집기에서 속성이 변경될 때마다 발생합니다. 변경된 속성과 그 새로운 값은 각각 name 및 value 에 의해 지정됩니다.
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 가 true인 경우, 속성 편집기가 쓰기 보호 상태로 설정되며, 그렇지 않은 경우 쓰기 보호가 해제됩니다.
isReadOnly()도 참조하십시오 .
© 2026 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.