22#include <QGraphicsSceneResizeEvent>
25#include <QGraphicsView>
32#include "private/style_p.h"
33#include "private/focusindicator_p.h"
34#include "private/themedwidgetinterface_p.h"
40class LineEditPrivate :
public ThemedWidgetInterface<LineEdit>
43 LineEditPrivate(LineEdit *lineEdit)
44 : ThemedWidgetInterface<LineEdit>(lineEdit)
46 buttonColorForText =
true;
54 Plasma::Style::Ptr style;
60 d(new LineEditPrivate(this))
62 d->style = Plasma::Style::sharedStyle();
64 d->background->setImagePath(
"widgets/lineedit");
65 d->background->setCacheAllRenderedFrames(
true);
68 FocusIndicator *indicator =
new FocusIndicator(
this, d->background);
69 if (d->background->hasElement(
"hint-focus-over-base")) {
70 indicator->setFlag(QGraphicsItem::ItemStacksBehindParent,
false);
79 Plasma::Style::doneWithSharedStyle();
82void LineEdit::setText(
const QString &text)
87QString LineEdit::text()
const
89 return static_cast<KLineEdit*
>(widget())->
text();
92void LineEdit::setClearButtonShown(
bool show)
97bool LineEdit::isClearButtonShown()
const
102void LineEdit::setClickMessage(
const QString &message)
107QString LineEdit::clickMessage()
const
112void LineEdit::setStyleSheet(
const QString &stylesheet)
114 widget()->setStyleSheet(stylesheet);
117QString LineEdit::styleSheet()
119 return widget()->styleSheet();
122void LineEdit::setNativeWidget(KLineEdit *nativeWidget)
125 widget()->deleteLater();
143KLineEdit *LineEdit::nativeWidget()
const
145 return static_cast<KLineEdit*
>(widget());
148void LineEdit::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
154void LineEdit::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
165 nativeWidget()->render(painter, QPoint(0, 0), QRegion(), QWidget::DrawChildren|QWidget::IgnoreMask);
168void LineEdit::changeEvent(QEvent *event)
170 d->changeEvent(event);
171 QGraphicsProxyWidget::changeEvent(event);
174void LineEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
179 while (!applet && widget) {
180 widget = widget->parentWidget();
181 applet = qobject_cast<Plasma::Applet *>(widget);
187 QGraphicsProxyWidget::mousePressEvent(event);
190void LineEdit::focusInEvent(QFocusEvent *event)
192 QGraphicsProxyWidget::focusInEvent(event);
201void LineEdit::focusOutEvent(QFocusEvent *event)
206 while (!applet && widget) {
207 widget = widget->parentWidget();
208 applet = qobject_cast<Plasma::Applet *>(widget);
215 QEvent closeEvent(QEvent::CloseSoftwareInputPanel);
217 if (
QGraphicsView *view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
218 if (view->scene() && view->scene() == scene()) {
219 QApplication::sendEvent(view, &closeEvent);
224 QGraphicsProxyWidget::focusOutEvent(event);
231#include <lineedit.moc>
void setStatus(const ItemStatus stat)
sets the status for this applet
Provides an SVG with borders.
void setNativeWidget(KLineEdit *nativeWidget)
Sets the line edit wrapped by this LineEdit (widget must inherit KLineEdit), ownership is transferred...
void textChanged(const QString &text)
Emitted when the text changes.
void setText(const QString &text)
Sets the display text for this LineEdit.
QGraphicsWidget * parentWidget
void textEdited(const QString &text)
void focusChanged(bool focused)
Emitted when the widget receives or loses focus.
Namespace for everything in libplasma.
@ AcceptingInputStatus
The Item is accepting input.
@ UnknownStatus
The status is unknown.