[Kde-bindings] KDE/kdebindings/ruby/qtruby

Richard Dale Richard_Dale at tipitina.demon.co.uk
Fri Apr 17 10:20:54 UTC 2009


SVN commit 955253 by rdale:

 * When Qt::StandardItemModel#setItemPrototype was used with a 
   Qt::StandardItem it crashed because the clone() method was using 
   Object#clone. So special case the clone() method. Thanks to Stefano Crocco
   for reporting the bug.

CCMAIL: kde-bindings at kde.org



 M  +6 -0      ChangeLog  
 M  +23 -9     src/lib/Qt/qtruby4.rb  


--- trunk/KDE/kdebindings/ruby/qtruby/ChangeLog #955252:955253
@@ -1,3 +1,9 @@
+2009-04-17  Richard Dale  <richard.j.dale at gmail.com>
+  * When Qt::StandardItemModel#setItemPrototype was used with a 
+    Qt::StandardItem it crashed because the clone() method was using 
+    Object#clone. So special case the clone() method. Thanks to Stefano Crocco
+    for reporting the bug.
+
 2009-04-07  Richard Dale  <richard.j.dale at gmail.com>
 	* The ActiveRecord based model classes were setting changed values in the 
 	  'attributes' and then saving the changed instance, like this
--- trunk/KDE/kdebindings/ruby/qtruby/src/lib/Qt/qtruby4.rb #955252:955253
@@ -1256,7 +1256,7 @@
 
 	class ListWidgetItem < Qt::Base
 		def clone(*args)
-			method_missing(:clone, *args)
+			Qt::ListWidgetItem.new(self)
 		end
 
 		def type(*args)
@@ -1265,12 +1265,12 @@
 
 		def inspect
 			str = super
-			str.sub(/>$/, " text=%s>" % text)
+			str.sub(/>$/, " text='%s'>" % text)
 		end
 		
 		def pretty_print(pp)
 			str = to_s
-			pp.text str.sub(/>$/, " text=%s>" % text)
+			pp.text str.sub(/>$/, " text='%s'>" % text)
 		end
 	end
 
@@ -1855,9 +1855,23 @@
 	end
 
 	class StandardItem < Qt::Base 
+		def inspect
+			str = super
+			str.sub(/>$/, " text='%s'>" % [text])
+		end
+		
+		def pretty_print(pp)
+			str = to_s
+			pp.text str.sub(/>$/, "\n text='%s'>" % [text])
+		end
+
 		def type(*args)
 			method_missing(:type, *args)
 		end
+
+		def clone
+			Qt::StandardItem.new(self)
+		end
 	end
 
 	class StandardItemModel < Qt::Base 
@@ -1892,7 +1906,7 @@
 
 	class TableWidgetItem < Qt::Base
 		def clone(*args)
-			method_missing(:clone, *args)
+			Qt::TableWidgetItem.new(self)
 		end
 
 		def type(*args)
@@ -1901,12 +1915,12 @@
 
 		def inspect
 			str = super
-			str.sub(/>$/, " text=%s>" % text)
+			str.sub(/>$/, " text='%s'>" % text)
 		end
 		
 		def pretty_print(pp)
 			str = to_s
-			pp.text str.sub(/>$/, " text=%s>" % text)
+			pp.text str.sub(/>$/, " text='%s'>" % text)
 		end
 	end
 
@@ -2069,7 +2083,7 @@
 			str.sub!(/>$/, "")
 			str << " parent=%s," % parent unless parent.nil?
 			for i in 0..(columnCount - 1)
-				str << " text%d=%s," % [i, self.text(i)]
+				str << " text%d='%s'," % [i, self.text(i)]
 			end
 			str.sub!(/,?$/, ">")
 		end
@@ -2079,14 +2093,14 @@
 			str.sub!(/>$/, "")
 			str << " parent=%s," % parent unless parent.nil?
 			for i in 0..(columnCount - 1)
-				str << " text%d=%s," % [i, self.text(i)]
+				str << " text%d='%s'," % [i, self.text(i)]
 			end
 			str.sub!(/,?$/, ">")
 			pp.text str
 		end
 
 		def clone(*args)
-			method_missing(:clone, *args)
+			Qt::TreeWidgetItem.new(self)
 		end
 
 		def type(*args)



More information about the Kde-bindings mailing list