forked from qt-creator/qt-creator
Target options layout fixes.
* smaller icon button (waste less space) * align manage/choose buttons Change-Id: Idb2cb111a40353f2405cd964c2ec4f5cf8b24d78 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
6473d7b611
commit
d8d5efcd40
@@ -204,6 +204,7 @@ public:
|
|||||||
QString m_baseDirectory;
|
QString m_baseDirectory;
|
||||||
Environment m_environment;
|
Environment m_environment;
|
||||||
BinaryVersionToolTipEventFilter *m_binaryVersionToolTipEventFilter;
|
BinaryVersionToolTipEventFilter *m_binaryVersionToolTipEventFilter;
|
||||||
|
QList<QAbstractButton *> m_buttons;
|
||||||
};
|
};
|
||||||
|
|
||||||
PathChooserPrivate::PathChooserPrivate(PathChooser *chooser) :
|
PathChooserPrivate::PathChooserPrivate(PathChooser *chooser) :
|
||||||
@@ -270,16 +271,22 @@ PathChooser::~PathChooser()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PathChooser::addButton(const QString &text, QObject *receiver, const char *slotFunc)
|
void PathChooser::addButton(const QString &text, QObject *receiver, const char *slotFunc)
|
||||||
|
{
|
||||||
|
insertButton(d->m_buttons.count(), text, receiver, slotFunc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathChooser::insertButton(int index, const QString &text, QObject *receiver, const char *slotFunc)
|
||||||
{
|
{
|
||||||
QPushButton *button = new QPushButton;
|
QPushButton *button = new QPushButton;
|
||||||
button->setText(text);
|
button->setText(text);
|
||||||
connect(button, SIGNAL(clicked()), receiver, slotFunc);
|
connect(button, SIGNAL(clicked()), receiver, slotFunc);
|
||||||
d->m_hLayout->addWidget(button);
|
d->m_hLayout->insertWidget(index + 1/*line edit*/, button);
|
||||||
|
d->m_buttons.insert(index, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractButton *PathChooser::buttonAtIndex(int index) const
|
QAbstractButton *PathChooser::buttonAtIndex(int index) const
|
||||||
{
|
{
|
||||||
return findChildren<QAbstractButton*>().at(index);
|
return d->m_buttons.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PathChooser::baseDirectory() const
|
QString PathChooser::baseDirectory() const
|
||||||
@@ -343,8 +350,7 @@ bool PathChooser::isReadOnly() const
|
|||||||
void PathChooser::setReadOnly(bool b)
|
void PathChooser::setReadOnly(bool b)
|
||||||
{
|
{
|
||||||
d->m_lineEdit->setReadOnly(b);
|
d->m_lineEdit->setReadOnly(b);
|
||||||
const QList<QAbstractButton *> &allButtons = findChildren<QAbstractButton *>();
|
foreach (QAbstractButton *button, d->m_buttons)
|
||||||
foreach (QAbstractButton *button, allButtons)
|
|
||||||
button->setEnabled(!b);
|
button->setEnabled(!b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -114,6 +114,7 @@ public:
|
|||||||
static QString homePath();
|
static QString homePath();
|
||||||
|
|
||||||
void addButton(const QString &text, QObject *receiver, const char *slotFunc);
|
void addButton(const QString &text, QObject *receiver, const char *slotFunc);
|
||||||
|
void insertButton(int index, const QString &text, QObject *receiver, const char *slotFunc);
|
||||||
QAbstractButton *buttonAtIndex(int index) const;
|
QAbstractButton *buttonAtIndex(int index) const;
|
||||||
|
|
||||||
QLineEdit *lineEdit() const;
|
QLineEdit *lineEdit() const;
|
||||||
|
@@ -96,15 +96,8 @@ DebuggerProfileConfigWidget::DebuggerProfileConfigWidget(ProjectExplorer::Profil
|
|||||||
|
|
||||||
m_chooser->setContentsMargins(0, 0, 0, 0);
|
m_chooser->setContentsMargins(0, 0, 0, 0);
|
||||||
m_chooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
m_chooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||||
|
m_chooser->insertButton(0, tr("Auto detect"), this, SLOT(autoDetectDebugger()));
|
||||||
|
|
||||||
QPushButton *button = new QPushButton(tr("Auto detect"));
|
|
||||||
button->setContentsMargins(0, 0, 0, 0);
|
|
||||||
connect(button, SIGNAL(clicked()), this, SLOT(autoDetectDebugger()));
|
|
||||||
|
|
||||||
QHBoxLayout *box = dynamic_cast<QHBoxLayout *>(m_chooser->layout());
|
|
||||||
QTC_CHECK(box);
|
|
||||||
if (box)
|
|
||||||
box->insertWidget(1, button);
|
|
||||||
layout->addWidget(m_chooser);
|
layout->addWidget(m_chooser);
|
||||||
|
|
||||||
discard();
|
discard();
|
||||||
@@ -137,6 +130,11 @@ bool DebuggerProfileConfigWidget::isDirty() const
|
|||||||
return m_chooser->fileName() != DebuggerProfileInformation::debuggerCommand(m_profile);
|
return m_chooser->fileName() != DebuggerProfileInformation::debuggerCommand(m_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *DebuggerProfileConfigWidget::buttonWidget() const
|
||||||
|
{
|
||||||
|
return m_chooser->buttonAtIndex(1);
|
||||||
|
}
|
||||||
|
|
||||||
void DebuggerProfileConfigWidget::autoDetectDebugger()
|
void DebuggerProfileConfigWidget::autoDetectDebugger()
|
||||||
{
|
{
|
||||||
QVariant v = m_info->defaultValue(m_profile);
|
QVariant v = m_info->defaultValue(m_profile);
|
||||||
|
@@ -65,6 +65,7 @@ public:
|
|||||||
void apply();
|
void apply();
|
||||||
void discard();
|
void discard();
|
||||||
bool isDirty() const;
|
bool isDirty() const;
|
||||||
|
QWidget *buttonWidget() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void autoDetectDebugger();
|
void autoDetectDebugger();
|
||||||
|
@@ -58,6 +58,7 @@ public:
|
|||||||
virtual void discard() = 0;
|
virtual void discard() = 0;
|
||||||
virtual bool isDirty() const = 0;
|
virtual bool isDirty() const = 0;
|
||||||
|
|
||||||
|
virtual QWidget *buttonWidget() const { return 0; }
|
||||||
signals:
|
signals:
|
||||||
void dirty();
|
void dirty();
|
||||||
};
|
};
|
||||||
|
@@ -98,6 +98,11 @@ void SysRootInformationConfigWidget::makeReadOnly()
|
|||||||
m_chooser->setEnabled(false);
|
m_chooser->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *SysRootInformationConfigWidget::buttonWidget() const
|
||||||
|
{
|
||||||
|
return m_chooser->buttonAtIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// ToolChainInformationConfigWidget:
|
// ToolChainInformationConfigWidget:
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@@ -105,7 +110,7 @@ void SysRootInformationConfigWidget::makeReadOnly()
|
|||||||
ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Profile *p, QWidget *parent) :
|
ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Profile *p, QWidget *parent) :
|
||||||
ProfileConfigWidget(parent),
|
ProfileConfigWidget(parent),
|
||||||
m_isReadOnly(false), m_profile(p),
|
m_isReadOnly(false), m_profile(p),
|
||||||
m_comboBox(new QComboBox), m_manageButton(new QPushButton)
|
m_comboBox(new QComboBox), m_manageButton(new QPushButton(this))
|
||||||
{
|
{
|
||||||
ToolChainManager *tcm = ToolChainManager::instance();
|
ToolChainManager *tcm = ToolChainManager::instance();
|
||||||
|
|
||||||
@@ -126,7 +131,6 @@ ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Profile *p, Q
|
|||||||
|
|
||||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||||
m_manageButton->setText(tr("Manage..."));
|
m_manageButton->setText(tr("Manage..."));
|
||||||
layout->addWidget(m_manageButton);
|
|
||||||
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageToolChains()));
|
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageToolChains()));
|
||||||
|
|
||||||
connect(tcm, SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
|
connect(tcm, SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
|
||||||
@@ -166,6 +170,11 @@ void ToolChainInformationConfigWidget::makeReadOnly()
|
|||||||
m_comboBox->setEnabled(false);
|
m_comboBox->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *ToolChainInformationConfigWidget::buttonWidget() const
|
||||||
|
{
|
||||||
|
return m_manageButton;
|
||||||
|
}
|
||||||
|
|
||||||
void ToolChainInformationConfigWidget::toolChainAdded(ProjectExplorer::ToolChain *tc)
|
void ToolChainInformationConfigWidget::toolChainAdded(ProjectExplorer::ToolChain *tc)
|
||||||
{
|
{
|
||||||
m_comboBox->addItem(tc->displayName(), tc->id());
|
m_comboBox->addItem(tc->displayName(), tc->id());
|
||||||
@@ -292,7 +301,7 @@ void DeviceTypeInformationConfigWidget::makeReadOnly()
|
|||||||
DeviceInformationConfigWidget::DeviceInformationConfigWidget(Profile *p, QWidget *parent) :
|
DeviceInformationConfigWidget::DeviceInformationConfigWidget(Profile *p, QWidget *parent) :
|
||||||
ProfileConfigWidget(parent),
|
ProfileConfigWidget(parent),
|
||||||
m_isReadOnly(false), m_profile(p),
|
m_isReadOnly(false), m_profile(p),
|
||||||
m_comboBox(new QComboBox), m_manageButton(new QPushButton),
|
m_comboBox(new QComboBox), m_manageButton(new QPushButton(this)),
|
||||||
m_model(new DeviceManagerModel(DeviceManager::instance()))
|
m_model(new DeviceManagerModel(DeviceManager::instance()))
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||||
@@ -305,7 +314,6 @@ DeviceInformationConfigWidget::DeviceInformationConfigWidget(Profile *p, QWidget
|
|||||||
|
|
||||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||||
m_manageButton->setText(tr("Manage..."));
|
m_manageButton->setText(tr("Manage..."));
|
||||||
layout->addWidget(m_manageButton);
|
|
||||||
|
|
||||||
discard();
|
discard();
|
||||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
|
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
|
||||||
@@ -343,6 +351,11 @@ void DeviceInformationConfigWidget::makeReadOnly()
|
|||||||
m_comboBox->setEnabled(false);
|
m_comboBox->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *DeviceInformationConfigWidget::buttonWidget() const
|
||||||
|
{
|
||||||
|
return m_manageButton;
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceInformationConfigWidget::manageDevices()
|
void DeviceInformationConfigWidget::manageDevices()
|
||||||
{
|
{
|
||||||
Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY),
|
Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY),
|
||||||
|
@@ -64,6 +64,7 @@ public:
|
|||||||
void discard();
|
void discard();
|
||||||
bool isDirty() const;
|
bool isDirty() const;
|
||||||
void makeReadOnly();
|
void makeReadOnly();
|
||||||
|
QWidget *buttonWidget() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Profile *m_profile;
|
Profile *m_profile;
|
||||||
@@ -86,6 +87,7 @@ public:
|
|||||||
void discard();
|
void discard();
|
||||||
bool isDirty() const;
|
bool isDirty() const;
|
||||||
void makeReadOnly();
|
void makeReadOnly();
|
||||||
|
QWidget *buttonWidget() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toolChainAdded(ProjectExplorer::ToolChain *tc);
|
void toolChainAdded(ProjectExplorer::ToolChain *tc);
|
||||||
@@ -142,6 +144,7 @@ public:
|
|||||||
void discard();
|
void discard();
|
||||||
bool isDirty() const;
|
bool isDirty() const;
|
||||||
void makeReadOnly();
|
void makeReadOnly();
|
||||||
|
QWidget *buttonWidget() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void manageDevices();
|
void manageDevices();
|
||||||
|
@@ -36,24 +36,24 @@
|
|||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFormLayout>
|
#include <QGridLayout>
|
||||||
#include <QPushButton>
|
#include <QLabel>
|
||||||
|
#include <QToolButton>
|
||||||
#include <QSizePolicy>
|
#include <QSizePolicy>
|
||||||
|
#include <QStyle>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ProfileManagerConfigWidget::ProfileManagerConfigWidget(Profile *p, QWidget *parent) :
|
ProfileManagerConfigWidget::ProfileManagerConfigWidget(Profile *p, QWidget *parent) :
|
||||||
ProfileConfigWidget(parent),
|
ProfileConfigWidget(parent),
|
||||||
m_layout(new QFormLayout),
|
m_layout(new QGridLayout),
|
||||||
m_iconButton(new QPushButton),
|
m_iconButton(new QToolButton),
|
||||||
m_profile(p)
|
m_profile(p)
|
||||||
{
|
{
|
||||||
m_layout->setMargin(0);
|
m_layout->setMargin(0);
|
||||||
m_layout->setSpacing(6);
|
m_layout->setSpacing(6);
|
||||||
|
|
||||||
m_iconButton->setMinimumSize(70, 70);
|
|
||||||
m_iconButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
||||||
QVBoxLayout *iconLayout = new QVBoxLayout;
|
QVBoxLayout *iconLayout = new QVBoxLayout;
|
||||||
iconLayout->addWidget(m_iconButton);
|
iconLayout->addWidget(m_iconButton);
|
||||||
iconLayout->addStretch();
|
iconLayout->addStretch();
|
||||||
@@ -103,7 +103,12 @@ void ProfileManagerConfigWidget::addConfigWidget(ProjectExplorer::ProfileConfigW
|
|||||||
Q_ASSERT(!m_widgets.contains(widget));
|
Q_ASSERT(!m_widgets.contains(widget));
|
||||||
|
|
||||||
connect(widget, SIGNAL(dirty()), this, SIGNAL(dirty()));
|
connect(widget, SIGNAL(dirty()), this, SIGNAL(dirty()));
|
||||||
m_layout->addRow(widget->displayName(), widget);
|
int row = m_layout->rowCount();
|
||||||
|
m_layout->addWidget(new QLabel(widget->displayName()), row, 0,
|
||||||
|
Qt::Alignment(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment)));
|
||||||
|
m_layout->addWidget(widget, row, 1);
|
||||||
|
if (widget->buttonWidget())
|
||||||
|
m_layout->addWidget(widget->buttonWidget(), row, 2);
|
||||||
m_widgets.append(widget);
|
m_widgets.append(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
class QFormLayout;
|
class QGridLayout;
|
||||||
class QPushButton;
|
class QToolButton;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -65,8 +65,8 @@ private slots:
|
|||||||
void setIcon();
|
void setIcon();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFormLayout *m_layout;
|
QGridLayout *m_layout;
|
||||||
QPushButton *m_iconButton;
|
QToolButton *m_iconButton;
|
||||||
QList<ProfileConfigWidget *> m_widgets;
|
QList<ProfileConfigWidget *> m_widgets;
|
||||||
Profile *m_profile;
|
Profile *m_profile;
|
||||||
QString m_iconPath;
|
QString m_iconPath;
|
||||||
|
@@ -53,7 +53,7 @@ QtProfileConfigWidget::QtProfileConfigWidget(ProjectExplorer::Profile *p,
|
|||||||
ProjectExplorer::ProfileConfigWidget(parent),
|
ProjectExplorer::ProfileConfigWidget(parent),
|
||||||
m_profile(p),
|
m_profile(p),
|
||||||
m_combo(new QComboBox),
|
m_combo(new QComboBox),
|
||||||
m_manageButton(new QPushButton)
|
m_manageButton(new QPushButton(this))
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
@@ -64,7 +64,6 @@ QtProfileConfigWidget::QtProfileConfigWidget(ProjectExplorer::Profile *p,
|
|||||||
|
|
||||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||||
m_manageButton->setText(tr("Manage..."));
|
m_manageButton->setText(tr("Manage..."));
|
||||||
layout->addWidget(m_manageButton);
|
|
||||||
|
|
||||||
QtVersionManager *mgr = QtVersionManager::instance();
|
QtVersionManager *mgr = QtVersionManager::instance();
|
||||||
|
|
||||||
@@ -114,6 +113,11 @@ bool QtProfileConfigWidget::isDirty() const
|
|||||||
return id != QtProfileInformation::qtVersionId(m_profile);
|
return id != QtProfileInformation::qtVersionId(m_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *QtProfileConfigWidget::buttonWidget() const
|
||||||
|
{
|
||||||
|
return m_manageButton;
|
||||||
|
}
|
||||||
|
|
||||||
void QtProfileConfigWidget::versionsChanged(const QList<int> &added, const QList<int> &removed,
|
void QtProfileConfigWidget::versionsChanged(const QList<int> &added, const QList<int> &removed,
|
||||||
const QList<int> &changed)
|
const QList<int> &changed)
|
||||||
{
|
{
|
||||||
|
@@ -59,6 +59,7 @@ public:
|
|||||||
void apply();
|
void apply();
|
||||||
void discard();
|
void discard();
|
||||||
bool isDirty() const;
|
bool isDirty() const;
|
||||||
|
QWidget *buttonWidget() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void versionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
|
void versionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
|
||||||
|
Reference in New Issue
Block a user