[Kde-bindings] [Bug 110415] [qtruby] allow Qt::Object::inherits to use QtRuby syntax
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Tue Aug 9 09:27:57 UTC 2005
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=110415
------- Additional Comments From Richard_Dale tipitina demon co uk 2005-08-09 11:27 -------
SVN commit 444221 by rdale:
* Caleb Tennis wrote:
One nice feature would be to allow Qt::Object::inherits() to use the QtRuby
naming scheme for valid lookups. For example, right now:
irb(main):001:0> w = Qt::Widget.new(nil)
irb(main):002:0> w.inherits("Qt::Widget")
=> true
irb(main):003:0> w.inherits("Qt::Object")
=> false
irb(main):004:0> w.inherits("QWidget")
=> true
irb(main):005:0> w.inherits("QObject")
=> true
* Inherits now works for "QObject", and for "Qt::Object" as well.
CCBUGS: 110415
M +18 -0 ChangeLog
M +20 -0 rubylib/qtruby/Qt.cpp
--- branches/KDE/3.5/kdebindings/qtruby/ChangeLog #444220:444221
@ -1,3 +1,21 @
+2005-08-09 Richard Dale <Richard_Dale tipitina demon co uk>
+
+ * Caleb Tennis wrote:
+ One nice feature would be to allow Qt::Object::inherits() to use the QtRuby
+ naming scheme for valid lookups. For example, right now:
+
+ irb(main):001:0> w = Qt::Widget.new(nil)
+ irb(main):002:0> w.inherits("Qt::Widget")
+ => true
+ irb(main):003:0> w.inherits("Qt::Object")
+ => false
+ irb(main):004:0> w.inherits("QWidget")
+ => true
+ irb(main):005:0> w.inherits("QObject")
+ => true
+
+ * Inherits now works for "QObject", and for "Qt::Object" as well.
+
2005-08-04 Richard Dale <Richard_Dale tipitina demon co uk>
* Added a file called 'COPYING' to the qtruby project, with a note that
--- branches/KDE/3.5/kdebindings/qtruby/rubylib/qtruby/Qt.cpp #444220:444221
@ -1784,6 +1784,25 @
return rb_funcall(klass, rb_intern("name"), 0);
}
+// Allow classnames in both 'Qt::Widget' and 'QWidget' formats to be
+// used as an argument to Qt::Object.inherits()
+static VALUE
+inherits_qobject(int argc, VALUE * argv, VALUE /*self*/)
+{
+ if (argc != 1) {
+ return rb_call_super(argc, argv);
+ }
+
+ Smoke::Index * classId = classcache.find(StringValuePtr(argv[0]));
+
+ if (classId == 0) {
+ return rb_call_super(argc, argv);
+ } else {
+ VALUE super_class = rb_str_new2(qt_Smoke->classes[*classId].className);
+ return rb_call_super(argc, &super_class);
+ }
+}
+
static void
mocargs_free(void * ptr)
{
@ -2477,6 +2496,7 @
rb_define_method(klass, "pretty_print", (VALUE (*) (...)) pretty_print_qobject, 1);
rb_define_method(klass, "receivers", (VALUE (*) (...)) receivers_qobject, 0);
rb_define_method(klass, "className", (VALUE (*) (...)) class_name, 0);
+ rb_define_method(klass, "inherits", (VALUE (*) (...)) inherits_qobject, -1);
return klass;
}
More information about the Kde-bindings
mailing list