Commit 23ab77bf authored by Tobias Hunger's avatar Tobias Hunger

KitInformation: Improve handling of styling

Make the styling work better, especially when the kit information
is displayed in the MiniProjectTargetSelector.

Change-Id: I562c1c92942afbfec1b960740a326c4dd002864f
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent 9b52d193
......@@ -59,4 +59,20 @@ QString KitConfigWidget::msgManage()
return tr("Manage...");
}
void KitConfigWidget::setPalette(const QPalette &p)
{
if (mainWidget())
mainWidget()->setPalette(p);
if (buttonWidget())
buttonWidget()->setPalette(p);
}
void KitConfigWidget::setStyle(QStyle *s)
{
if (mainWidget())
mainWidget()->setStyle(s);
if (buttonWidget())
buttonWidget()->setStyle(s);
}
} // namespace ProjectExplorer
......@@ -72,6 +72,9 @@ public:
Kit *kit() const { return m_kit; }
virtual void setPalette(const QPalette &p);
virtual void setStyle(QStyle *s);
signals:
void dirty();
......
......@@ -93,6 +93,12 @@ QString SysRootInformationConfigWidget::toolTip() const
"Leave empty when building for the desktop.");
}
void SysRootInformationConfigWidget::setPalette(const QPalette &p)
{
KitConfigWidget::setPalette(p);
m_chooser->setOkColor(p.color(QPalette::Active, QPalette::Text));
}
void SysRootInformationConfigWidget::refresh()
{
if (!m_ignoreChange)
......
......@@ -72,6 +72,8 @@ public:
QWidget *mainWidget() const;
QString toolTip() const;
void setPalette(const QPalette &p);
private:
void pathWasChanged();
......
......@@ -583,22 +583,16 @@ void KitAreaWidget::setKit(Kit *k)
if (k && k->isMutable(ki->id())) {
KitConfigWidget *widget = ki->createConfigWidget(k);
m_widgets << widget;
QList<QWidget *> rowWidgets;
QLabel *label = new QLabel(widget->displayName());
m_labels << label;
rowWidgets.append(label);
rowWidgets.append(widget->mainWidget());
rowWidgets.append(widget->buttonWidget());
widget->setStyle(QStyleFactory::create(QLatin1String("fusion")));
widget->setPalette(palette());
m_layout->addWidget(label, row, 0);
m_layout->addWidget(widget->mainWidget(), row, 1);
m_layout->addWidget(widget->buttonWidget(), row, 2);
for (int i = 0; i < rowWidgets.count(); ++i) {
QWidget *w = rowWidgets.at(i);
m_layout->addWidget(w, row, i);
if (w && i > 0) {
w->setStyle(QStyleFactory::create(QLatin1String("fusion")));
w->setPalette(palette());
}
}
++row;
}
}
......
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