[Kde-bindings] KDE/kdebindings/ruby/qtruby
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Mon Aug 11 13:24:19 UTC 2008
SVN commit 845320 by rdale:
* Special case the Qt::SignalMapper#mapping and Qt::SignalMapper#setMapping
methods so they work with both Qt::Object and Qt::Widget arguments as it
confuses the method overloading resolution code at present.
* Add lower case/underscore methods as well as camel case for special cased
methods
CCMAIL: kde-bindings at kde.org
M +5 -0 ChangeLog
M +103 -0 src/qtruby.cpp
--- trunk/KDE/kdebindings/ruby/qtruby/ChangeLog #845319:845320
@@ -7,6 +7,11 @@
doc = KTextEditor::EditorChooser.editor('katepart').create_document( nil)
annotator = doc.qobject_cast(KTextEditor::AnnotationInterface)
+ * Special case the Qt::SignalMapper#mapping and Qt::SignalMapper#setMapping
+ methods so they work with both Qt::Object and Qt::Widget arguments as it
+ confuses the method overloading resolution code at present.
+ * Add lower case/underscore methods as well as camel case for special cased
+ methods
2008-08-10 Richard Dale <richard.j.dale at gmail.com>
--- trunk/KDE/kdebindings/ruby/qtruby/src/qtruby.cpp #845319:845320
@@ -886,6 +886,78 @@
}
static VALUE
+qsignalmapper_mapping(int argc, VALUE * argv, VALUE self)
+{
+ if (argc == 1 && TYPE(argv[0]) == T_DATA) {
+ smokeruby_object *o = value_obj_info(self);
+ smokeruby_object *a = value_obj_info(argv[0]);
+
+ Smoke::ModuleIndex nameId = qt_Smoke->NullModuleIndex;
+ nameId = o->smoke->idMethodName("mapping#");
+ Smoke::ModuleIndex ci = { o->smoke, o->classId };
+ Smoke::ModuleIndex meth = o->smoke->findMethod(ci, nameId);
+ Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
+ i = -i; // turn into ambiguousMethodList index
+ while (meth.smoke->ambiguousMethodList[i] != 0) {
+ if ( ( qstrcmp( meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name,
+ "QObject*" ) == 0
+ && a->smoke->isDerivedFromByName(a->smoke->classes[a->classId].className, "QObject")
+ && !a->smoke->isDerivedFromByName(a->smoke->classes[a->classId].className, "QWidget") )
+ || ( qstrcmp( meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name,
+ "QWidget*" ) == 0
+ && a->smoke->isDerivedFromByName(a->smoke->classes[a->classId].className, "QWidget") ) )
+ {
+ _current_method.smoke = meth.smoke;
+ _current_method.index = meth.smoke->ambiguousMethodList[i];
+ QtRuby::MethodCall c(meth.smoke, _current_method.index, self, argv, 1);
+ c.next();
+ return *(c.var());
+ }
+
+ i++;
+ }
+ }
+
+ return rb_call_super(argc, argv);
+}
+
+static VALUE
+qsignalmapper_set_mapping(int argc, VALUE * argv, VALUE self)
+{
+ if (argc == 2 && TYPE(argv[0]) == T_DATA && TYPE(argv[1]) == T_DATA) {
+ smokeruby_object *o = value_obj_info(self);
+ smokeruby_object *a = value_obj_info(argv[1]);
+
+ Smoke::ModuleIndex nameId = qt_Smoke->NullModuleIndex;
+ nameId = o->smoke->idMethodName("setMapping##");
+ Smoke::ModuleIndex ci = { o->smoke, o->classId };
+ Smoke::ModuleIndex meth = o->smoke->findMethod(ci, nameId);
+ Smoke::Index i = meth.smoke->methodMaps[meth.index].method;
+ i = -i; // turn into ambiguousMethodList index
+ while (meth.smoke->ambiguousMethodList[i] != 0) {
+ if ( ( qstrcmp( meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args + 1]].name,
+ "QObject*" ) == 0
+ && a->smoke->isDerivedFromByName(a->smoke->classes[a->classId].className, "QObject")
+ && !a->smoke->isDerivedFromByName(a->smoke->classes[a->classId].className, "QWidget") )
+ || ( qstrcmp( meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args + 1]].name,
+ "QWidget*" ) == 0
+ && a->smoke->isDerivedFromByName(a->smoke->classes[a->classId].className, "QWidget") ) )
+ {
+ _current_method.smoke = meth.smoke;
+ _current_method.index = meth.smoke->ambiguousMethodList[i];
+ QtRuby::MethodCall c(meth.smoke, _current_method.index, self, argv, 2);
+ c.next();
+ return *(c.var());
+ }
+
+ i++;
+ }
+ }
+
+ return rb_call_super(argc, argv);
+}
+
+static VALUE
qvariant_value(VALUE /*self*/, VALUE variant_value_klass, VALUE variant_value)
{
void * value_ptr = 0;
@@ -1994,30 +2066,46 @@
} else if (packageName == "Qt::AbstractTableModel") {
qtablemodel_class = rb_define_class_under(qt_module, "TableModel", klass);
rb_define_method(qtablemodel_class, "rowCount", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
+ rb_define_method(qtablemodel_class, "row_count", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
rb_define_method(qtablemodel_class, "columnCount", (VALUE (*) (...)) qabstract_item_model_columncount, -1);
+ rb_define_method(qtablemodel_class, "column_count", (VALUE (*) (...)) qabstract_item_model_columncount, -1);
rb_define_method(qtablemodel_class, "data", (VALUE (*) (...)) qabstract_item_model_data, -1);
rb_define_method(qtablemodel_class, "setData", (VALUE (*) (...)) qabstract_item_model_setdata, -1);
+ rb_define_method(qtablemodel_class, "set_data", (VALUE (*) (...)) qabstract_item_model_setdata, -1);
rb_define_method(qtablemodel_class, "flags", (VALUE (*) (...)) qabstract_item_model_flags, 1);
rb_define_method(qtablemodel_class, "insertRows", (VALUE (*) (...)) qabstract_item_model_insertrows, -1);
+ rb_define_method(qtablemodel_class, "insert_rows", (VALUE (*) (...)) qabstract_item_model_insertrows, -1);
rb_define_method(qtablemodel_class, "insertColumns", (VALUE (*) (...)) qabstract_item_model_insertcolumns, -1);
+ rb_define_method(qtablemodel_class, "insert_columns", (VALUE (*) (...)) qabstract_item_model_insertcolumns, -1);
rb_define_method(qtablemodel_class, "removeRows", (VALUE (*) (...)) qabstract_item_model_removerows, -1);
+ rb_define_method(qtablemodel_class, "remove_rows", (VALUE (*) (...)) qabstract_item_model_removerows, -1);
rb_define_method(qtablemodel_class, "removeColumns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
+ rb_define_method(qtablemodel_class, "remove_columns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
qlistmodel_class = rb_define_class_under(qt_module, "ListModel", klass);
rb_define_method(qlistmodel_class, "rowCount", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
+ rb_define_method(qlistmodel_class, "row_count", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
rb_define_method(qlistmodel_class, "columnCount", (VALUE (*) (...)) qabstract_item_model_columncount, -1);
+ rb_define_method(qlistmodel_class, "column_count", (VALUE (*) (...)) qabstract_item_model_columncount, -1);
rb_define_method(qlistmodel_class, "data", (VALUE (*) (...)) qabstract_item_model_data, -1);
rb_define_method(qlistmodel_class, "setData", (VALUE (*) (...)) qabstract_item_model_setdata, -1);
+ rb_define_method(qlistmodel_class, "set_data", (VALUE (*) (...)) qabstract_item_model_setdata, -1);
rb_define_method(qlistmodel_class, "flags", (VALUE (*) (...)) qabstract_item_model_flags, 1);
rb_define_method(qlistmodel_class, "insertRows", (VALUE (*) (...)) qabstract_item_model_insertrows, -1);
+ rb_define_method(qlistmodel_class, "insert_rows", (VALUE (*) (...)) qabstract_item_model_insertrows, -1);
rb_define_method(qlistmodel_class, "insertColumns", (VALUE (*) (...)) qabstract_item_model_insertcolumns, -1);
+ rb_define_method(qlistmodel_class, "insert_columns", (VALUE (*) (...)) qabstract_item_model_insertcolumns, -1);
rb_define_method(qlistmodel_class, "removeRows", (VALUE (*) (...)) qabstract_item_model_removerows, -1);
+ rb_define_method(qlistmodel_class, "remove_rows", (VALUE (*) (...)) qabstract_item_model_removerows, -1);
rb_define_method(qlistmodel_class, "removeColumns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
+ rb_define_method(qlistmodel_class, "remove_columns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
}
else if (packageName == "Qt::AbstractItemModel") {
rb_define_method(klass, "createIndex", (VALUE (*) (...)) qabstractitemmodel_createindex, -1);
+ rb_define_method(klass, "create_index", (VALUE (*) (...)) qabstractitemmodel_createindex, -1);
} else if (packageName == "Qt::Timer") {
rb_define_singleton_method(klass, "singleShot", (VALUE (*) (...)) qtimer_single_shot, -1);
+ rb_define_singleton_method(klass, "single_shot", (VALUE (*) (...)) qtimer_single_shot, -1);
}
@@ -2025,9 +2113,12 @@
rb_define_method(klass, "inspect", (VALUE (*) (...)) inspect_qobject, 0);
rb_define_method(klass, "pretty_print", (VALUE (*) (...)) pretty_print_qobject, 1);
rb_define_method(klass, "className", (VALUE (*) (...)) class_name, 0);
+ rb_define_method(klass, "class_name", (VALUE (*) (...)) class_name, 0);
rb_define_method(klass, "inherits", (VALUE (*) (...)) inherits_qobject, -1);
rb_define_method(klass, "findChildren", (VALUE (*) (...)) find_qobject_children, -1);
+ rb_define_method(klass, "find_children", (VALUE (*) (...)) find_qobject_children, -1);
rb_define_method(klass, "findChild", (VALUE (*) (...)) find_qobject_child, -1);
+ rb_define_method(klass, "find_child", (VALUE (*) (...)) find_qobject_child, -1);
rb_define_method(klass, "connect", (VALUE (*) (...)) qobject_connect, -1);
rb_define_singleton_method(klass, "connect", (VALUE (*) (...)) qobject_connect, -1);
@@ -2061,6 +2152,7 @@
} else if (packageName == "Qt::Variant") {
qvariant_class = klass;
rb_define_singleton_method(qvariant_class, "fromValue", (VALUE (*) (...)) qvariant_from_value, -1);
+ rb_define_singleton_method(qvariant_class, "from_value", (VALUE (*) (...)) qvariant_from_value, -1);
rb_define_singleton_method(qvariant_class, "new", (VALUE (*) (...)) new_qvariant, -1);
} else if (packageName == "Qt::ByteArray") {
rb_define_method(klass, "+", (VALUE (*) (...)) qbytearray_append, 1);
@@ -2073,15 +2165,26 @@
rb_define_method(klass, "length", (VALUE (*) (...)) qitemselection_count, 0);
} else if (packageName == "Qt::Painter") {
rb_define_method(klass, "drawLines", (VALUE (*) (...)) qpainter_drawlines, -1);
+ rb_define_method(klass, "draw_lines", (VALUE (*) (...)) qpainter_drawlines, -1);
rb_define_method(klass, "drawRects", (VALUE (*) (...)) qpainter_drawrects, -1);
+ rb_define_method(klass, "draw_rects", (VALUE (*) (...)) qpainter_drawrects, -1);
} else if (packageName == "Qt::ModelIndex") {
rb_define_method(klass, "internalPointer", (VALUE (*) (...)) qmodelindex_internalpointer, 0);
+ rb_define_method(klass, "internal_pointer", (VALUE (*) (...)) qmodelindex_internalpointer, 0);
+ } else if (packageName == "Qt::SignalMapper") {
+ rb_define_method(klass, "mapping", (VALUE (*) (...)) qsignalmapper_mapping, -1);
+ rb_define_method(klass, "setMapping", (VALUE (*) (...)) qsignalmapper_set_mapping, -1);
+ rb_define_method(klass, "set_mapping", (VALUE (*) (...)) qsignalmapper_set_mapping, -1);
#ifdef QT_QTDBUS
} else if (packageName == "Qt::DBusArgument") {
rb_define_method(klass, "endArrayWrite", (VALUE (*) (...)) qdbusargument_endarraywrite, 0);
+ rb_define_method(klass, "end_array_write", (VALUE (*) (...)) qdbusargument_endarraywrite, 0);
rb_define_method(klass, "endMapEntryWrite", (VALUE (*) (...)) qdbusargument_endmapentrywrite, 0);
+ rb_define_method(klass, "end_map_entry_write", (VALUE (*) (...)) qdbusargument_endmapentrywrite, 0);
rb_define_method(klass, "endMapWrite", (VALUE (*) (...)) qdbusargument_endmapwrite, 0);
+ rb_define_method(klass, "end_map_write", (VALUE (*) (...)) qdbusargument_endmapwrite, 0);
rb_define_method(klass, "endStructureWrite", (VALUE (*) (...)) qdbusargument_endstructurewrite, 0);
+ rb_define_method(klass, "end_structure_write", (VALUE (*) (...)) qdbusargument_endstructurewrite, 0);
#endif
}
More information about the Kde-bindings
mailing list