Commit bf7c3580 authored by pontaoski's avatar pontaoski 🌈 Committed by Nate Graham
Browse files

Revert "[kstyle]: Add double-ringed focus for text fields"

This reverts commit 2f351fe1.

We hve not yet figured out how to apply this style consistently
and were unable to implement it for controls other than text fields
in Plasma 5.21, so it is better to remove it for now than to have an
inconsistent UI. We will re-evaluate this for Plasma 5.22.

BUG: 430944
BUG: 430943
BUG: 433421
FIXED-IN: 5.21.2


(cherry picked from commit f9758726)
parent da9593d3
......@@ -515,8 +515,7 @@ namespace Breeze
//______________________________________________________________________________
void Helper::renderFrame(
QPainter* painter, const QRect& rect,
const QColor& color, const QColor& outline,
FrameHints hints ) const
const QColor& color, const QColor& outline ) const
{
painter->setRenderHint( QPainter::Antialiasing );
......@@ -542,19 +541,6 @@ namespace Breeze
if( color.isValid() ) painter->setBrush( color );
else painter->setBrush( Qt::NoBrush );
if (hints & FrameHint::DoubleRing) {
painter->save();
{
auto rect2 = frameRect.adjusted( -2, -2, 2, 2 );
painter->setPen( Qt::NoPen );
painter->setBrush( outline );
painter->setOpacity( 0.4 );
painter->drawRoundedRect(rect2, radius*2, radius*2);
}
painter->restore();
}
// render
painter->drawRoundedRect( frameRect, radius, radius );
......
......@@ -33,14 +33,6 @@ namespace Breeze
public:
enum class FrameHint {
None = 0,
DoubleRing = 1,
};
Q_ENUM(FrameHint)
Q_DECLARE_FLAGS(FrameHints, FrameHint)
//* constructor
explicit Helper( KSharedConfig::Ptr, QObject *parent = nullptr );
......@@ -173,7 +165,7 @@ namespace Breeze
void renderFocusLine( QPainter*, const QRect&, const QColor& ) const;
//* generic frame
void renderFrame( QPainter*, const QRect&, const QColor& color, const QColor& outline = QColor(), FrameHints hints = FrameHint::None ) const;
void renderFrame( QPainter*, const QRect&, const QColor& color, const QColor& outline = QColor() ) const;
//* side panel frame
void renderSidePanelFrame( QPainter*, const QRect&, const QColor& outline, Side ) const;
......
......@@ -44,12 +44,7 @@ namespace Breeze
static constexpr int Layout_DefaultSpacing = 6;
// line editors
struct LineEdit {
static constexpr int FrameWidth = 6;
static constexpr int Margin = 2;
static constexpr int TotalExpansion = FrameWidth + Margin;
};
static constexpr int LineEdit_FrameWidth = 6;
// menu items
static constexpr int Menu_FrameWidth = 0;
......@@ -64,7 +59,7 @@ namespace Breeze
static constexpr int ComboBox_FrameWidth = 6;
// spinbox
static constexpr int SpinBox_FrameWidth = LineEdit::TotalExpansion;
static constexpr int SpinBox_FrameWidth = LineEdit_FrameWidth;
static constexpr int SpinBox_ArrowButtonWidth = 20;
// groupbox title margin
......
......@@ -39,7 +39,6 @@
#include <QPushButton>
#include <QRadioButton>
#include <QScrollBar>
#include <QSpinBox>
#include <QItemDelegate>
#include <QSplitterHandle>
#include <QTextEdit>
......@@ -514,14 +513,14 @@ namespace Breeze
// frame width
case PM_DefaultFrameWidth:
if( qobject_cast<const QMenu*>( widget ) ) return Metrics::Menu_FrameWidth;
if( qobject_cast<const QLineEdit*>( widget ) ) return Metrics::LineEdit::TotalExpansion;
if( qobject_cast<const QLineEdit*>( widget ) ) return Metrics::LineEdit_FrameWidth;
else if( isQtQuickControl( option, widget ) )
{
const QString &elementType = option->styleObject->property( "elementType" ).toString();
if( elementType == QLatin1String( "edit" ) || elementType == QLatin1String( "spinbox" ) )
{
return Metrics::LineEdit::TotalExpansion;
return Metrics::LineEdit_FrameWidth;
} else if( elementType == QLatin1String( "combobox" ) ) {
......@@ -536,7 +535,7 @@ namespace Breeze
case PM_ComboBoxFrameWidth:
{
const auto comboBoxOption( qstyleoption_cast< const QStyleOptionComboBox*>( option ) );
return comboBoxOption && comboBoxOption->editable ? Metrics::LineEdit::TotalExpansion : Metrics::ComboBox_FrameWidth;
return comboBoxOption && comboBoxOption->editable ? Metrics::LineEdit_FrameWidth : Metrics::ComboBox_FrameWidth;
}
case PM_SpinBoxFrameWidth: return Metrics::SpinBox_FrameWidth;
......@@ -860,39 +859,6 @@ namespace Breeze
}
bool Style::drawPanelLineEditPrimitive( const QStyleOption* opts, QPainter* painter, const QWidget* wid ) const
{
if (wid != nullptr) {
if (qobject_cast<QSpinBox*>(wid->parent()) || qobject_cast<QComboBox*>(wid->parent())) {
return true;
}
}
auto rect = opts->rect.adjusted( Metrics::LineEdit::Margin, Metrics::LineEdit::Margin, -Metrics::LineEdit::Margin, -Metrics::LineEdit::Margin );
auto palette = opts->palette;
if (qobject_cast<const QLineEdit*>(wid)) {
rect.adjust(1, 1, -1, -1);
} else if (wid == nullptr) {
rect.adjust(Metrics::LineEdit::Margin, Metrics::LineEdit::Margin, -Metrics::LineEdit::Margin, -Metrics::LineEdit::Margin);
}
auto radius = _helper->frameRadius( PenWidth::NoPen, -1 );
painter->save();
{
painter->setPen(QPen(palette.button().color()));
painter->setBrush(palette.button());
painter->drawRoundedRect(rect, radius, radius);
}
painter->restore();
drawFrameLineEditPrimitive(opts, painter, wid);
return true;
}
//______________________________________________________________
void Style::drawPrimitive( PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget ) const
{
......@@ -905,7 +871,6 @@ namespace Breeze
case PE_PanelButtonTool: fcn = &Style::drawPanelButtonToolPrimitive; break;
case PE_PanelScrollAreaCorner: fcn = &Style::drawPanelScrollAreaCornerPrimitive; break;
case PE_PanelMenu: fcn = &Style::drawPanelMenuPrimitive; break;
case PE_PanelLineEdit: fcn = &Style::drawPanelLineEditPrimitive; break;
case PE_PanelTipLabel: fcn = &Style::drawPanelTipLabelPrimitive; break;
case PE_PanelItemViewItem: fcn = &Style::drawPanelItemViewItemPrimitive; break;
case PE_IndicatorCheckBox: fcn = &Style::drawIndicatorCheckBoxPrimitive; break;
......@@ -3195,12 +3160,10 @@ namespace Breeze
{
// copy palette and rect
const auto& palette( option->palette );
auto rect( option->rect );
rect.adjust( Metrics::LineEdit::Margin, Metrics::LineEdit::Margin, -Metrics::LineEdit::Margin, -Metrics::LineEdit::Margin );
const auto& rect( option->rect );
// make sure there is enough room to render frame
if( rect.height() < 2*Metrics::LineEdit::FrameWidth + option->fontMetrics.height())
if( rect.height() < 2*Metrics::LineEdit_FrameWidth + option->fontMetrics.height())
{
const auto &background = palette.color( QPalette::Base );
......@@ -3229,7 +3192,7 @@ namespace Breeze
// render
const auto &background = palette.color( QPalette::Base );
const auto outline( hasHighlightNeutral( widget, option, mouseOver, hasFocus ) ? _helper->neutralText( palette ) : _helper->frameOutlineColor( palette, mouseOver, hasFocus, opacity, mode ) );
_helper->renderFrame( painter, rect, background, outline, hasFocus ? Helper::FrameHint::DoubleRing : Helper::FrameHint::None );
_helper->renderFrame( painter, rect, background, outline );
}
......
......@@ -234,7 +234,6 @@ namespace Breeze
{ return true; }
bool drawFramePrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
bool drawPanelLineEditPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
bool drawFrameLineEditPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
bool drawFrameFocusRectPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
bool drawFrameMenuPrimitive( const QStyleOption*, QPainter*, const QWidget* ) const;
......
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