Added setStyled(bool) function for switching background and border of the widget on or off, to
have a transparent text-item for example. getter is bool styled() svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=688835
This commit is contained in:
parent
849800995b
commit
50ee468b54
@ -29,9 +29,15 @@ namespace Plasma
|
||||
class LineEdit::Private
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
: styled(true) {}
|
||||
|
||||
QString defaultText;
|
||||
QString oldText;
|
||||
QString defaultTextPlain;
|
||||
|
||||
bool styled;
|
||||
|
||||
};
|
||||
|
||||
LineEdit::LineEdit(QGraphicsItem *parent, QGraphicsScene *scene)
|
||||
@ -54,8 +60,10 @@ void LineEdit::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
panel.state = option->state;
|
||||
panel.rect = boundingRect().toRect();
|
||||
|
||||
widget->style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, painter, widget);
|
||||
widget->style()->drawPrimitive(QStyle::PE_FrameLineEdit, &panel, painter, widget);
|
||||
if(d->styled) {
|
||||
widget->style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, painter, widget);
|
||||
widget->style()->drawPrimitive(QStyle::PE_FrameLineEdit, &panel, painter, widget);
|
||||
}
|
||||
|
||||
// QGraphicsTextItem paints a black frame when it has focus
|
||||
// and is selected. We want to use our own frame, so we
|
||||
@ -80,6 +88,17 @@ void LineEdit::updated(const QString&, const DataEngine::Data& data)
|
||||
setHtml(text);
|
||||
}
|
||||
|
||||
|
||||
void LineEdit::setStyled(bool style)
|
||||
{
|
||||
d->styled = style;
|
||||
}
|
||||
|
||||
bool LineEdit::styled() const
|
||||
{
|
||||
return d->styled;
|
||||
}
|
||||
|
||||
Qt::Orientations LineEdit::expandingDirections() const
|
||||
{
|
||||
return Qt::Vertical;
|
||||
|
@ -49,6 +49,9 @@ class PLASMA_EXPORT LineEdit : public QGraphicsTextItem, public LayoutItem
|
||||
QSizeF minimumSize() const;
|
||||
QSizeF maximumSize() const;
|
||||
|
||||
void setStyled(bool style);
|
||||
bool styled() const;
|
||||
|
||||
bool hasHeightForWidth() const;
|
||||
qreal heightForWidth(qreal w) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user