forked from qt-creator/qt-creator
QmlDesigner: add verification that the function exists
Add verification that the function exists before invoking it. It causes warnings when the method does not exist in a pane. Also all of the panes don't need this. In addition, removing the placeholder with an empty function, as it is no longer needed. Task-number: QDS-14709 Change-Id: Ieaff5cf4759514c84e09ca0faaecc22b357b9a94 Reviewed-by: Ali Kianian <ali.kianian@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -13,11 +13,6 @@ Rectangle {
|
|||||||
height: 400
|
height: 400
|
||||||
color: StudioTheme.Values.themePanelBackground
|
color: StudioTheme.Values.themePanelBackground
|
||||||
|
|
||||||
// Called from C++ to clear the search when the selected node changes
|
|
||||||
function clearSearch() {
|
|
||||||
// The function is empty, because it is a placeholder to match other panes
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: mainColumn
|
id: mainColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@@ -453,7 +453,14 @@ void PropertyEditorView::resetView()
|
|||||||
|
|
||||||
if (m_qmlBackEndForCurrentType) {
|
if (m_qmlBackEndForCurrentType) {
|
||||||
m_qmlBackEndForCurrentType->emitSelectionChanged();
|
m_qmlBackEndForCurrentType->emitSelectionChanged();
|
||||||
QMetaObject::invokeMethod(m_qmlBackEndForCurrentType->widget()->rootObject(), "clearSearch");
|
|
||||||
|
const auto qmlBackEndObject = m_qmlBackEndForCurrentType->widget()->rootObject();
|
||||||
|
if (qmlBackEndObject) {
|
||||||
|
const auto metaObject = qmlBackEndObject->metaObject();
|
||||||
|
const int methodIndex = metaObject->indexOfMethod("clearSearch()");
|
||||||
|
if (methodIndex != -1)
|
||||||
|
metaObject->method(methodIndex).invoke(qmlBackEndObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_locked = false;
|
m_locked = false;
|
||||||
|
Reference in New Issue
Block a user