Fix initial position of variable chooser.

It was showing up 'somewhere' depending on platform.

Task-number: QTCREATORBUG-4270
Reviewed-by: Robert Loehning
This commit is contained in:
con
2011-03-30 14:28:34 +02:00
parent 72d021a6ab
commit dbe32f8944
2 changed files with 11 additions and 1 deletions

View File

@@ -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)