Commit 1aa05ae5 authored by dt's avatar dt

Fix flickering in the project pane.

This isn't a nice fix but the least evil version of a hack i could come
up. The source of the flickering is: We have a deeply nested structure
of widgets on the project pane. If we call hide() on such a deeply
nested widget, it will activate() it's parent layout synchronously.
That will then post an event (via updateGeometries() ) to its parent
layout that it needs relayouting. Which then will post to its parent
layout the same. And for each LayoutRequested, there's a painting in
between. The fix instead calls activate() up the chain until we are at
the viewport. This immediately relayouts everything. This adds a non
obvoius potentially for breakeage if the widgets are embedded in a
different widget hierarchy. But well, that's life.
parent a9fb097d
......@@ -31,6 +31,7 @@
#include "buildconfiguration.h"
#include <utils/qtcassert.h>
#include <QtGui/QLayout>
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
......@@ -133,6 +134,13 @@ bool BuildStep::immutable() const
return false;
}
void BuildConfigWidget::fixupLayout(QWidget *widget)
{
QWidget *parent = widget;
while((parent = parent->parentWidget()) && parent && parent->layout())
parent->layout()->activate();
}
IBuildStepFactory::IBuildStepFactory()
{
......
......@@ -171,6 +171,9 @@ public:
:QWidget(0)
{}
// This function iterates all parents and relayouts
// This is a hack to work around flickering
void fixupLayout(QWidget *widget);
virtual QString displayName() const = 0;
// This is called to set up the config widget before showing it
......
......@@ -97,10 +97,14 @@ BuildStepsPage::~BuildStepsPage()
void BuildStepsPage::toggleDetails()
{
QToolButton *tb = qobject_cast<QToolButton *>(sender());
if (tb)
foreach(const BuildStepsWidgetStruct &s, m_buildSteps)
if (s.detailsButton == tb)
if (tb) {
foreach(const BuildStepsWidgetStruct &s, m_buildSteps) {
if (s.detailsButton == tb) {
s.widget->setVisible(!s.widget->isVisible());
fixupLayout(s.widget);
}
}
}
}
void BuildStepsPage::updateSummary()
......
......@@ -520,9 +520,25 @@ EnvironmentWidget::~EnvironmentWidget()
m_model = 0;
}
bool EnvironmentWidget::detailsVisible() const
{
return m_details->isVisible();
}
void EnvironmentWidget::setDetailsVisible(bool b)
{
m_details->setVisible(b);
}
void EnvironmentWidget::toggleDetails()
{
m_details->setVisible(!m_details->isVisible());
emit detailsVisibleChanged(m_details->isVisible());
}
QWidget *EnvironmentWidget::detailsWidget() const
{
return m_details;
}
void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env)
......
......@@ -104,12 +104,18 @@ public:
QList<EnvironmentItem> userChanges() const;
void setUserChanges(QList<EnvironmentItem> list);
bool detailsVisible() const;
void setDetailsVisible(bool b);
QWidget *detailsWidget() const;
public slots:
void updateButtons();
void toggleDetails();
signals:
void userChangesUpdated();
void detailsVisibleChanged(bool visible);
private slots:
void editEnvironmentButtonClicked();
......
......@@ -76,8 +76,9 @@ PanelsWidget::PanelsWidget(QWidget *parent)
topwidgetLayout->addWidget(verticalWidget);
topwidgetLayout->addStretch(10);
setWidgetResizable(true);
setFrameStyle(QFrame::NoFrame);
setWidgetResizable(true);
setWidget(topwidget);
}
......
......@@ -54,10 +54,18 @@ Qt4BuildEnvironmentWidget::Qt4BuildEnvironmentWidget(Qt4Project *project)
connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()),
this, SLOT(environmentModelUserChangesUpdated()));
connect(m_buildEnvironmentWidget, SIGNAL(detailsVisibleChanged(bool)),
this, SLOT(layoutFixup()));
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
}
void Qt4BuildEnvironmentWidget::layoutFixup()
{
fixupLayout(m_buildEnvironmentWidget->detailsWidget());
}
QString Qt4BuildEnvironmentWidget::displayName() const
{
return tr("Build Environment");
......
......@@ -58,6 +58,7 @@ public:
private slots:
void environmentModelUserChangesUpdated();
void clearSystemEnvironmentCheckBoxClicked(bool checked);
void layoutFixup();
private:
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
......
......@@ -120,6 +120,7 @@ Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
void Qt4ProjectConfigWidget::toggleDetails()
{
m_ui->detailsWidget->setVisible(!m_ui->detailsWidget->isVisible());
fixupLayout(m_ui->detailsWidget);
}
void Qt4ProjectConfigWidget::updateDetails()
......
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