Commit 06ab6e66 authored by Tobias Hunger's avatar Tobias Hunger

Fix graphic glitches in project mode

Fix rendering issues in the build step lists display of the project
mode: The label got dropped from the layout.

Never drop the widgets from the layout to avoid this issue:-)

Change-Id: I912a8b6d78537f0c395c2bc440387b20b66a4584
Reviewed-on: http://codereview.qt.nokia.com/2126Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 94a71d2e
......@@ -105,14 +105,20 @@ DetailsWidgetPrivate::DetailsWidgetPrivate(QWidget *parent) :
m_hovered(false),
m_useCheckBox(false)
{
QHBoxLayout *summaryLayout = new QHBoxLayout;
summaryLayout->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
summaryLayout->setSpacing(0);
m_summaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
m_summaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_summaryLabel->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
m_summaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_summaryLabel->setContentsMargins(0, 0, 0, 0);
summaryLayout->addWidget(m_summaryLabel);
m_summaryCheckBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_summaryCheckBox->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
m_summaryCheckBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_summaryCheckBox->setAttribute(Qt::WA_LayoutUsesWidgetRect); /* broken layout on mac otherwise */
m_summaryCheckBox->setVisible(false);
m_summaryCheckBox->setContentsMargins(0, 0, 0, 0);
summaryLayout->addWidget(m_summaryCheckBox);
m_additionalSummaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
m_additionalSummaryLabel->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
......@@ -121,7 +127,7 @@ DetailsWidgetPrivate::DetailsWidgetPrivate(QWidget *parent) :
m_grid->setContentsMargins(0, 0, 0, 0);
m_grid->setSpacing(0);
m_grid->addWidget(m_summaryLabel, 0, 0);
m_grid->addLayout(summaryLayout, 0, 0);
m_grid->addWidget(m_detailsButton, 0, 2);
m_grid->addWidget(m_additionalSummaryLabel, 1, 0, 1, 3);
}
......@@ -168,7 +174,6 @@ void DetailsWidgetPrivate::updateControls()
if (m_widget)
m_widget->setVisible(m_state == DetailsWidget::Expanded || m_state == DetailsWidget::NoSummary);
m_detailsButton->setChecked(m_state == DetailsWidget::Expanded && m_widget);
//m_summaryLabel->setEnabled(m_state == DetailsWidget::Collapsed && m_widget);
m_detailsButton->setVisible(m_state != DetailsWidget::NoSummary);
m_summaryLabel->setVisible(m_state != DetailsWidget::NoSummary && !m_useCheckBox);
m_summaryCheckBox->setVisible(m_state != DetailsWidget::NoSummary && m_useCheckBox);
......@@ -202,6 +207,8 @@ DetailsWidget::DetailsWidget(QWidget *parent) :
{
setLayout(d->m_grid);
setUseCheckBox(false);
connect(d->m_detailsButton, SIGNAL(toggled(bool)),
this, SLOT(setExpanded(bool)));
connect(d->m_summaryCheckBox, SIGNAL(toggled(bool)),
......@@ -224,8 +231,6 @@ bool DetailsWidget::useCheckBox()
void DetailsWidget::setUseCheckBox(bool b)
{
d->m_useCheckBox = b;
QWidget *widget = b ? static_cast<QWidget *>(d->m_summaryCheckBox) : static_cast<QWidget *>(d->m_summaryLabel);
d->m_grid->addWidget(widget, 0, 0);
d->m_summaryLabel->setVisible(b);
d->m_summaryCheckBox->setVisible(!b);
}
......@@ -260,7 +265,7 @@ void DetailsWidget::paintEvent(QPaintEvent *paintEvent)
QPainter p(this);
QWidget *topLeftWidget = d->m_useCheckBox ? static_cast<QWidget *>(d->m_summaryCheckBox) : static_cast<QWidget *>(d->m_summaryLabel);
QPoint topLeft(topLeftWidget->geometry().left(), contentsRect().top());
QPoint topLeft(topLeftWidget->geometry().left() - MARGIN, contentsRect().top());
const QRect paintArea(topLeft, contentsRect().bottomRight());
if (d->m_state != Expanded) {
......
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