fix drawing of focusindicator of spinbox and combobox

use the proper prefix for drawing the combobox focusindicator
This commit is contained in:
Marco Martin 2011-11-08 12:57:46 +01:00
parent 4fad696891
commit a70c17bc59
4 changed files with 27 additions and 1 deletions

View File

@ -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>

View File

@ -43,6 +43,9 @@ public:
void animateVisibility(const bool visible);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setFrameSvg(FrameSvg *svg);
FrameSvg *frameSvg() const;
protected:
bool eventFilter(QObject *watched, QEvent *event);
void resizeEvent(QGraphicsSceneResizeEvent *event);

View File

@ -56,6 +56,7 @@ public:
FrameSvg *background;
FrameSvg *lineEditBackground;
FocusIndicator *focusIndicator;
int animId;
qreal opacity;
QRectF activeRect;
@ -99,6 +100,13 @@ void ComboBoxPrivate::syncBorders()
q->setFont(Theme::defaultTheme()->font(Theme::DefaultFont));
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();
new FocusIndicator(this, d->background);
d->focusIndicator = new FocusIndicator(this, d->background);
setNativeWidget(new KComboBox);
connect(d->background, SIGNAL(repaintNeeded()), SLOT(syncBorders()));
d->initTheming();

View File

@ -76,6 +76,9 @@ SpinBox::SpinBox(QGraphicsWidget *parent)
d->background->setImagePath("widgets/lineedit");
d->background->setCacheAllRenderedFrames(true);
if (d->background->hasElement("hint-focus-over-base")) {
d->focusIndicator->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
}
d->style = Plasma::Style::sharedStyle();
native->setStyle(d->style.data());