Prevent flicker on MiniProjectTargetSelector show

Reproducible on Mac OS X.

Set position before changing the visible state.

Change-Id: I8a7e73dae94ceb865ea8a7ef4cec4112220888de
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Morten Johan Sørvig
2014-05-19 09:16:34 +02:00
committed by Eike Ziller
parent e167864063
commit bd197fbb77

View File

@@ -852,7 +852,7 @@ void MiniProjectTargetSelector::doLayout(bool keepSize)
int oldSummaryLabelY = m_summaryLabel->y(); int oldSummaryLabelY = m_summaryLabel->y();
int kitAreaHeight = m_kitAreaWidget->isVisible() ? m_kitAreaWidget->sizeHint().height() : 0; int kitAreaHeight = m_kitAreaWidget->isVisibleTo(this) ? m_kitAreaWidget->sizeHint().height() : 0;
// 1. Calculate the summary label height // 1. Calculate the summary label height
int summaryLabelY = 1 + kitAreaHeight; int summaryLabelY = 1 + kitAreaHeight;
@@ -959,12 +959,10 @@ void MiniProjectTargetSelector::doLayout(bool keepSize)
setFixedSize(m_summaryLabel->width() + 1, heightWithoutKitArea + kitAreaHeight); //1 extra pixel for the border setFixedSize(m_summaryLabel->width() + 1, heightWithoutKitArea + kitAreaHeight); //1 extra pixel for the border
} }
if (isVisibleTo(parentWidget())) {
QPoint moveTo = statusBar->mapToGlobal(QPoint(0,0)); QPoint moveTo = statusBar->mapToGlobal(QPoint(0,0));
moveTo -= QPoint(0, height()); moveTo -= QPoint(0, height());
move(moveTo); move(moveTo);
} }
}
void MiniProjectTargetSelector::setActiveTarget(ProjectExplorer::ProjectConfiguration *pc) void MiniProjectTargetSelector::setActiveTarget(ProjectExplorer::ProjectConfiguration *pc)
{ {
@@ -1403,10 +1401,10 @@ void MiniProjectTargetSelector::activeRunConfigurationChanged(ProjectExplorer::R
void MiniProjectTargetSelector::setVisible(bool visible) void MiniProjectTargetSelector::setVisible(bool visible)
{ {
doLayout(false);
QWidget::setVisible(visible); QWidget::setVisible(visible);
m_projectAction->setChecked(visible); m_projectAction->setChecked(visible);
if (visible) { if (visible) {
doLayout(false);
if (!focusWidget() || !focusWidget()->isVisibleTo(this)) { // Does the second part actually work? if (!focusWidget() || !focusWidget()->isVisibleTo(this)) { // Does the second part actually work?
if (m_projectListWidget->isVisibleTo(this)) if (m_projectListWidget->isVisibleTo(this))
m_projectListWidget->setFocus(); m_projectListWidget->setFocus();