~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to solid/networkmanager-0.7/nmpropertytest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <QtCore/QObject>
 
2
#include <QtCore/QString>
 
3
#include "nmpropertyhelper.h"
 
4
 
 
5
#include <QDebug>
 
6
 
 
7
FrobObject::FrobObject() : QObject(0)
 
8
{
 
9
}
 
10
FrobObject::~FrobObject()
 
11
{
 
12
}
 
13
 
 
14
QString FrobObject::frobozz() const
 
15
{
 
16
    return mFrobozz;
 
17
}
 
18
 
 
19
void FrobObject::setFrobozz(const QString& frob)
 
20
{
 
21
    mFrobozz = frob;
 
22
}
 
23
 
 
24
int main(int argc, char**argv)
 
25
{
 
26
    FrobObject obj;
 
27
    NMPropertyHelper hlp(&obj);
 
28
 
 
29
    QPair<char*,char*> spec;
 
30
    spec.first = "frobozz";
 
31
    spec.second = "frobozzChanged";
 
32
    hlp.registerProperty("frobozz", spec);
 
33
    hlp.registerProperty("othername", QPair<char*,char*>("myname", 0));
 
34
 
 
35
    QVariantMap map;
 
36
    map.insert(QString("frobozz"), QVariant(42.0));
 
37
    map.insert(QString("othername"), QVariant("pas"));
 
38
    hlp.deserializeProperties(map);
 
39
    qDebug("Hello mom");
 
40
    qDebug() << "map keys: " <<  map.keys();
 
41
    qDebug() << "qobj frobozz property (names match): " << obj.property("frobozz");
 
42
    qDebug() << "qobj myname property (mapped from othername): " << obj.property("myname");
 
43
    return 0;
 
44
}