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
|
id: bindingEditorParent
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var x = extendedFunctionButton.mapToGlobal(0,0).x - 200
|
bindingEditor.showWidget()
|
||||||
var y = extendedFunctionButton.mapToGlobal(0,0).y - 40
|
|
||||||
bindingEditor.showWidget(x, y)
|
|
||||||
bindingEditor.text = backendValue.expression
|
bindingEditor.text = backendValue.expression
|
||||||
bindingEditor.prepareBindings()
|
bindingEditor.prepareBindings()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,9 +117,7 @@ Rectangle {
|
|||||||
visible: !isBaseState
|
visible: !isBaseState
|
||||||
text: qsTr("Set when Condition")
|
text: qsTr("Set when Condition")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
var x = whenButton.mapToGlobal(0,0).x + 4
|
bindingEditor.showWidget()
|
||||||
var y = root.mapToGlobal(0,0).y - 32
|
|
||||||
bindingEditor.showWidget(x, y)
|
|
||||||
bindingEditor.text = delegateWhenConditionString
|
bindingEditor.text = delegateWhenConditionString
|
||||||
bindingEditor.prepareBindings()
|
bindingEditor.prepareBindings()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void BindingEditor::registerDeclarativeType()
|
|||||||
qmlRegisterType<BindingEditor>("HelperWidgets", 2, 0, "BindingEditor");
|
qmlRegisterType<BindingEditor>("HelperWidgets", 2, 0, "BindingEditor");
|
||||||
}
|
}
|
||||||
|
|
||||||
void BindingEditor::showWidget(int x, int y)
|
void BindingEditor::prepareDialog()
|
||||||
{
|
{
|
||||||
if (s_lastBindingEditor)
|
if (s_lastBindingEditor)
|
||||||
s_lastBindingEditor->hideWidget();
|
s_lastBindingEditor->hideWidget();
|
||||||
@@ -71,6 +71,17 @@ void BindingEditor::showWidget(int x, int y)
|
|||||||
this, &BindingEditor::rejected);
|
this, &BindingEditor::rejected);
|
||||||
|
|
||||||
m_dialog->setAttribute(Qt::WA_DeleteOnClose);
|
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);
|
m_dialog->showWidget(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
|
|
||||||
static void registerDeclarativeType();
|
static void registerDeclarativeType();
|
||||||
|
|
||||||
|
Q_INVOKABLE void showWidget();
|
||||||
Q_INVOKABLE void showWidget(int x, int y);
|
Q_INVOKABLE void showWidget(int x, int y);
|
||||||
Q_INVOKABLE void hideWidget();
|
Q_INVOKABLE void hideWidget();
|
||||||
|
|
||||||
@@ -75,6 +76,7 @@ private:
|
|||||||
QVariant backendValue() const;
|
QVariant backendValue() const;
|
||||||
QVariant modelNodeBackend() const;
|
QVariant modelNodeBackend() const;
|
||||||
QVariant stateModelNode() const;
|
QVariant stateModelNode() const;
|
||||||
|
void prepareDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<BindingEditorDialog> m_dialog;
|
QPointer<BindingEditorDialog> m_dialog;
|
||||||
|
|||||||
@@ -79,14 +79,19 @@ BindingEditorDialog::~BindingEditorDialog()
|
|||||||
delete m_verticalLayout;
|
delete m_verticalLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BindingEditorDialog::showWidget(int x, int y)
|
void BindingEditorDialog::showWidget()
|
||||||
{
|
{
|
||||||
this->show();
|
this->show();
|
||||||
this->raise();
|
this->raise();
|
||||||
move(QPoint(x, y));
|
|
||||||
m_editorWidget->setFocus();
|
m_editorWidget->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BindingEditorDialog::showWidget(int x, int y)
|
||||||
|
{
|
||||||
|
showWidget();
|
||||||
|
move(QPoint(x, y));
|
||||||
|
}
|
||||||
|
|
||||||
QString BindingEditorDialog::editorValue() const
|
QString BindingEditorDialog::editorValue() const
|
||||||
{
|
{
|
||||||
if (!m_editorWidget)
|
if (!m_editorWidget)
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public:
|
|||||||
BindingEditorDialog(QWidget *parent = nullptr, DialogType type = DialogType::BindingDialog);
|
BindingEditorDialog(QWidget *parent = nullptr, DialogType type = DialogType::BindingDialog);
|
||||||
~BindingEditorDialog() override;
|
~BindingEditorDialog() override;
|
||||||
|
|
||||||
|
void showWidget();
|
||||||
void showWidget(int x, int y);
|
void showWidget(int x, int y);
|
||||||
|
|
||||||
QString editorValue() const;
|
QString editorValue() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user