summaryrefslogtreecommitdiff
path: root/src/designer/src/designer/doc/snippets/lib/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp
blob: 347988365a442e8c9bb124c1dea055cdfaf01ad1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

//! [0]
        auto *propertyEditor = formEditor->propertyEditor();

        connect(propertyEditor, &QDesignerPropertyEditorInterface::propertyChanged,
                this, &MyClass::checkProperty);
//! [0]


//! [1]
        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)
                {...}
        }
//! [1]