Commit dbe32f89 authored by con's avatar con

Fix initial position of variable chooser.

It was showing up 'somewhere' depending on platform.

Task-number: QTCREATORBUG-4270
Reviewed-by: Robert Loehning
parent 72d021a6
......@@ -144,7 +144,16 @@ void VariableChooser::createIconButton()
m_iconButton->setPixmap(QPixmap(QLatin1String(":/core/images/replace.png")));
m_iconButton->setToolTip(tr("Insert variable"));
m_iconButton->hide();
connect(m_iconButton, SIGNAL(clicked()), this, SLOT(show()));
connect(m_iconButton, SIGNAL(clicked()), this, SLOT(updatePositionAndShow()));
}
void VariableChooser::updatePositionAndShow()
{
if (parentWidget()) {
QPoint parentCenter = parentWidget()->mapToGlobal(parentWidget()->geometry().center());
move(parentCenter.x() - width()/2, parentCenter.y() - height()/2);
}
show();
}
void VariableChooser::handleItemActivated(QListWidgetItem *item)
......
......@@ -64,6 +64,7 @@ private slots:
void updateCurrentEditor(QWidget *old, QWidget *widget);
void handleItemActivated(QListWidgetItem *item);
void insertVariable(const QString &variable);
void updatePositionAndShow();
private:
void createIconButton();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment