fix drawing of focusindicator of spinbox and combobox
use the proper prefix for drawing the combobox focusindicator
This commit is contained in:
parent
4fad696891
commit
a70c17bc59
@ -304,6 +304,18 @@ void FocusIndicator::syncGeometry()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FocusIndicator::setFrameSvg(FrameSvg *frameSvg)
|
||||||
|
{
|
||||||
|
if (m_background != frameSvg) {
|
||||||
|
m_background = frameSvg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameSvg *FocusIndicator::frameSvg() const
|
||||||
|
{
|
||||||
|
return m_background;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <focusindicator_p.moc>
|
#include <focusindicator_p.moc>
|
||||||
|
@ -43,6 +43,9 @@ public:
|
|||||||
void animateVisibility(const bool visible);
|
void animateVisibility(const bool visible);
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
|
|
||||||
|
void setFrameSvg(FrameSvg *svg);
|
||||||
|
FrameSvg *frameSvg() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
void resizeEvent(QGraphicsSceneResizeEvent *event);
|
void resizeEvent(QGraphicsSceneResizeEvent *event);
|
||||||
|
@ -56,6 +56,7 @@ public:
|
|||||||
|
|
||||||
FrameSvg *background;
|
FrameSvg *background;
|
||||||
FrameSvg *lineEditBackground;
|
FrameSvg *lineEditBackground;
|
||||||
|
FocusIndicator *focusIndicator;
|
||||||
int animId;
|
int animId;
|
||||||
qreal opacity;
|
qreal opacity;
|
||||||
QRectF activeRect;
|
QRectF activeRect;
|
||||||
@ -99,6 +100,13 @@ void ComboBoxPrivate::syncBorders()
|
|||||||
q->setFont(Theme::defaultTheme()->font(Theme::DefaultFont));
|
q->setFont(Theme::defaultTheme()->font(Theme::DefaultFont));
|
||||||
customFont = false;
|
customFont = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (q->nativeWidget()->isEditable()) {
|
||||||
|
focusIndicator->setFrameSvg(lineEditBackground);
|
||||||
|
} else {
|
||||||
|
focusIndicator->setFrameSvg(background);
|
||||||
|
}
|
||||||
|
focusIndicator->setFlag(QGraphicsItem::ItemStacksBehindParent, !q->nativeWidget()->isEditable() || !lineEditBackground->hasElement("hint-focus-over-base"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,7 +127,7 @@ ComboBox::ComboBox(QGraphicsWidget *parent)
|
|||||||
|
|
||||||
d->style = Style::sharedStyle();
|
d->style = Style::sharedStyle();
|
||||||
|
|
||||||
new FocusIndicator(this, d->background);
|
d->focusIndicator = new FocusIndicator(this, d->background);
|
||||||
setNativeWidget(new KComboBox);
|
setNativeWidget(new KComboBox);
|
||||||
connect(d->background, SIGNAL(repaintNeeded()), SLOT(syncBorders()));
|
connect(d->background, SIGNAL(repaintNeeded()), SLOT(syncBorders()));
|
||||||
d->initTheming();
|
d->initTheming();
|
||||||
|
@ -76,6 +76,9 @@ SpinBox::SpinBox(QGraphicsWidget *parent)
|
|||||||
d->background->setImagePath("widgets/lineedit");
|
d->background->setImagePath("widgets/lineedit");
|
||||||
d->background->setCacheAllRenderedFrames(true);
|
d->background->setCacheAllRenderedFrames(true);
|
||||||
|
|
||||||
|
if (d->background->hasElement("hint-focus-over-base")) {
|
||||||
|
d->focusIndicator->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||||
|
}
|
||||||
|
|
||||||
d->style = Plasma::Style::sharedStyle();
|
d->style = Plasma::Style::sharedStyle();
|
||||||
native->setStyle(d->style.data());
|
native->setStyle(d->style.data());
|
||||||
|
Loading…
Reference in New Issue
Block a user