forked from qt-creator/qt-creator
QmlDesigner: Fix for Binding Editor launch pos
Task: QDS-1418 Change-Id: Id0c051d7187648a1477de70769fb7a47363ccdeb Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -154,9 +154,7 @@ Item {
|
||||
id: bindingEditorParent
|
||||
|
||||
Component.onCompleted: {
|
||||
var x = extendedFunctionButton.mapToGlobal(0,0).x - 200
|
||||
var y = extendedFunctionButton.mapToGlobal(0,0).y - 40
|
||||
bindingEditor.showWidget(x, y)
|
||||
bindingEditor.showWidget()
|
||||
bindingEditor.text = backendValue.expression
|
||||
bindingEditor.prepareBindings()
|
||||
}
|
||||
|
||||
@@ -117,9 +117,7 @@ Rectangle {
|
||||
visible: !isBaseState
|
||||
text: qsTr("Set when Condition")
|
||||
onTriggered: {
|
||||
var x = whenButton.mapToGlobal(0,0).x + 4
|
||||
var y = root.mapToGlobal(0,0).y - 32
|
||||
bindingEditor.showWidget(x, y)
|
||||
bindingEditor.showWidget()
|
||||
bindingEditor.text = delegateWhenConditionString
|
||||
bindingEditor.prepareBindings()
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void BindingEditor::registerDeclarativeType()
|
||||
qmlRegisterType<BindingEditor>("HelperWidgets", 2, 0, "BindingEditor");
|
||||
}
|
||||
|
||||
void BindingEditor::showWidget(int x, int y)
|
||||
void BindingEditor::prepareDialog()
|
||||
{
|
||||
if (s_lastBindingEditor)
|
||||
s_lastBindingEditor->hideWidget();
|
||||
@@ -71,6 +71,17 @@ void BindingEditor::showWidget(int x, int y)
|
||||
this, &BindingEditor::rejected);
|
||||
|
||||
m_dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
}
|
||||
|
||||
void BindingEditor::showWidget()
|
||||
{
|
||||
prepareDialog();
|
||||
m_dialog->showWidget();
|
||||
}
|
||||
|
||||
void BindingEditor::showWidget(int x, int y)
|
||||
{
|
||||
prepareDialog();
|
||||
m_dialog->showWidget(x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
|
||||
static void registerDeclarativeType();
|
||||
|
||||
Q_INVOKABLE void showWidget();
|
||||
Q_INVOKABLE void showWidget(int x, int y);
|
||||
Q_INVOKABLE void hideWidget();
|
||||
|
||||
@@ -75,6 +76,7 @@ private:
|
||||
QVariant backendValue() const;
|
||||
QVariant modelNodeBackend() const;
|
||||
QVariant stateModelNode() const;
|
||||
void prepareDialog();
|
||||
|
||||
private:
|
||||
QPointer<BindingEditorDialog> m_dialog;
|
||||
|
||||
@@ -79,14 +79,19 @@ BindingEditorDialog::~BindingEditorDialog()
|
||||
delete m_verticalLayout;
|
||||
}
|
||||
|
||||
void BindingEditorDialog::showWidget(int x, int y)
|
||||
void BindingEditorDialog::showWidget()
|
||||
{
|
||||
this->show();
|
||||
this->raise();
|
||||
move(QPoint(x, y));
|
||||
m_editorWidget->setFocus();
|
||||
}
|
||||
|
||||
void BindingEditorDialog::showWidget(int x, int y)
|
||||
{
|
||||
showWidget();
|
||||
move(QPoint(x, y));
|
||||
}
|
||||
|
||||
QString BindingEditorDialog::editorValue() const
|
||||
{
|
||||
if (!m_editorWidget)
|
||||
|
||||
@@ -67,6 +67,7 @@ public:
|
||||
BindingEditorDialog(QWidget *parent = nullptr, DialogType type = DialogType::BindingDialog);
|
||||
~BindingEditorDialog() override;
|
||||
|
||||
void showWidget();
|
||||
void showWidget(int x, int y);
|
||||
|
||||
QString editorValue() const;
|
||||
|
||||
Reference in New Issue
Block a user