forked from qt-creator/qt-creator
No need for special margin treatmeant anymore
Remove unneded code.
This commit is contained in:
@@ -47,9 +47,9 @@ namespace Utils {
|
|||||||
// in the following way:
|
// in the following way:
|
||||||
//
|
//
|
||||||
// +------------+-------------------------+---------------+
|
// +------------+-------------------------+---------------+
|
||||||
// + toolWidget | summaryLabel | detailsButton |
|
// +summaryLabel| toolwidget | detailsButton |
|
||||||
// +------------+-------------------------+---------------+
|
// +------------+-------------------------+---------------+
|
||||||
// | | widget |
|
// | widget |
|
||||||
// +------------+-------------------------+---------------+
|
// +------------+-------------------------+---------------+
|
||||||
|
|
||||||
struct DetailsWidgetPrivate {
|
struct DetailsWidgetPrivate {
|
||||||
@@ -89,7 +89,7 @@ namespace Utils {
|
|||||||
|
|
||||||
d->m_grid->setContentsMargins(0, 0, 0, 0);
|
d->m_grid->setContentsMargins(0, 0, 0, 0);
|
||||||
d->m_grid->setSpacing(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);
|
d->m_grid->addWidget(d->m_detailsButton, 0, 2);
|
||||||
setLayout(d->m_grid);
|
setLayout(d->m_grid);
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ namespace Utils {
|
|||||||
|
|
||||||
if (d->m_widget) {
|
if (d->m_widget) {
|
||||||
d->m_widget->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
|
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();
|
updateControls();
|
||||||
}
|
}
|
||||||
@@ -224,9 +224,6 @@ namespace Utils {
|
|||||||
d->m_toolWidget->adjustSize();
|
d->m_toolWidget->adjustSize();
|
||||||
d->m_grid->addWidget(d->m_toolWidget, 0, 1, 1, 1, Qt::AlignRight);
|
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);
|
changeHoverState(d->m_hovered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,8 +118,7 @@ BuildSettingsWidget::~BuildSettingsWidget()
|
|||||||
|
|
||||||
BuildSettingsWidget::BuildSettingsWidget(Target *target) :
|
BuildSettingsWidget::BuildSettingsWidget(Target *target) :
|
||||||
m_target(target),
|
m_target(target),
|
||||||
m_buildConfiguration(0),
|
m_buildConfiguration(0)
|
||||||
m_leftMargin(0)
|
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_target);
|
Q_ASSERT(m_target);
|
||||||
setupUi();
|
setupUi();
|
||||||
@@ -127,7 +126,6 @@ BuildSettingsWidget::BuildSettingsWidget(Target *target) :
|
|||||||
|
|
||||||
void BuildSettingsWidget::setupUi()
|
void BuildSettingsWidget::setupUi()
|
||||||
{
|
{
|
||||||
m_leftMargin = Constants::PANEL_LEFT_MARGIN;
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
vbox->setContentsMargins(0, 0, 0, 0);
|
vbox->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
@@ -145,7 +143,7 @@ void BuildSettingsWidget::setupUi()
|
|||||||
|
|
||||||
{ // Edit Build Configuration row
|
{ // Edit Build Configuration row
|
||||||
QHBoxLayout *hbox = new QHBoxLayout();
|
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));
|
hbox->addWidget(new QLabel(tr("Edit build configuration:"), this));
|
||||||
m_buildConfigurationComboBox = new QComboBox(this);
|
m_buildConfigurationComboBox = new QComboBox(this);
|
||||||
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
@@ -191,7 +189,7 @@ void BuildSettingsWidget::setupUi()
|
|||||||
|
|
||||||
void BuildSettingsWidget::addSubWidget(const QString &name, BuildConfigWidget *widget)
|
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);
|
QLabel *label = new QLabel(this);
|
||||||
label->setText(name);
|
label->setText(name);
|
||||||
@@ -200,7 +198,7 @@ void BuildSettingsWidget::addSubWidget(const QString &name, BuildConfigWidget *w
|
|||||||
f.setPointSizeF(f.pointSizeF() * 1.2);
|
f.setPointSizeF(f.pointSizeF() * 1.2);
|
||||||
label->setFont(f);
|
label->setFont(f);
|
||||||
|
|
||||||
label->setContentsMargins(m_leftMargin, 10, 0, 0);
|
label->setContentsMargins(0, 10, 0, 0);
|
||||||
|
|
||||||
layout()->addWidget(label);
|
layout()->addWidget(label);
|
||||||
layout()->addWidget(widget);
|
layout()->addWidget(widget);
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ public:
|
|||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
QWidget *widget() const;
|
QWidget *widget() const;
|
||||||
QIcon icon() const;
|
QIcon icon() const;
|
||||||
PanelFlags flags() const { return IPropertiesPanel::NoLeftMargin; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BuildSettingsWidget *m_widget;
|
BuildSettingsWidget *m_widget;
|
||||||
@@ -119,8 +118,6 @@ private:
|
|||||||
|
|
||||||
QList<BuildConfigWidget *> m_subWidgets;
|
QList<BuildConfigWidget *> m_subWidgets;
|
||||||
QList<QLabel *> m_labels;
|
QList<QLabel *> m_labels;
|
||||||
|
|
||||||
int m_leftMargin;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ using namespace ProjectExplorer::Internal;
|
|||||||
BuildStepsPage::BuildStepsPage(Target *target, StepType type) :
|
BuildStepsPage::BuildStepsPage(Target *target, StepType type) :
|
||||||
BuildConfigWidget(),
|
BuildConfigWidget(),
|
||||||
m_type(type),
|
m_type(type),
|
||||||
m_addButton(0),
|
m_addButton(0)
|
||||||
m_leftMargin(-1)
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(target);
|
Q_UNUSED(target);
|
||||||
|
setStyleSheet("background: red");
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStepsPage::~BuildStepsPage()
|
BuildStepsPage::~BuildStepsPage()
|
||||||
@@ -200,8 +200,7 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step)
|
|||||||
|
|
||||||
s.detailsWidget->setToolWidget(toolWidget);
|
s.detailsWidget->setToolWidget(toolWidget);
|
||||||
|
|
||||||
const int leftMargin(qMax(m_leftMargin - toolWidget->width(), 0));
|
s.detailsWidget->setContentsMargins(0, 0, 0, 1);
|
||||||
s.detailsWidget->setContentsMargins(leftMargin, 0, 0, 1);
|
|
||||||
|
|
||||||
m_buildSteps.insert(pos, s);
|
m_buildSteps.insert(pos, s);
|
||||||
|
|
||||||
@@ -276,11 +275,6 @@ void BuildStepsPage::setupUi()
|
|||||||
if (0 != m_addButton)
|
if (0 != m_addButton)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMargins margins(contentsMargins());
|
|
||||||
m_leftMargin = margins.left();
|
|
||||||
margins.setLeft(0);
|
|
||||||
setContentsMargins(margins);
|
|
||||||
|
|
||||||
m_upMapper = new QSignalMapper(this);
|
m_upMapper = new QSignalMapper(this);
|
||||||
connect(m_upMapper, SIGNAL(mapped(int)),
|
connect(m_upMapper, SIGNAL(mapped(int)),
|
||||||
this, SLOT(stepMoveUp(int)));
|
this, SLOT(stepMoveUp(int)));
|
||||||
@@ -296,11 +290,11 @@ void BuildStepsPage::setupUi()
|
|||||||
m_vbox->setSpacing(0);
|
m_vbox->setSpacing(0);
|
||||||
|
|
||||||
m_noStepsLabel = new QLabel(tr("No Build Steps"), this);
|
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);
|
m_vbox->addWidget(m_noStepsLabel);
|
||||||
|
|
||||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
||||||
hboxLayout->setContentsMargins(m_leftMargin, 4, 0, 0);
|
hboxLayout->setContentsMargins(0, 4, 0, 0);
|
||||||
m_addButton = new QPushButton(this);
|
m_addButton = new QPushButton(this);
|
||||||
m_addButton->setText(m_type == Clean ? tr("Add Clean Step") : tr("Add Build Step"));
|
m_addButton->setText(m_type == Clean ? tr("Add Clean Step") : tr("Add Build Step"));
|
||||||
m_addButton->setMenu(new QMenu(this));
|
m_addButton->setMenu(new QMenu(this));
|
||||||
|
|||||||
@@ -45,12 +45,6 @@ namespace Constants {
|
|||||||
class PROJECTEXPLORER_EXPORT IPropertiesPanel
|
class PROJECTEXPLORER_EXPORT IPropertiesPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum PanelFlag {
|
|
||||||
NoFlag = 0x00,
|
|
||||||
NoLeftMargin = 0x01
|
|
||||||
};
|
|
||||||
Q_DECLARE_FLAGS(PanelFlags, PanelFlag)
|
|
||||||
|
|
||||||
IPropertiesPanel()
|
IPropertiesPanel()
|
||||||
{ }
|
{ }
|
||||||
virtual ~IPropertiesPanel()
|
virtual ~IPropertiesPanel()
|
||||||
@@ -59,7 +53,6 @@ public:
|
|||||||
virtual QString displayName() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
virtual QIcon icon() const = 0;
|
virtual QIcon icon() const = 0;
|
||||||
virtual QWidget *widget() const = 0;
|
virtual QWidget *widget() const = 0;
|
||||||
virtual PanelFlags flags() const { return NoFlag; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject
|
class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject
|
||||||
|
|||||||
@@ -210,9 +210,7 @@ void PanelsWidget::addPropertiesPanel(IPropertiesPanel *panel)
|
|||||||
void PanelsWidget::addPanelWidget(IPropertiesPanel *panel, int row)
|
void PanelsWidget::addPanelWidget(IPropertiesPanel *panel, int row)
|
||||||
{
|
{
|
||||||
QWidget *widget = panel->widget();
|
QWidget *widget = panel->widget();
|
||||||
int leftMargin = (panel->flags() & IPropertiesPanel::NoLeftMargin)
|
widget->setContentsMargins(Constants::PANEL_LEFT_MARGIN,
|
||||||
? 0 : Constants::PANEL_LEFT_MARGIN;
|
|
||||||
widget->setContentsMargins(leftMargin,
|
|
||||||
ABOVE_CONTENTS_MARGIN, 0,
|
ABOVE_CONTENTS_MARGIN, 0,
|
||||||
BELOW_CONTENTS_MARGIN);
|
BELOW_CONTENTS_MARGIN);
|
||||||
widget->setParent(m_root);
|
widget->setParent(m_root);
|
||||||
|
|||||||
Reference in New Issue
Block a user