forked from qt-creator/qt-creator
Utils: Restore original look for non-flat project mode on non-macOS
Amends: 74f5ad6583
Change-Id: Ia38e1d82e59d633506703427ee8352e57cc606dc
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -83,18 +83,31 @@ void DetailsButton::paintEvent(QPaintEvent *e)
|
|||||||
Q_UNUSED(e)
|
Q_UNUSED(e)
|
||||||
|
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
if (isChecked() || (!HostOsInfo::isMacHost() && underMouse())) {
|
if (isEnabled() && (isChecked() || (!HostOsInfo::isMacHost() && underMouse()))) {
|
||||||
p.save();
|
p.save();
|
||||||
p.setOpacity(0.125);
|
p.setOpacity(0.125);
|
||||||
p.fillRect(rect(), palette().color(QPalette::Text));
|
p.fillRect(rect(), palette().color(QPalette::Text));
|
||||||
p.restore();
|
p.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode))
|
if (!creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||||
qDrawPlainRect(&p, rect(), palette().color(QPalette::Mid));
|
const QColor outlineColor = palette().color(HostOsInfo::isMacHost() ? QPalette::Mid
|
||||||
|
: QPalette::Midlight);
|
||||||
|
qDrawPlainRect(&p, rect(), outlineColor);
|
||||||
|
}
|
||||||
|
|
||||||
const QRect textRect(spacing, 0, width(), height());
|
const QRect textRect(spacing + 3, 0, width(), height());
|
||||||
p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text());
|
p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text());
|
||||||
const QRect iconRect(width() - spacing - 16, 0, 16, height());
|
if (creatorTheme()->flag(Theme::FlatProjectsMode) || HostOsInfo::isMacHost()) {
|
||||||
|
const QRect iconRect(width() - spacing - 15, 0, 16, height());
|
||||||
icon().paint(&p, iconRect);
|
icon().paint(&p, iconRect);
|
||||||
|
} else {
|
||||||
|
int arrowsize = 15;
|
||||||
|
QStyleOption arrowOpt;
|
||||||
|
arrowOpt.initFrom(this);
|
||||||
|
arrowOpt.rect = QRect(size().width() - arrowsize - spacing, height() / 2 - arrowsize / 2,
|
||||||
|
arrowsize, arrowsize);
|
||||||
|
style()->drawPrimitive(isChecked() ? QStyle::PE_IndicatorArrowUp
|
||||||
|
: QStyle::PE_IndicatorArrowDown, &arrowOpt, &p, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,14 +220,18 @@ void DetailsWidget::paintEvent(QPaintEvent *paintEvent)
|
|||||||
{
|
{
|
||||||
QWidget::paintEvent(paintEvent);
|
QWidget::paintEvent(paintEvent);
|
||||||
|
|
||||||
|
QPainter p(this);
|
||||||
|
if (creatorTheme()->flag(Theme::FlatProjectsMode) || HostOsInfo::isMacHost()) {
|
||||||
const QColor bgColor = creatorTheme()->flag(Theme::FlatProjectsMode) ?
|
const QColor bgColor = creatorTheme()->flag(Theme::FlatProjectsMode) ?
|
||||||
creatorTheme()->color(Theme::DetailsWidgetBackgroundColor)
|
creatorTheme()->color(Theme::DetailsWidgetBackgroundColor)
|
||||||
: palette().color(QPalette::Window);
|
: palette().color(QPalette::Window);
|
||||||
|
|
||||||
QPainter p(this);
|
|
||||||
p.fillRect(rect(), bgColor);
|
p.fillRect(rect(), bgColor);
|
||||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode))
|
}
|
||||||
qDrawPlainRect(&p, rect(), palette().color(QPalette::Mid));
|
if (!creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||||
|
const QColor outlineColor = palette().color(HostOsInfo::isMacHost() ? QPalette::Mid
|
||||||
|
: QPalette::Midlight);
|
||||||
|
qDrawPlainRect(&p, rect(), outlineColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetailsWidget::enterEvent(QEnterEvent *event)
|
void DetailsWidget::enterEvent(QEnterEvent *event)
|
||||||
|
|||||||
Reference in New Issue
Block a user