Merge branch 'KDE/4.7' into ksecretsservice

This commit is contained in:
Valentin Rusu 2011-11-08 21:27:31 +01:00
commit da386deb15
6 changed files with 34 additions and 7 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> #include <focusindicator_p.moc>

View File

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

View File

@ -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();

View File

@ -94,13 +94,14 @@ void DeclarativeWidgetPrivate::execute(const QString &fileName)
return; return;
} }
component->loadUrl(fileName);
KDeclarative kdeclarative; KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine); kdeclarative.setDeclarativeEngine(engine);
kdeclarative.initialize(); kdeclarative.initialize();
//binds things like kconfig and icons //binds things like kconfig and icons
kdeclarative.setupBindings(); kdeclarative.setupBindings();
component->loadUrl(fileName);
scriptEngine = kdeclarative.scriptEngine(); scriptEngine = kdeclarative.scriptEngine();
registerDataEngineMetaTypes(scriptEngine); registerDataEngineMetaTypes(scriptEngine);
@ -194,9 +195,6 @@ DeclarativeWidget::DeclarativeWidget(QGraphicsWidget *parent)
d->engine = new QDeclarativeEngine(this); d->engine = new QDeclarativeEngine(this);
d->engine->setNetworkAccessManagerFactory(new DeclarativeNetworkAccessManagerFactory); d->engine->setNetworkAccessManagerFactory(new DeclarativeNetworkAccessManagerFactory);
foreach(const QString &importPath, KGlobal::dirs()->findDirs("module", "imports")) {
d->engine->addImportPath(importPath);
}
d->component = new QDeclarativeComponent(d->engine, this); d->component = new QDeclarativeComponent(d->engine, this);
} }

View File

@ -64,7 +64,10 @@ LineEdit::LineEdit(QGraphicsWidget *parent)
d->background->setImagePath("widgets/lineedit"); d->background->setImagePath("widgets/lineedit");
d->background->setCacheAllRenderedFrames(true); d->background->setCacheAllRenderedFrames(true);
new FocusIndicator(this, d->background); FocusIndicator *indicator = new FocusIndicator(this, d->background);
if (d->background->hasElement("hint-focus-over-base")) {
indicator->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
}
setNativeWidget(new KLineEdit); setNativeWidget(new KLineEdit);
} }

View File

@ -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());