Commit a22ad73b authored by Daniel Molkentin's avatar Daniel Molkentin

Prevent improper sizing of MiniProjectTargetSelector

The selector would sometimes be too high (if projects were removed),
and sometimes show vertical scrollbars (if projects were added). This
problem was limited to the first time that the widget was opened on
all platforms but on OS X, where it could be observed persistently
and where its lack potentially can cause problems due to ed5d10a1.

Reviewed-by: con
Task-Number: QTCREATORBUG-1792
parent 5467906f
......@@ -415,13 +415,16 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
void MiniProjectTargetSelector::setVisible(bool visible)
{
if (visible) {
resize(sizeHint());
QSize sh = sizeHint();
resize(sh);
QStatusBar *statusBar = Core::ICore::instance()->statusBar();
QPoint moveTo = statusBar->mapToGlobal(QPoint(0,0));
moveTo -= QPoint(0, sizeHint().height());
moveTo -= QPoint(0, sh.height());
move(moveTo);
}
QWidget::setVisible(visible);
if (m_widgetStack->currentWidget())
m_widgetStack->currentWidget()->setFocus();
......@@ -533,6 +536,8 @@ void MiniProjectTargetSelector::addTarget(ProjectExplorer::Target *target, bool
if (activeTarget)
plw->setCurrentItem(lwi, QItemSelectionModel::SelectCurrent);
m_widgetStack->updateGeometry();
}
void MiniProjectTargetSelector::removeTarget(ProjectExplorer::Target *target)
......@@ -554,9 +559,12 @@ void MiniProjectTargetSelector::removeTarget(ProjectExplorer::Target *target)
delete plw->takeItem(i);
delete mtw;
}
disconnect(target, SIGNAL(toolTipChanged()), this, SLOT(updateAction()));
disconnect(target, SIGNAL(iconChanged()), this, SLOT(updateAction()));
disconnect(target, SIGNAL(overlayIconChanged()), this, SLOT(updateAction()));
m_widgetStack->updateGeometry();
}
void MiniProjectTargetSelector::changeActiveTarget(ProjectExplorer::Target *target)
......
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