Commit a2ec8cc9 authored by Jens Bache-Wiig's avatar Jens Bache-Wiig
Browse files

Fix missing tabfocus with manhattanstyle

I added a new focus rect for combo boxes
with manhattan style. To reduce the visual
impact I follow the same policy we use on
windows where we do not show the focus rect
unless it is called upon by tabfocus.
parent 5522e5cd
......@@ -475,6 +475,17 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
QColor lighter(255, 255, 255, 37);
painter->fillRect(rect, lighter);
}
if (option->state & State_HasFocus && (option->state & State_KeyboardFocusChange)) {
QColor highlight = option->palette.highlight().color();
highlight.setAlphaF(0.4);
painter->setPen(QPen(highlight.lighter(), 1));
highlight.setAlphaF(0.3);
painter->setBrush(highlight);
painter->setRenderHint(QPainter::Antialiasing);
QRectF rect = option->rect;
rect.translate(0.5, 0.5);
painter->drawRoundedRect(rect.adjusted(2, 2, -3, -3), 2, 2);
}
}
}
break;
......@@ -819,24 +830,6 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
}
if (toolbutton->state & State_HasFocus) {
QStyleOptionFocusRect fr;
fr.QStyleOption::operator=(*toolbutton);
fr.rect.adjust(3, 3, -3, -3);
if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator,
toolbutton, widget), 0);
QPen oldPen = painter->pen();
QColor focusColor = Utils::StyleHelper::panelTextColor();
focusColor.setAlpha(120);
QPen outline(focusColor, 1);
outline.setStyle(Qt::DotLine);
painter->setPen(outline);
QRect r = option->rect.adjusted(2, 2, -2, -2);
painter->drawRect(r);
painter->setPen(oldPen);
}
QStyleOptionToolButton label = *toolbutton;
label.palette = panelPalette(option->palette, lightColored(widget));
......@@ -938,6 +931,7 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
} else {
drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
}
painter->restore();
}
break;
......
......@@ -376,6 +376,7 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget)
m_navigationComboBox = new NavComboBox(this);
m_navigationComboBox->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
m_navigationComboBox->setFocusPolicy(Qt::TabFocus);
m_navigationComboBox->setMinimumContentsLength(0);
m_navigationWidget = 0;
......
......@@ -385,6 +385,7 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
bar->setFixedHeight(panelHeight);
m_projectsBox = new QComboBox;
m_projectsBox->setFocusPolicy(Qt::TabFocus);
f.setBold(false);
m_projectsBox->setFont(f);
m_projectsBox->ensurePolished();
......
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