* data->updated

* implement updated for lineedits; need to decide what to do for the rest

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=666854
This commit is contained in:
Aaron J. Seigo 2007-05-21 04:29:00 +00:00
parent cb00c95058
commit a4505ca37f
7 changed files with 19 additions and 9 deletions

View File

@ -38,6 +38,7 @@ class PLASMA_EXPORT DataEngine : public QObject
public:
typedef QHash<QString, DataEngine*> Dict;
typedef QHash<QString, QVariant> Data;
typedef QHashIterator<QString, QVariant> DataIterator;
DataEngine(QObject* parent);
virtual ~DataEngine();

View File

@ -111,8 +111,7 @@ void CheckBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
}
void CheckBox::data(const DataEngine::Data&)
void CheckBox::updated(const DataEngine::Data&)
{
}

View File

@ -59,7 +59,7 @@ class KDE_EXPORT CheckBox : public DataVisualization,public QGraphicsItem
public Q_SLOTS:
void data(const DataEngine::Data&);
void updated(const DataEngine::Data&);
Q_SIGNALS:
void clicked();
protected:

View File

@ -25,7 +25,7 @@ namespace Plasma
LineEdit::LineEdit(QGraphicsItem *parent, QGraphicsScene *scene)
: QGraphicsTextItem(parent, scene),
DataVisualization()
DataVisualization()
{
setTextInteractionFlags(Qt::TextEditorInteraction);
}
@ -53,8 +53,19 @@ void LineEdit::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QGraphicsTextItem::paint(painter, style, widget);
}
void LineEdit::data(const DataEngine::Data&)
void LineEdit::updated(const DataEngine::Data& data)
{
DataEngine::DataIterator it(data);
//TODO: this only shows the first possible data item.
// should it do more?
while (it.hasNext()) {
it.next();
if (it.value().canConvert(QVariant::String)) {
setPlainText(it.value().toString());
return;
}
}
}
} // namespace Plasma

View File

@ -41,8 +41,7 @@ class KDE_EXPORT LineEdit : public QGraphicsTextItem,
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
public Q_SLOTS:
void data(const DataEngine::Data&);
void updated(const DataEngine::Data&);
};
} // namespace Plasma

View File

@ -82,7 +82,7 @@ PushButton::~PushButton()
delete d;
}
void PushButton::data(const DataEngine::Data &data)
void PushButton::updated(const DataEngine::Data &data)
{
Q_UNUSED(data)
}

View File

@ -91,7 +91,7 @@ class KDE_EXPORT PushButton : public DataVisualization,
void clicked();
public Q_SLOTS:
virtual void data(const DataEngine::Data &);
virtual void updated(const DataEngine::Data &);
protected:
bool isDown();