Allow to use it as multiline (need by notes plasma)
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=690899
This commit is contained in:
parent
17b3de682f
commit
3e1f6c75c1
@ -30,13 +30,14 @@ class LineEdit::Private
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
: styled(true) {}
|
||||
: styled(true), multiline(false) {}
|
||||
|
||||
QString defaultText;
|
||||
QString oldText;
|
||||
QString defaultTextPlain;
|
||||
|
||||
bool styled;
|
||||
bool multiline;
|
||||
|
||||
};
|
||||
|
||||
@ -88,6 +89,16 @@ void LineEdit::updated(const QString&, const DataEngine::Data& data)
|
||||
setHtml(text);
|
||||
}
|
||||
|
||||
void LineEdit::setMultiLine(bool multi)
|
||||
{
|
||||
d->multiline = multi;
|
||||
}
|
||||
|
||||
bool LineEdit::multiLine() const
|
||||
{
|
||||
return d->multiline;
|
||||
}
|
||||
|
||||
|
||||
void LineEdit::setStyled(bool style)
|
||||
{
|
||||
@ -184,7 +195,7 @@ const QString LineEdit::toPlainText()
|
||||
|
||||
void LineEdit::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
|
||||
if ( !d->multiline && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)) {
|
||||
emit editingFinished();
|
||||
event->accept();
|
||||
} else {
|
||||
|
@ -52,6 +52,9 @@ class PLASMA_EXPORT LineEdit : public QGraphicsTextItem, public LayoutItem
|
||||
void setStyled(bool style);
|
||||
bool styled() const;
|
||||
|
||||
void setMultiLine(bool multi);
|
||||
bool multiLine() const;
|
||||
|
||||
bool hasHeightForWidth() const;
|
||||
qreal heightForWidth(qreal w) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user