forked from qt-creator/qt-creator
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.
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include "buildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <QtGui/QLayout>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
@@ -133,6 +134,13 @@ bool BuildStep::immutable() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BuildConfigWidget::fixupLayout(QWidget *widget)
|
||||||
|
{
|
||||||
|
QWidget *parent = widget;
|
||||||
|
while((parent = parent->parentWidget()) && parent && parent->layout())
|
||||||
|
parent->layout()->activate();
|
||||||
|
}
|
||||||
|
|
||||||
IBuildStepFactory::IBuildStepFactory()
|
IBuildStepFactory::IBuildStepFactory()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -171,6 +171,9 @@ public:
|
|||||||
:QWidget(0)
|
: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;
|
virtual QString displayName() const = 0;
|
||||||
|
|
||||||
// This is called to set up the config widget before showing it
|
// This is called to set up the config widget before showing it
|
||||||
|
@@ -97,10 +97,14 @@ BuildStepsPage::~BuildStepsPage()
|
|||||||
void BuildStepsPage::toggleDetails()
|
void BuildStepsPage::toggleDetails()
|
||||||
{
|
{
|
||||||
QToolButton *tb = qobject_cast<QToolButton *>(sender());
|
QToolButton *tb = qobject_cast<QToolButton *>(sender());
|
||||||
if (tb)
|
if (tb) {
|
||||||
foreach(const BuildStepsWidgetStruct &s, m_buildSteps)
|
foreach(const BuildStepsWidgetStruct &s, m_buildSteps) {
|
||||||
if (s.detailsButton == tb)
|
if (s.detailsButton == tb) {
|
||||||
s.widget->setVisible(!s.widget->isVisible());
|
s.widget->setVisible(!s.widget->isVisible());
|
||||||
|
fixupLayout(s.widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildStepsPage::updateSummary()
|
void BuildStepsPage::updateSummary()
|
||||||
|
@@ -520,9 +520,25 @@ EnvironmentWidget::~EnvironmentWidget()
|
|||||||
m_model = 0;
|
m_model = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EnvironmentWidget::detailsVisible() const
|
||||||
|
{
|
||||||
|
return m_details->isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnvironmentWidget::setDetailsVisible(bool b)
|
||||||
|
{
|
||||||
|
m_details->setVisible(b);
|
||||||
|
}
|
||||||
|
|
||||||
void EnvironmentWidget::toggleDetails()
|
void EnvironmentWidget::toggleDetails()
|
||||||
{
|
{
|
||||||
m_details->setVisible(!m_details->isVisible());
|
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)
|
void EnvironmentWidget::setBaseEnvironment(const ProjectExplorer::Environment &env)
|
||||||
|
@@ -104,12 +104,18 @@ public:
|
|||||||
QList<EnvironmentItem> userChanges() const;
|
QList<EnvironmentItem> userChanges() const;
|
||||||
void setUserChanges(QList<EnvironmentItem> list);
|
void setUserChanges(QList<EnvironmentItem> list);
|
||||||
|
|
||||||
|
bool detailsVisible() const;
|
||||||
|
void setDetailsVisible(bool b);
|
||||||
|
|
||||||
|
QWidget *detailsWidget() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateButtons();
|
void updateButtons();
|
||||||
void toggleDetails();
|
void toggleDetails();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void userChangesUpdated();
|
void userChangesUpdated();
|
||||||
|
void detailsVisibleChanged(bool visible);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void editEnvironmentButtonClicked();
|
void editEnvironmentButtonClicked();
|
||||||
|
@@ -76,8 +76,9 @@ PanelsWidget::PanelsWidget(QWidget *parent)
|
|||||||
topwidgetLayout->addWidget(verticalWidget);
|
topwidgetLayout->addWidget(verticalWidget);
|
||||||
topwidgetLayout->addStretch(10);
|
topwidgetLayout->addStretch(10);
|
||||||
|
|
||||||
setWidgetResizable(true);
|
|
||||||
setFrameStyle(QFrame::NoFrame);
|
setFrameStyle(QFrame::NoFrame);
|
||||||
|
setWidgetResizable(true);
|
||||||
|
|
||||||
setWidget(topwidget);
|
setWidget(topwidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,10 +54,18 @@ Qt4BuildEnvironmentWidget::Qt4BuildEnvironmentWidget(Qt4Project *project)
|
|||||||
connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()),
|
connect(m_buildEnvironmentWidget, SIGNAL(userChangesUpdated()),
|
||||||
this, SLOT(environmentModelUserChangesUpdated()));
|
this, SLOT(environmentModelUserChangesUpdated()));
|
||||||
|
|
||||||
|
connect(m_buildEnvironmentWidget, SIGNAL(detailsVisibleChanged(bool)),
|
||||||
|
this, SLOT(layoutFixup()));
|
||||||
|
|
||||||
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
|
connect(m_clearSystemEnvironmentCheckBox, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
|
this, SLOT(clearSystemEnvironmentCheckBoxClicked(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Qt4BuildEnvironmentWidget::layoutFixup()
|
||||||
|
{
|
||||||
|
fixupLayout(m_buildEnvironmentWidget->detailsWidget());
|
||||||
|
}
|
||||||
|
|
||||||
QString Qt4BuildEnvironmentWidget::displayName() const
|
QString Qt4BuildEnvironmentWidget::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Build Environment");
|
return tr("Build Environment");
|
||||||
|
@@ -58,6 +58,7 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void environmentModelUserChangesUpdated();
|
void environmentModelUserChangesUpdated();
|
||||||
void clearSystemEnvironmentCheckBoxClicked(bool checked);
|
void clearSystemEnvironmentCheckBoxClicked(bool checked);
|
||||||
|
void layoutFixup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
||||||
|
@@ -120,6 +120,7 @@ Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
|
|||||||
void Qt4ProjectConfigWidget::toggleDetails()
|
void Qt4ProjectConfigWidget::toggleDetails()
|
||||||
{
|
{
|
||||||
m_ui->detailsWidget->setVisible(!m_ui->detailsWidget->isVisible());
|
m_ui->detailsWidget->setVisible(!m_ui->detailsWidget->isVisible());
|
||||||
|
fixupLayout(m_ui->detailsWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4ProjectConfigWidget::updateDetails()
|
void Qt4ProjectConfigWidget::updateDetails()
|
||||||
|
Reference in New Issue
Block a user