[Kde-bindings] KDE/kdebindings/csharp/qyoto
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Sat Apr 14 21:08:30 UTC 2007
SVN commit 654023 by rdale:
* Added implicit operator conversions for various types to QVariants
CCMAIL: kde-bindings at kde.org
M +1 -0 ChangeLog
M +72 -0 core/QVariantExtras.cs
M +2 -2 examples/itemviews/simpletreemodel/treemodel.cs
M +1 -1 examples/qdbus/chat/chat.cs
M +7 -6 examples/qdbus/complexpingpong/complexpong.cs
M +1 -2 examples/qdbus/pingpong/ping.cs
--- trunk/KDE/kdebindings/csharp/qyoto/ChangeLog #654022:654023
@@ -1,6 +1,7 @@
2007-04-14 Richard Dale <rdale at foton.es>
* Fixed some compiler warnings
+ * Added implicit operator conversions for various types to QVariants
2007-04-13 Arno Rehn <arno at arnorehn.de>
--- trunk/KDE/kdebindings/csharp/qyoto/core/QVariantExtras.cs #654022:654023
@@ -133,5 +133,77 @@
return new QVariant();
}
}
+ public static implicit operator QVariant(int arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(uint arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(long arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(ulong arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(bool arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(double arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(string arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QByteArray arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QColor arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QCursor arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QFont arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QIcon arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QImage arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QKeySequence arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QMatrix arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QPalette arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QPen arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QPixmap arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QPolygon arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QRegion arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QSizePolicy arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QTextFormat arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QTextLength arg) {
+ return new QVariant(arg);
+ }
+ public static implicit operator QVariant(QTransform arg) {
+ return new QVariant(arg);
+ }
}
}
\ No newline at end of file
--- trunk/KDE/kdebindings/csharp/qyoto/examples/itemviews/simpletreemodel/treemodel.cs #654022:654023
@@ -31,8 +31,8 @@
public TreeModel(string data, QObject parent) : base(parent) {
List<QVariant> rootData = new List<QVariant>();
- rootData.Add(new QVariant("Title"));
- rootData.Add(new QVariant("Summary"));
+ rootData.Add("Title");
+ rootData.Add("Summary");
rootItem = new TreeItem(rootData);
SetupModelData(new List<string>(data.Split("\n".ToCharArray())), rootItem);
}
--- trunk/KDE/kdebindings/csharp/qyoto/examples/qdbus/chat/chat.cs #654022:654023
@@ -103,7 +103,7 @@
{
//Emit.message(m_nickname, messageLineEdit.text());
QDBusMessage msg = QDBusMessage.CreateSignal("/", "com.trolltech.chat", "message");
- msg.Write(new QVariant(m_nickname)).Write(new QVariant(m_ui.messageLineEdit.Text));
+ msg.Write(m_nickname).Write(m_ui.messageLineEdit.Text);
QDBusConnection.SessionBus().Send(msg);
m_ui.messageLineEdit.Text = "";
}
--- trunk/KDE/kdebindings/csharp/qyoto/examples/qdbus/complexpingpong/complexpong.cs #654022:654023
@@ -58,18 +58,19 @@
string q = query.ToLower();
if (q == "hello")
- return new QDBusVariant(new QVariant("World"));
+ return new QDBusVariant("World");
+// return new QDBusVariant("World");
if (q == "ping")
- return new QDBusVariant(new QVariant("Pong"));
+ return new QDBusVariant("Pong");
if (q == "the answer to life, the universe and everything")
- return new QDBusVariant(new QVariant(42));
+ return new QDBusVariant(42);
if (q.IndexOf("unladen swallow") != -1) {
if (q.IndexOf("european") != -1)
- return new QDBusVariant(new QVariant(11.0));
- return new QDBusVariant(new QVariant(new QByteArray("african or european?")));
+ return new QDBusVariant(11.0);
+ return new QDBusVariant(new QByteArray("african or european?"));
}
- return new QDBusVariant(new QVariant("Sorry, I don't know the answer"));
+ return new QDBusVariant("Sorry, I don't know the answer");
}
public static int Main(string[] args) {
--- trunk/KDE/kdebindings/csharp/qyoto/examples/qdbus/pingpong/ping.cs #654022:654023
@@ -40,8 +40,7 @@
QDBusInterface iface = new QDBusInterface(SERVICE_NAME, "/", "", QDBusConnection.SessionBus());
if (iface.IsValid()) {
-//Debug.SetDebug(QtDebugChannel.QTDB_ALL);
- QDBusMessage message = iface.Call("ping", new QVariant(args.Length > 0 ? args[0] : ""));
+ QDBusMessage message = iface.Call("ping", args.Length > 0 ? args[0] : "");
QDBusReply<string> reply = new QDBusReply<string>(message);
if (reply.IsValid()) {
Console.WriteLine("Reply was: {0}", reply.Value());
More information about the Kde-bindings
mailing list