From 070f4df48529de1a1693ba979261e16121b9739c Mon Sep 17 00:00:00 2001 From: dt <qtc-committer@nokia.com> Date: Fri, 21 May 2010 14:29:11 +0200 Subject: [PATCH] No need for special margin treatmeant anymore Remove unneded code. --- src/libs/utils/detailswidget.cpp | 11 ++++------- .../buildsettingspropertiespage.cpp | 10 ++++------ .../buildsettingspropertiespage.h | 3 --- src/plugins/projectexplorer/buildstepspage.cpp | 16 +++++----------- src/plugins/projectexplorer/iprojectproperties.h | 7 ------- src/plugins/projectexplorer/projectwindow.cpp | 4 +--- 6 files changed, 14 insertions(+), 37 deletions(-) diff --git a/src/libs/utils/detailswidget.cpp b/src/libs/utils/detailswidget.cpp index 7b8053ce129..9a1e68b1edf 100644 --- a/src/libs/utils/detailswidget.cpp +++ b/src/libs/utils/detailswidget.cpp @@ -47,9 +47,9 @@ namespace Utils { // in the following way: // // +------------+-------------------------+---------------+ - // + toolWidget | summaryLabel | detailsButton | + // +summaryLabel| toolwidget | detailsButton | // +------------+-------------------------+---------------+ - // | | widget | + // | widget | // +------------+-------------------------+---------------+ struct DetailsWidgetPrivate { @@ -89,7 +89,7 @@ namespace Utils { d->m_grid->setContentsMargins(0, 0, 0, 0); d->m_grid->setSpacing(0); - d->m_grid->addWidget(d->m_summaryLabel, 0, 1); + d->m_grid->addWidget(d->m_summaryLabel, 0, 0); d->m_grid->addWidget(d->m_detailsButton, 0, 2); setLayout(d->m_grid); @@ -206,7 +206,7 @@ namespace Utils { if (d->m_widget) { d->m_widget->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN); - d->m_grid->addWidget(d->m_widget, 1, 1, 1, 2); + d->m_grid->addWidget(d->m_widget, 1, 0, 1, 3); } updateControls(); } @@ -224,9 +224,6 @@ namespace Utils { d->m_toolWidget->adjustSize(); d->m_grid->addWidget(d->m_toolWidget, 0, 1, 1, 1, Qt::AlignRight); - d->m_grid->setColumnMinimumWidth(0, d->m_toolWidget->width()); - d->m_grid->setRowMinimumHeight(0, d->m_toolWidget->height()); - changeHoverState(d->m_hovered); } diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index cc8f99c4ce9..11454fe015d 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -118,8 +118,7 @@ BuildSettingsWidget::~BuildSettingsWidget() BuildSettingsWidget::BuildSettingsWidget(Target *target) : m_target(target), - m_buildConfiguration(0), - m_leftMargin(0) + m_buildConfiguration(0) { Q_ASSERT(m_target); setupUi(); @@ -127,7 +126,6 @@ BuildSettingsWidget::BuildSettingsWidget(Target *target) : void BuildSettingsWidget::setupUi() { - m_leftMargin = Constants::PANEL_LEFT_MARGIN; QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setContentsMargins(0, 0, 0, 0); @@ -145,7 +143,7 @@ void BuildSettingsWidget::setupUi() { // Edit Build Configuration row QHBoxLayout *hbox = new QHBoxLayout(); - hbox->setContentsMargins(m_leftMargin, 0, 0, 0); + hbox->setContentsMargins(0, 0, 0, 0); hbox->addWidget(new QLabel(tr("Edit build configuration:"), this)); m_buildConfigurationComboBox = new QComboBox(this); m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); @@ -191,7 +189,7 @@ void BuildSettingsWidget::setupUi() void BuildSettingsWidget::addSubWidget(const QString &name, BuildConfigWidget *widget) { - widget->setContentsMargins(m_leftMargin, 10, 0, 0); + widget->setContentsMargins(0, 10, 0, 0); QLabel *label = new QLabel(this); label->setText(name); @@ -200,7 +198,7 @@ void BuildSettingsWidget::addSubWidget(const QString &name, BuildConfigWidget *w f.setPointSizeF(f.pointSizeF() * 1.2); label->setFont(f); - label->setContentsMargins(m_leftMargin, 10, 0, 0); + label->setContentsMargins(0, 10, 0, 0); layout()->addWidget(label); layout()->addWidget(widget); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h index e93f849c90c..444e381b142 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.h +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h @@ -71,7 +71,6 @@ public: QString displayName() const; QWidget *widget() const; QIcon icon() const; - PanelFlags flags() const { return IPropertiesPanel::NoLeftMargin; } private: BuildSettingsWidget *m_widget; @@ -119,8 +118,6 @@ private: QList<BuildConfigWidget *> m_subWidgets; QList<QLabel *> m_labels; - - int m_leftMargin; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index ffb06bc9eb6..25cf61e9b54 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -53,10 +53,10 @@ using namespace ProjectExplorer::Internal; BuildStepsPage::BuildStepsPage(Target *target, StepType type) : BuildConfigWidget(), m_type(type), - m_addButton(0), - m_leftMargin(-1) + m_addButton(0) { Q_UNUSED(target); + setStyleSheet("background: red"); } BuildStepsPage::~BuildStepsPage() @@ -200,8 +200,7 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step) s.detailsWidget->setToolWidget(toolWidget); - const int leftMargin(qMax(m_leftMargin - toolWidget->width(), 0)); - s.detailsWidget->setContentsMargins(leftMargin, 0, 0, 1); + s.detailsWidget->setContentsMargins(0, 0, 0, 1); m_buildSteps.insert(pos, s); @@ -276,11 +275,6 @@ void BuildStepsPage::setupUi() if (0 != m_addButton) return; - QMargins margins(contentsMargins()); - m_leftMargin = margins.left(); - margins.setLeft(0); - setContentsMargins(margins); - m_upMapper = new QSignalMapper(this); connect(m_upMapper, SIGNAL(mapped(int)), this, SLOT(stepMoveUp(int))); @@ -296,11 +290,11 @@ void BuildStepsPage::setupUi() m_vbox->setSpacing(0); m_noStepsLabel = new QLabel(tr("No Build Steps"), this); - m_noStepsLabel->setContentsMargins(m_leftMargin, 0, 0, 0); + m_noStepsLabel->setContentsMargins(0, 0, 0, 0); m_vbox->addWidget(m_noStepsLabel); QHBoxLayout *hboxLayout = new QHBoxLayout(); - hboxLayout->setContentsMargins(m_leftMargin, 4, 0, 0); + hboxLayout->setContentsMargins(0, 4, 0, 0); m_addButton = new QPushButton(this); m_addButton->setText(m_type == Clean ? tr("Add Clean Step") : tr("Add Build Step")); m_addButton->setMenu(new QMenu(this)); diff --git a/src/plugins/projectexplorer/iprojectproperties.h b/src/plugins/projectexplorer/iprojectproperties.h index 63b7df301f7..052e3dceadf 100644 --- a/src/plugins/projectexplorer/iprojectproperties.h +++ b/src/plugins/projectexplorer/iprojectproperties.h @@ -45,12 +45,6 @@ namespace Constants { class PROJECTEXPLORER_EXPORT IPropertiesPanel { public: - enum PanelFlag { - NoFlag = 0x00, - NoLeftMargin = 0x01 - }; - Q_DECLARE_FLAGS(PanelFlags, PanelFlag) - IPropertiesPanel() { } virtual ~IPropertiesPanel() @@ -59,7 +53,6 @@ public: virtual QString displayName() const = 0; virtual QIcon icon() const = 0; virtual QWidget *widget() const = 0; - virtual PanelFlags flags() const { return NoFlag; } }; class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index ab7476226de..e1c15fc3391 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -210,9 +210,7 @@ void PanelsWidget::addPropertiesPanel(IPropertiesPanel *panel) void PanelsWidget::addPanelWidget(IPropertiesPanel *panel, int row) { QWidget *widget = panel->widget(); - int leftMargin = (panel->flags() & IPropertiesPanel::NoLeftMargin) - ? 0 : Constants::PANEL_LEFT_MARGIN; - widget->setContentsMargins(leftMargin, + widget->setContentsMargins(Constants::PANEL_LEFT_MARGIN, ABOVE_CONTENTS_MARGIN, 0, BELOW_CONTENTS_MARGIN); widget->setParent(m_root); -- GitLab